You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/09/25 06:32:08 UTC
svn commit: r579061 - in /incubator/tuscany/java/sca/tools/plugin-core: ./
META-INF/ src/main/java/org/apache/tuscany/sca/core/newwizards/
Author: jsdelfino
Date: Mon Sep 24 21:32:06 2007
New Revision: 579061
URL: http://svn.apache.org/viewvc?rev=579061&view=rev
Log:
Added wizards to create new .composite and .componentType files.
Added:
incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/
incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizard.java (with props)
incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizardPage.java (with props)
incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewCompositeWizard.java (with props)
incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewCompositeWizardPage.java (with props)
Modified:
incubator/tuscany/java/sca/tools/plugin-core/META-INF/MANIFEST.MF
incubator/tuscany/java/sca/tools/plugin-core/plugin.xml
Modified: incubator/tuscany/java/sca/tools/plugin-core/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tools/plugin-core/META-INF/MANIFEST.MF?rev=579061&r1=579060&r2=579061&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tools/plugin-core/META-INF/MANIFEST.MF (original)
+++ incubator/tuscany/java/sca/tools/plugin-core/META-INF/MANIFEST.MF Mon Sep 24 21:32:06 2007
@@ -25,3 +25,4 @@
org.osgi.framework;version="1.4.0"
Bundle-Vendor: Apache Software Foundation
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.ui.ide
Modified: incubator/tuscany/java/sca/tools/plugin-core/plugin.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tools/plugin-core/plugin.xml?rev=579061&r1=579060&r2=579061&view=diff
==============================================================================
--- incubator/tuscany/java/sca/tools/plugin-core/plugin.xml (original)
+++ incubator/tuscany/java/sca/tools/plugin-core/plugin.xml Mon Sep 24 21:32:06 2007
@@ -100,4 +100,22 @@
</shortcut>
</extension>
+ <extension point="org.eclipse.ui.newWizards">
+ <category name="Tuscany" id="org.apache.tuscany.sca.core.newwizards" />
+ <wizard name="Composite" icon="icons/t.gif"
+ category="org.apache.tuscany.sca.core.newwizards"
+ class="org.apache.tuscany.sca.core.newwizards.NewCompositeWizard"
+ preferredPerspectives="org.eclipse.jdt.ui.JavaPerspective"
+ id="org.apache.tuscany.sca.core.newwizards.newcompositewizard">
+ <description>Create a new SCA Composite</description>
+ </wizard>
+ <wizard name="ComponentType" icon="icons/t.gif"
+ category="org.apache.tuscany.sca.core.newwizards"
+ class="org.apache.tuscany.sca.core.newwizards.NewComponentTypeWizard"
+ preferredPerspectives="org.eclipse.jdt.ui.JavaPerspective"
+ id="org.apache.tuscany.sca.core.newwizards.newcompositewizard">
+ <description>Create a new SCA ComponentType</description>
+ </wizard>
+ </extension>
+
</plugin>
Added: incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizard.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizard.java?rev=579061&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizard.java (added)
+++ incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizard.java Mon Sep 24 21:32:06 2007
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.core.newwizards;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWizard;
+
+public class NewComponentTypeWizard extends Wizard implements IWorkbenchWizard {
+
+ private IWorkbench workbench;
+ private IStructuredSelection selection;
+ private NewComponentTypeWizardPage mainPage;
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle("New SCA ComponentType");
+ }
+
+ public void addPages() {
+ mainPage = new NewComponentTypeWizardPage(workbench, selection);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean performFinish() {
+ return mainPage.finish();
+ }
+}
Propchange: incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizard.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizard.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizardPage.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizardPage.java?rev=579061&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizardPage.java (added)
+++ incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizardPage.java Mon Sep 24 21:32:06 2007
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.core.newwizards;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.PrintWriter;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.graphics.ImageLoader;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.eclipse.ui.ide.IDE;
+
+public class NewComponentTypeWizardPage extends WizardNewFileCreationPage {
+
+ private IWorkbench workbench;
+
+ public NewComponentTypeWizardPage(IWorkbench workbench, IStructuredSelection selection) {
+ super("New SCA ComponentType Page", selection);
+
+ this.workbench = workbench;
+
+ setTitle("SCA ComponentType");
+ setDescription("Create a new SCA ComponentType.");
+
+ try {
+ String location = FileLocator.toFileURL(Platform.getBundle("tuscany.eclipse").getEntry("/")).getFile().toString();
+ setImageDescriptor(ImageDescriptor.createFromImageData((new ImageLoader()).load(location + "/icons/tuscany.gif")[0]));
+ } catch (Exception e) {
+ System.err.println(e.getMessage());
+ }
+
+ setFileExtension("componentType");
+ setFileName("sample.componentType");
+
+ }
+
+ public boolean finish() {
+ try {
+ IFile file = createNewFile();
+
+ IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
+ IDE.openEditor(workbenchPage, file, true);
+ } catch (Exception e) {
+ System.err.println(e.getMessage());
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected InputStream getInitialContents() {
+
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ PrintWriter printWriter = new PrintWriter(outputStream);
+ printWriter.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+ printWriter.println("<componentType xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"");
+ printWriter.println(" xmlns:t=\"http://tuscany.apache.org/xmlns/sca/1.0\">");
+ printWriter.println();
+ printWriter.println();
+ printWriter.println();
+ printWriter.println("</componentType>");
+ printWriter.close();
+
+ return new ByteArrayInputStream(outputStream.toByteArray());
+ }
+}
Propchange: incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizardPage.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizardPage.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewCompositeWizard.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewCompositeWizard.java?rev=579061&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewCompositeWizard.java (added)
+++ incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewCompositeWizard.java Mon Sep 24 21:32:06 2007
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.core.newwizards;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWizard;
+
+public class NewCompositeWizard extends Wizard implements IWorkbenchWizard {
+
+ private IWorkbench workbench;
+ private IStructuredSelection selection;
+ private NewCompositeWizardPage mainPage;
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle("New SCA Composite");
+ }
+
+ public void addPages() {
+ mainPage = new NewCompositeWizardPage(workbench, selection);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean performFinish() {
+ return mainPage.finish();
+ }
+}
Propchange: incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewCompositeWizard.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewCompositeWizard.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewCompositeWizardPage.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewCompositeWizardPage.java?rev=579061&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewCompositeWizardPage.java (added)
+++ incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewCompositeWizardPage.java Mon Sep 24 21:32:06 2007
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.core.newwizards;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.PrintWriter;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.graphics.ImageLoader;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.eclipse.ui.ide.IDE;
+
+public class NewCompositeWizardPage extends WizardNewFileCreationPage {
+
+ private IWorkbench workbench;
+
+ public NewCompositeWizardPage(IWorkbench workbench, IStructuredSelection selection) {
+ super("New SCA Composite Page", selection);
+
+ this.workbench = workbench;
+
+ setTitle("SCA Composite");
+ setDescription("Create a new SCA Composite.");
+
+ try {
+ String location = FileLocator.toFileURL(Platform.getBundle("tuscany.eclipse").getEntry("/")).getFile().toString();
+ setImageDescriptor(ImageDescriptor.createFromImageData((new ImageLoader()).load(location + "/icons/tuscany.gif")[0]));
+ } catch (Exception e) {
+ System.err.println(e.getMessage());
+ }
+
+ setFileExtension("composite");
+ setFileName("sample.composite");
+
+ }
+
+ public boolean finish() {
+ try {
+ IFile file = createNewFile();
+
+ IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
+ IDE.openEditor(workbenchPage, file, true);
+ } catch (Exception e) {
+ System.err.println(e.getMessage());
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected InputStream getInitialContents() {
+
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ PrintWriter printWriter = new PrintWriter(outputStream);
+ printWriter.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+ printWriter.println("<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"");
+ printWriter.println(" xmlns:t=\"http://tuscany.apache.org/xmlns/sca/1.0\"");
+ printWriter.println(" xmlns:c=\"http://" + getFileName() + "\"");
+ printWriter.println(" name=\"" + getFileName() + "\">");
+ printWriter.println();
+ printWriter.println();
+ printWriter.println();
+ printWriter.println("</composite>");
+ printWriter.close();
+
+ return new ByteArrayInputStream(outputStream.toByteArray());
+ }
+}
Propchange: incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewCompositeWizardPage.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/tools/plugin-core/src/main/java/org/apache/tuscany/sca/core/newwizards/NewCompositeWizardPage.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org