Author: dennyxu
Date: 2008-07-31 23:07:32 -0400 (Thu, 31 Jul 2008)
New Revision: 9461
Added:
workspace/Denny/org.jboss.tools.esb/.classpath
workspace/Denny/org.jboss.tools.esb/.project
workspace/Denny/org.jboss.tools.esb/META-INF/
workspace/Denny/org.jboss.tools.esb/META-INF/MANIFEST.MF
workspace/Denny/org.jboss.tools.esb/bin/
workspace/Denny/org.jboss.tools.esb/build.properties
workspace/Denny/org.jboss.tools.esb/icons/
workspace/Denny/org.jboss.tools.esb/plugin.xml
workspace/Denny/org.jboss.tools.esb/schema/
workspace/Denny/org.jboss.tools.esb/schema/org.jboss.tools.esb.project.template.exsd
workspace/Denny/org.jboss.tools.esb/src/
workspace/Denny/org.jboss.tools.esb/src/org/
workspace/Denny/org.jboss.tools.esb/src/org/jboss/
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/Activator.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/IJBossESBFacetDataModelProperties.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/JBossESBFacetInstallationConfig.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/JBossESBFacetInstallationDelegate.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/nature/
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/nature/JBossESBProjectNature.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/AbstractESBProjectCreationWizard.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/ESBProjectCreationWizard.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/JBossESBFacetProjectCreationDataModelProvider.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/ESBFacetInstallationPage.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/ESBProjectTemplateWizardPage.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/NewESBProjectWizardPage.java
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/TemplagePackageNameWizardPage.java
Log:
prototype of esb project(GUI)
Added: workspace/Denny/org.jboss.tools.esb/.classpath
===================================================================
--- workspace/Denny/org.jboss.tools.esb/.classpath (rev 0)
+++ workspace/Denny/org.jboss.tools.esb/.classpath 2008-08-01 03:07:32 UTC (rev 9461)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: workspace/Denny/org.jboss.tools.esb/.project
===================================================================
--- workspace/Denny/org.jboss.tools.esb/.project (rev 0)
+++ workspace/Denny/org.jboss.tools.esb/.project 2008-08-01 03:07:32 UTC (rev 9461)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.esb</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: workspace/Denny/org.jboss.tools.esb/META-INF/MANIFEST.MF
===================================================================
--- workspace/Denny/org.jboss.tools.esb/META-INF/MANIFEST.MF (rev
0)
+++ workspace/Denny/org.jboss.tools.esb/META-INF/MANIFEST.MF 2008-08-01 03:07:32 UTC (rev
9461)
@@ -0,0 +1,33 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Esbproject Plug-in
+Bundle-SymbolicName: org.jboss.tools.esb;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.tools.esb.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.pde.ui,
+ org.eclipse.pde.ui.templates,
+ org.eclipse.wst.common.project.facet.core,
+ org.eclipse.core.resources,
+ org.eclipse.ui.ide,
+ org.eclipse.wst.web.ui,
+ org.eclipse.wst.common.frameworks,
+ org.eclipse.wst.common.frameworks.ui,
+ org.eclipse.wst.common.core,
+ org.eclipse.wst.common.project.facet.ui,
+ org.eclipse.wst.server.ui,
+ org.eclipse.wst.web,
+ org.eclipse.wst.common.modulecore,
+ org.eclipse.wst.server.core,
+ org.eclipse.jst.server.core,
+ org.eclipse.jst.servlet.ui;bundle-version="1.1.200",
+ org.eclipse.jst.common.frameworks;bundle-version="1.1.200",
+ org.eclipse.jst.common.project.facet.core;bundle-version="1.3.0",
+ org.jboss.tools.esb.editor;bundle-version="1.0.0",
+ org.eclipse.jst.j2ee;bundle-version="1.1.200",
+ org.eclipse.jst.j2ee.web;bundle-version="1.1.200",
+ org.eclipse.jst.j2ee.core;bundle-version="1.1.200",
+ org.eclipse.jst.j2ee.ui;bundle-version="1.1.200"
+Eclipse-LazyStart: true
+Export-Package: org.jboss.tools.esb.projects.wizards.pages
Added: workspace/Denny/org.jboss.tools.esb/build.properties
===================================================================
--- workspace/Denny/org.jboss.tools.esb/build.properties (rev 0)
+++ workspace/Denny/org.jboss.tools.esb/build.properties 2008-08-01 03:07:32 UTC (rev
9461)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
Added: workspace/Denny/org.jboss.tools.esb/plugin.xml
===================================================================
--- workspace/Denny/org.jboss.tools.esb/plugin.xml (rev 0)
+++ workspace/Denny/org.jboss.tools.esb/plugin.xml 2008-08-01 03:07:32 UTC (rev 9461)
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="org.jboss.tools.esb.project.template" name="ESB
Template" schema="schema/org.jboss.tools.esb.project.template.exsd"/>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ category="org.jboss.tools.esb.category1"
+
class="org.jboss.tools.esb.projects.wizards.ESBProjectCreationWizard"
+ id="JBoss.ESB.Project.Wizard"
+ name="ESB Project Wizard"
+ project="true">
+ </wizard>
+ <category
+ id="org.jboss.tools.esb.category1"
+ name="ESB Wizard">
+ </category>
+ </extension>
+ <extension
+ point="org.eclipse.wst.common.project.facet.core.facets">
+ <project-facet
+ id="jboss.esb">
+ <label>
+ JBoss ESB
+ </label>
+ </project-facet>
+ <project-facet-version
+ facet="jboss.esb"
+ version="4.2">
+ <action
+ facet="jboss.esb"
+ type="install"
+ version="4.2">
+ <delegate
+
class="org.jboss.tools.esb.JBossESBFacetInstallationDelegate">
+ </delegate>
+ <config-factory
+
class="org.jboss.tools.esb.JBossESBFacetInstallationConfig">
+ </config-factory>
+ </action>
+ </project-facet-version>
+ <project-facet-version
+ facet="jboss.esb"
+ version="4.3">
+ <action
+ facet="jboss.esb"
+ id="jboss.esb.install"
+ type="install"
+ version="4.3">
+ <delegate
+
class="org.jboss.tools.esb.JBossESBFacetInstallationDelegate">
+ </delegate>
+ <config-factory
+
class="org.jboss.tools.esb.JBossESBFacetInstallationConfig">
+ </config-factory>
+ </action>
+ </project-facet-version>
+ <template
+ id="template.jboss.esb">
+ <label>
+ label body text
+ </label>
+ <fixed
+ facet="jboss.esb">
+ </fixed>
+ <fixed
+ facet="jst.java">
+ </fixed>
+ </template>
+ </extension>
+ <extension
+ id="esbnature"
+ name="JBoss ESB Nature"
+ point="org.eclipse.core.resources.natures">
+ <runtime>
+ <run
+
class="org.jboss.tools.esb.projects.nature.JBossESBProjectNature">
+ </run>
+ </runtime>
+ <requires-nature
+ id="org.eclipse.wst.common.project.facet.core.nature">
+ </requires-nature>
+ </extension>
+ <extension
+ point="org.eclipse.ui.ide.projectNatureImages">
+ <image
+ icon="esbproject.image3"
+ id="org.jboss.esb.project.esbnature.image"
+ natureId="org.jboss.esb.project.esbnature">
+ </image>
+ </extension>
+ <extension
+ point="org.eclipse.wst.server.core.moduleTypes">
+ <moduleType
+ id="jboss.esb"
+ name="JBoss ESB Module">
+ </moduleType>
+ </extension>
+ <extension
+ point="org.eclipse.wst.common.project.facet.ui.wizardPages">
+ <wizard-pages
+ action="jboss.esb.install">
+ <page
+
class="org.jboss.tools.esb.projects.wizards.pages.ESBFacetInstallationPage">
+ </page>
+ </wizard-pages>
+ </extension>
+
+</plugin>
Added:
workspace/Denny/org.jboss.tools.esb/schema/org.jboss.tools.esb.project.template.exsd
===================================================================
--- workspace/Denny/org.jboss.tools.esb/schema/org.jboss.tools.esb.project.template.exsd
(rev 0)
+++
workspace/Denny/org.jboss.tools.esb/schema/org.jboss.tools.esb.project.template.exsd 2008-08-01
03:07:32 UTC (rev 9461)
@@ -0,0 +1,120 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.esb"
xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.jboss.tools.esb"
id="org.jboss.tools.esb.project.template" name="ESB Template"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <attribute name="point" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="template">
+ <complexType>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="ESBversion" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Added: workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/Activator.java
===================================================================
--- workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/Activator.java
(rev 0)
+++ workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/Activator.java 2008-08-01
03:07:32 UTC (rev 9461)
@@ -0,0 +1,50 @@
+package org.jboss.tools.esb;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "esbproject";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Added:
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/IJBossESBFacetDataModelProperties.java
===================================================================
---
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/IJBossESBFacetDataModelProperties.java
(rev 0)
+++
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/IJBossESBFacetDataModelProperties.java 2008-08-01
03:07:32 UTC (rev 9461)
@@ -0,0 +1,7 @@
+package org.jboss.tools.esb;
+
+import org.eclipse.wst.common.project.facet.core.IActionConfigFactory;
+
+public interface IJBossESBFacetDataModelProperties extends IActionConfigFactory {
+
+}
Added:
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/JBossESBFacetInstallationConfig.java
===================================================================
---
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/JBossESBFacetInstallationConfig.java
(rev 0)
+++
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/JBossESBFacetInstallationConfig.java 2008-08-01
03:07:32 UTC (rev 9461)
@@ -0,0 +1,25 @@
+package org.jboss.tools.esb;
+
+import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
+import
org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+
+public class JBossESBFacetInstallationConfig extends
+ FacetInstallDataModelProvider implements
+ IJBossESBFacetDataModelProperties {
+
+ public Object create() {
+ // TODO Auto-generated method stub
+ return DataModelFactory.createDataModel(this);
+
+ }
+
+ public Object getDefaultProperty(String propertyName) {
+ if (IFacetDataModelProperties.FACET_ID.equals(propertyName)) {
+
+ return "jboss.esb";
+ }
+ return super.getDefaultProperty(propertyName);
+ }
+
+}
Added:
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/JBossESBFacetInstallationDelegate.java
===================================================================
---
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/JBossESBFacetInstallationDelegate.java
(rev 0)
+++
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/JBossESBFacetInstallationDelegate.java 2008-08-01
03:07:32 UTC (rev 9461)
@@ -0,0 +1,61 @@
+package org.jboss.tools.esb;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.StringBufferInputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import
org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+public class JBossESBFacetInstallationDelegate implements IDelegate {
+
+ private IDataModel model;
+ public void execute(IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException {
+ System.out.print(config);
+ IFile esbFile = null;
+ model = (IDataModel)config;
+ IFolder esbContent = project.getFolder("ESBContent");
+ if(!esbContent.exists()) {
+ esbContent.create(true, true, null);
+ }
+
+ esbContent.getFolder("lib").create(true, true, null);
+ esbContent.getFolder("META-INF").create(true, true, null);
+ esbFile = createJBossESBXML(esbContent.getFolder("META-INF"));
+
+ project.refreshLocal(IResource.DEPTH_ZERO, null);
+
+
+ //String prjName =
model.getStringProperty(IFacetDataModelProperties.FACET_PROJECT_NAME);
+ //IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(prjName);
+
+
+ }
+
+ private IFile createJBossESBXML(IFolder folder) throws CoreException{
+ StringBuffer emptyESB = new StringBuffer();
+ emptyESB.append("<?xml version = \"1.0\" encoding =
\"UTF-8\"?>");
+ emptyESB.append("\n");
+ emptyESB.append("<jbossesb
xmlns=\"http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/et...
parameterReloadSecs=\"5\">");
+ emptyESB.append("\n");
+ emptyESB.append("</jbossesb>");
+ IFile esbfile = folder.getFile("jboss-esb.xml");
+ esbfile.create(new ByteArrayInputStream(emptyESB.toString().getBytes()), true, null);
+
+ return esbfile;
+ }
+
+}
Added:
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/nature/JBossESBProjectNature.java
===================================================================
---
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/nature/JBossESBProjectNature.java
(rev 0)
+++
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/nature/JBossESBProjectNature.java 2008-08-01
03:07:32 UTC (rev 9461)
@@ -0,0 +1,29 @@
+package org.jboss.tools.esb.projects.nature;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.runtime.CoreException;
+
+public class JBossESBProjectNature implements IProjectNature {
+
+ public void configure() throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void deconfigure() throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public IProject getProject() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setProject(IProject project) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added:
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/AbstractESBProjectCreationWizard.java
===================================================================
---
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/AbstractESBProjectCreationWizard.java
(rev 0)
+++
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/AbstractESBProjectCreationWizard.java 2008-08-01
03:07:32 UTC (rev 9461)
@@ -0,0 +1,465 @@
+package org.jboss.tools.esb.projects.wizards;
+
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
+import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
+import
org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import
org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+import
org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
+import org.eclipse.wst.common.project.facet.core.IPreset;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent;
+import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+import org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard;
+import org.eclipse.wst.web.internal.DelegateConfigurationElement;
+import org.eclipse.wst.web.ui.internal.Logger;
+import org.eclipse.wst.web.ui.internal.WSTWebUIPlugin;
+
+public abstract class AbstractESBProjectCreationWizard extends ModifyFacetedProjectWizard
implements INewWizard, IFacetProjectCreationDataModelProperties {
+
+ protected IDataModel model = null;
+ private final IFacetedProjectTemplate template;
+ private IWizardPage[] beginingPages;
+ private IConfigurationElement configurationElement;
+
+ public AbstractESBProjectCreationWizard(IDataModel model)
+ {
+ this.model = ( model == null ? createDataModel() : model );
+ this.template = getTemplate();
+
+ setFacetedProjectWorkingCopy((IFacetedProjectWorkingCopy)this.model.getProperty(FACETED_PROJECT_WORKING_COPY));
+ getFacetedProjectWorkingCopy().setFixedProjectFacets(
this.template.getFixedProjectFacets() );
+ setDefaultPageImageDescriptor(getDefaultPageImageDescriptor());
+ setShowFacetsSelectionPage( false );
+ }
+
+ public AbstractESBProjectCreationWizard()
+ {
+ this( null );
+ }
+
+ public IDataModel getDataModel() {
+ return model;
+ }
+
+ protected abstract IDataModel createDataModel();
+
+ protected abstract ImageDescriptor getDefaultPageImageDescriptor();
+
+ protected abstract IFacetedProjectTemplate getTemplate();
+
+ /**
+ * Returns the first page that shows up before the facets page. If multiple pages are
required,
+ * also override {@link #createBeginingPages()}.
+ *
+ * @return
+ */
+ protected abstract IWizardPage createFirstPage();
+
+ /**
+ * Subclasses should override to add more than one page before the facets page. If only
one page
+ * is required, then use {@link #createFirstPage()}. The default implementation will
return the
+ * result of {@link #createFirstPage()}.
+ *
+ * @return
+ */
+ protected IWizardPage[] createBeginingPages() {
+ return new IWizardPage[]{createFirstPage()};
+ }
+
+ public void addPages() {
+ beginingPages = createBeginingPages();
+ for (int i = 0; i < beginingPages.length; i++) {
+ addPage(beginingPages[i]);
+ }
+
+ super.addPages();
+
+ getFacetedProjectWorkingCopy().addListener
+ (
+ new IFacetedProjectListener()
+ {
+ public void handleEvent( final IFacetedProjectEvent event )
+ {
+ facetSelectionChangedEvent();
+ }
+ },
+ IFacetedProjectEvent.Type.PROJECT_FACETS_CHANGED
+ );
+ }
+
+ public void createPageControls(Composite container) {
+ super.createPageControls(container);
+
+ final IPreset preset = this.template.getInitialPreset();
+ final IRuntime runtime = (IRuntime) model.getProperty( FACET_RUNTIME );
+
+ if( preset == null )
+ {
+ // If no preset is specified, select the runtime and it's default
+ // facets.
+
+ setRuntimeAndDefaultFacets( runtime );
+ }
+ else
+ {
+ // If preset is specified, select the runtime only if supports all
+ // of the facets included in the preset.
+
+ getFacetedProjectWorkingCopy().setSelectedPreset( preset.getId() );
+
+ boolean supports = false;
+
+ if( runtime != null )
+ {
+ supports = true;
+
+ for( Iterator itr = preset.getProjectFacets().iterator(); itr.hasNext();
)
+ {
+ final IProjectFacetVersion fv = (IProjectFacetVersion) itr.next();
+
+ if( ! runtime.supports( fv ) )
+ {
+ supports = false;
+ break;
+ }
+ }
+ }
+
+ if( supports )
+ {
+ getFacetedProjectWorkingCopy().setTargetedRuntimes(
Collections.singleton( runtime ) );
+ }
+ else
+ {
+ model.setProperty( FACET_RUNTIME, null );
+ }
+ }
+
+ synchRuntimes();
+ }
+
+ public IWizardPage[] getPages() {
+ final IWizardPage[] base = super.getPages();
+ final IWizardPage[] pages = new IWizardPage[base.length + beginingPages.length];
+
+ for (int i = 0; i < beginingPages.length; i++) {
+ pages[i] = beginingPages[i];
+ }
+
+ System.arraycopy(base, 0, pages, beginingPages.length, base.length);
+
+ return pages;
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ }
+
+ protected void synchRuntimes()
+ {
+ final Boolean[] suppressBackEvents = { Boolean.FALSE };
+
+ model.addListener(new IDataModelListener() {
+ public void propertyChanged(DataModelEvent event) {
+ if (IDataModel.VALUE_CHG == event.getFlag() || IDataModel.DEFAULT_CHG ==
event.getFlag()) {
+ if (FACET_RUNTIME.equals(event.getPropertyName())) {
+ if( ! suppressBackEvents[ 0 ].booleanValue() ) {
+ IRuntime runtime = (IRuntime) event.getProperty();
+ setRuntimeAndDefaultFacets( runtime );
+ }
+ }
+ }
+ }
+ });
+
+ getFacetedProjectWorkingCopy().addListener
+ (
+ new IFacetedProjectListener()
+ {
+ public void handleEvent( final IFacetedProjectEvent event )
+ {
+ suppressBackEvents[ 0 ] = Boolean.TRUE;
+ model.setProperty(FACET_RUNTIME,
getFacetedProjectWorkingCopy().getPrimaryRuntime());
+ suppressBackEvents[ 0 ] = Boolean.FALSE;
+ }
+ },
+ IFacetedProjectEvent.Type.PRIMARY_RUNTIME_CHANGED
+ );
+ }
+
+ protected void setRuntimeAndDefaultFacets( final IRuntime runtime )
+ {
+ final IFacetedProjectWorkingCopy dm = getFacetedProjectWorkingCopy();
+
+ dm.setTargetedRuntimes( Collections.<IRuntime>emptySet() );
+
+ if( runtime != null )
+ {
+ final Set<IProjectFacetVersion> minFacets = new
HashSet<IProjectFacetVersion>();
+
+ try
+ {
+ for( IProjectFacet f : dm.getFixedProjectFacets() )
+ {
+ minFacets.add( f.getLatestSupportedVersion( runtime ) );
+ }
+ }
+ catch( CoreException e )
+ {
+ throw new RuntimeException( e );
+ }
+
+ dm.setProjectFacets( minFacets );
+
+ dm.setTargetedRuntimes( Collections.singleton( runtime ) );
+ }
+
+ dm.setSelectedPreset( FacetedProjectFramework.DEFAULT_CONFIGURATION_PRESET_ID );
+ }
+
+ public String getProjectName() {
+ return
model.getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
+ }
+
+ protected void performFinish(final IProgressMonitor monitor)
+
+ throws CoreException
+
+ {
+ monitor.beginTask("", 10); //$NON-NLS-1$
+ storeDefaultSettings();
+ try {
+ super.performFinish(new SubProgressMonitor(monitor, 8));
+
+ try {
+ getFacetProjectNotificationOperation().execute(new NullProgressMonitor(),
null);
+ } catch (ExecutionException e) {
+ String msg = e.getMessage();
+ if( msg == null ) msg = ""; //$NON-NLS-1$
+ final IStatus st = new Status( IStatus.ERROR, WSTWebUIPlugin.PLUGIN_ID,
0, msg, e );
+ throw new CoreException( st );
+ }
+ } finally {
+ monitor.done();
+ }
+ }
+
+ public boolean performFinish() {
+ if (super.performFinish() == false) {
+ return false;
+ }
+
+ try {
+ postPerformFinish();
+ } catch (InvocationTargetException e) {
+ Logger.logException(e);
+ }
+
+ return true;
+ }
+
+ /**
+ * <p>
+ * Override to return the final perspective ID (if any). The final perspective ID can
be
+ * hardcoded by the subclass or determined programmatically (possibly using the value of
a field
+ * on the Wizard's WTP Operation Data Model).
+ * </p>
+ * <p>
+ * The default implementation returns no perspective id unless overriden by product
definition
+ * via the "wtp.project.final.perspective" property.
+ * </p>
+ *
+ * @return Returns the ID of the Perspective which is preferred by this wizard upon
completion.
+ */
+
+ protected String getFinalPerspectiveID() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>
+ * The configuration element is saved to use when the wizard completes in order to
change the
+ * current perspective using either (1) the value specified by {@link
#getFinalPerspectiveID()}
+ * or (2) the value specified by the finalPerspective attribute in the Wizard's
configuration
+ * element.
+ * </p>
+ *
+ * @see
org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement,
+ * java.lang.String, java.lang.Object)
+ */
+ public final void setInitializationData(IConfigurationElement aConfigurationElement,
String aPropertyName, Object theData) throws CoreException {
+ configurationElement = aConfigurationElement;
+ doSetInitializeData(aConfigurationElement, aPropertyName, theData);
+
+ }
+
+ /**
+ * <p>
+ * Override method for clients that wish to take advantage of the information provided
by
+ * {@see #setInitializationData(IConfigurationElement, String, Object)}.
+ * </p>
+ *
+ * @param aConfigurationElement
+ * The configuration element provided from the templated method.
+ * @param aPropertyName
+ * The property name provided from the templated method.
+ * @param theData
+ * The data provided from the templated method.
+ */
+ protected void doSetInitializeData(IConfigurationElement aConfigurationElement, String
aPropertyName, Object theData) {
+ // Default do nothing
+ }
+
+ /**
+ * <p>
+ * Returns the an id component used for Activity filtering.
+ * </p>
+ *
+ * <p>
+ * The Plugin ID is determined from the configuration element specified in
+ * {@see #setInitializationData(IConfigurationElement, String, Object)}.
+ * </p>
+ *
+ * @return Returns the plugin id associated with this wizard
+ */
+ public final String getPluginId() {
+ return (configurationElement != null) ?
configurationElement.getDeclaringExtension().getNamespace() : ""; //$NON-NLS-1$
+ }
+
+ /**
+ *
+ * <p>
+ * Invoked after the user has clicked the "Finish" button of the wizard. The
default
+ * implementation will attempt to update the final perspective to the value specified
by
+ * {@link #getFinalPerspectiveID() }
+ * </p>
+ *
+ * @throws InvocationTargetException
+ *
+ * @see
org.eclipse.wst.common.frameworks.internal.ui.wizard.WTPWizard#postPerformFinish()
+ */
+ protected void postPerformFinish() throws InvocationTargetException {
+ if (getFinalPerspectiveID() != null && getFinalPerspectiveID().length() > 0)
{
+ final IConfigurationElement element = new
DelegateConfigurationElement(configurationElement) {
+ public String getAttribute(String aName) {
+ if (aName.equals("finalPerspective")) { //$NON-NLS-1$
+ return getFinalPerspectiveID();
+ }
+ return super.getAttribute(aName);
+ }
+ };
+ BasicNewProjectResourceWizard.updatePerspective(element);
+ } else
+ BasicNewProjectResourceWizard.updatePerspective(configurationElement);
+
+ String projName = getProjectName();
+ BasicNewResourceWizard.selectAndReveal(ResourcesPlugin.getWorkspace().getRoot().getProject(projName),
WSTWebUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow());
+ }
+
+ protected IDataModelOperation getFacetProjectNotificationOperation() {
+ return new DataModelPausibleOperationImpl(new AbstractDataModelOperation(this.model) {
+ public String getID() {
+ return AbstractESBProjectCreationWizard.class.getName();
+ }
+
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws
ExecutionException {
+ return AbstractDataModelProvider.OK_STATUS;
+ }
+ });
+ }
+
+ /**
+ * Need to keep the model in sync with the UI. This method will pickup changes coming
from the
+ * UI and push them into the model
+ */
+ protected void facetSelectionChangedEvent() {
+ Set actions = getFacetedProjectWorkingCopy().getProjectFacetActions();
+ Iterator iterator = actions.iterator();
+ Set activeIds = new HashSet();
+ while (iterator.hasNext()) {
+ IFacetedProject.Action action = (IFacetedProject.Action) iterator.next();
+ String id = action.getProjectFacetVersion().getProjectFacet().getId();
+ activeIds.add(id);
+ }
+ // First handle all the actions tracked by IDataModels
+ FacetDataModelMap dataModelMap = (FacetDataModelMap) model.getProperty(FACET_DM_MAP);
+ iterator = dataModelMap.keySet().iterator();
+ while (iterator.hasNext()) {
+ String id = (String) iterator.next();
+ IDataModel configDM = (IDataModel) dataModelMap.get(id);
+ boolean active = activeIds.contains(id);
+ configDM.setBooleanProperty(IFacetDataModelProperties.SHOULD_EXECUTE, active);
+ activeIds.remove(id);
+ }
+ // Now handle the actions not tracked by IDataModels
+ FacetActionMap actionMap = (FacetActionMap) model.getProperty(FACET_ACTION_MAP);
+ actionMap.clear();
+ iterator = actions.iterator();
+ while (iterator.hasNext()) {
+ IFacetedProject.Action action = (IFacetedProject.Action) iterator.next();
+ String id = action.getProjectFacetVersion().getProjectFacet().getId();
+ if (activeIds.contains(id)) {
+ actionMap.add(action);
+ }
+ }
+ model.notifyPropertyChange(FACET_RUNTIME, IDataModel.VALID_VALUES_CHG);
+ }
+
+ protected void storeDefaultSettings() {
+ IWizardPage[] pages = getPages();
+ for (int i = 0; i < pages.length; i++)
+ storeDefaultSettings(pages[i], i);
+ }
+
+ /**
+ * Subclasses may override if they need to do something special when storing the
default
+ * settings for a particular page.
+ *
+ * @param page
+ * @param pageIndex
+ */
+ protected void storeDefaultSettings(IWizardPage page, int pageIndex) {
+ if (page instanceof DataModelWizardPage)
+ ((DataModelWizardPage) page).storeDefaultSettings();
+ }
+
+
+
+}
Added:
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/ESBProjectCreationWizard.java
===================================================================
---
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/ESBProjectCreationWizard.java
(rev 0)
+++
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/ESBProjectCreationWizard.java 2008-08-01
03:07:32 UTC (rev 9461)
@@ -0,0 +1,85 @@
+package org.jboss.tools.esb.projects.wizards;
+
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.project.facet.IProductConstants;
+import org.eclipse.wst.project.facet.ProductManager;
+import org.eclipse.wst.project.facet.SimpleWebFacetProjectCreationDataModelProvider;
+import org.eclipse.wst.web.ui.internal.WSTWebUIPlugin;
+import org.jboss.tools.esb.projects.wizards.pages.ESBProjectTemplateWizardPage;
+import org.jboss.tools.esb.projects.wizards.pages.NewESBProjectWizardPage;
+import org.jboss.tools.esb.projects.wizards.pages.TemplagePackageNameWizardPage;
+
+public class ESBProjectCreationWizard extends AbstractESBProjectCreationWizard{
+
+ protected IDataModel createDataModel() {
+ return DataModelFactory.createDataModel(new
JBossESBFacetProjectCreationDataModelProvider());
+ }
+
+ protected ImageDescriptor getDefaultPageImageDescriptor() {
+ return WSTWebUIPlugin.getDefault().getImageDescriptor("newwprj_wiz");
//$NON-NLS-1$
+ }
+
+ protected IFacetedProjectTemplate getTemplate() {
+ return ProjectFacetsManager.getTemplate("template.jboss.esb"); //$NON-NLS-1$
+ }
+
+ protected IWizardPage createFirstPage() {
+ return new NewESBProjectWizardPage(model, "first.page"); //$NON-NLS-1$
+ }
+
+ protected String getFinalPerspectiveID() {
+ return
ProductManager.getProperty(IProductConstants.FINAL_PERSPECTIVE_STATICWEB);
+ }
+
+ protected IWizardPage[] createBeginingPages() {
+ return new IWizardPage[]{createFirstPage(), new
ESBProjectTemplateWizardPage(this.model, "Templates"),
+ new TemplagePackageNameWizardPage(this.model, "Set Package Name")};
+ }
+
+
+ @Override
+ public void addPages() {
+ new NewESBProjectWizardPage(model, "first.page"); //$NON-NLS-1$
+
+ super.addPages();
+ }
+
+ @Override
+ public boolean performFinish() {
+
+ boolean rtn = super.performFinish();
+ IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject(this.getProjectName());
+ IFile esbFile = project.getFile("/ESBContent/META-INF/jboss-esb.xml");
+
+ IWorkbenchPage page =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ if(esbFile != null){
+ try {
+ IDE.openEditor(page, esbFile,
"org.jboss.tools.esb.editor.editors.ESBComposedEditor", true);
+ } catch (PartInitException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ return rtn;
+ }
+
+
+
+}
+
+
+
Added:
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/JBossESBFacetProjectCreationDataModelProvider.java
===================================================================
---
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/JBossESBFacetProjectCreationDataModelProvider.java
(rev 0)
+++
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/JBossESBFacetProjectCreationDataModelProvider.java 2008-08-01
03:07:32 UTC (rev 9461)
@@ -0,0 +1,43 @@
+package org.jboss.tools.esb.projects.wizards;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
+import org.eclipse.jst.common.project.facet.JavaFacetUtils;
+import
org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider;
+import
org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.project.facet.ProductManager;
+
+public class JBossESBFacetProjectCreationDataModelProvider extends
+ FacetProjectCreationDataModelProvider {
+
+
+ public void init() {
+ super.init();
+
+ Collection<IProjectFacet> requiredFacets = new
ArrayList<IProjectFacet>();
+ requiredFacets.add(JavaFacetUtils.JAVA_FACET);
+ requiredFacets.add(ProjectFacetsManager.getProjectFacet("jboss.esb"));
+ setProperty(REQUIRED_FACETS_COLLECTION, requiredFacets);
+
+ FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP);
+ IDataModel javaFacet = map.getFacetDataModel( JavaFacetUtils.JAVA_FACET.getId()
);
+ javaFacet.setProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME,
"src");
+ // If using optimized single root structure, set the output folder to "<content
folder>/WEB-INF/classes"
+ /*if (ProductManager.shouldUseSingleRootStructure())
+ javaFacet.setProperty(IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME,
webRoot+"/"+J2EEConstants.WEB_INF_CLASSES); //$NON-NLS-1$
+*/
+ }
+
+ public Object getDefaultProperty(String propertyName) {
+ if (IFacetDataModelProperties.FACET_ID.equals(propertyName)) {
+
+ return "jboss.esb";
+ }
+ return super.getDefaultProperty(propertyName);
+ }
+}
Added:
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/ESBFacetInstallationPage.java
===================================================================
---
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/ESBFacetInstallationPage.java
(rev 0)
+++
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/ESBFacetInstallationPage.java 2008-08-01
03:07:32 UTC (rev 9461)
@@ -0,0 +1,144 @@
+package org.jboss.tools.esb.projects.wizards.pages;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import
org.eclipse.wst.common.componentcore.datamodel.properties.IFacetInstallDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
+import org.eclipse.wst.common.project.facet.ui.AbstractFacetWizardPage;
+import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage;
+import org.eclipse.wst.common.project.facet.ui.IWizardContext;
+import org.eclipse.wst.web.internal.ResourceHandler;
+import org.eclipse.wst.web.ui.internal.wizards.DataModelFacetInstallPage;
+import org.eclipse.wst.web.ui.internal.wizards.IWstWebUIContextIds;
+import org.jboss.tools.esb.IJBossESBFacetDataModelProperties;
+
+public class ESBFacetInstallationPage extends AbstractFacetWizardPage implements
IFacetWizardPage, IJBossESBFacetDataModelProperties {
+
+ private Label configFolderLabel;
+ private Text configFolder;
+ private Label contextRootLabel;
+ private Text contextRoot;
+ private IDataModel model;
+
+ public ESBFacetInstallationPage() {
+ super( "simpleweb.facet.install.page"); //$NON-NLS-1$
+ setTitle("Install ESB Facet");
+ setDescription("Configure project structure");
+ }
+
+
+ protected Composite createTopLevelComposite(Composite parent) {
+ //setInfopopID(IWstWebUIContextIds.NEW_STATIC_WEB_PROJECT_PAGE3);
+ final Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+
+ createProjectGroup(composite);
+ createRuntimeGroup(composite);
+
+
+ //synchHelper.synchText(configFolder, CONTENT_DIR, null);
+ Dialog.applyDialogFont(parent);
+
+ return composite;
+ }
+
+ private void createProjectGroup(Composite parent){
+
+ Group prjGroup = new Group(parent, SWT.BORDER);
+ prjGroup.setText("Project Folders");
+ prjGroup.setLayout(new GridLayout(1, false));
+ prjGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+
+ this.contextRootLabel = new Label(prjGroup, SWT.NONE);
+ this.contextRootLabel.setText("Content Directory");
+ this.contextRootLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ this.contextRoot = new Text(prjGroup, SWT.BORDER);
+ this.contextRoot.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ this.contextRoot.setData("label", this.contextRootLabel); //$NON-NLS-1$
+ this.contextRoot.setText("ESBContent");
+ //synchHelper.synchText(contextRoot, CONTEXT_ROOT, new Control[]{contextRootLabel});
+
+ configFolderLabel = new Label(prjGroup, SWT.NONE);
+ configFolderLabel.setText("Java Source Sirectory");
+ configFolderLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ configFolder = new Text(prjGroup, SWT.BORDER);
+ configFolder.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ configFolder.setData("label", configFolderLabel); //$NON-NLS-1$
+ configFolder.setText("src");
+ }
+
+ private void createRuntimeGroup(Composite parent){
+
+ Group runtimeGroup = new Group(parent, SWT.BORDER);
+ runtimeGroup.setText("ESB Runtime");
+ runtimeGroup.setLayout(new GridLayout(4, false));
+ runtimeGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Button btnServerSupplied = new Button(runtimeGroup, SWT.RADIO);
+
+ GridData gd = new GridData();
+
+ gd.horizontalSpan = 1;
+ btnServerSupplied.setLayoutData(gd);
+
+ Label lblServerSupplied = new Label(runtimeGroup, SWT.NONE);
+
+ lblServerSupplied.setText("Server supplied ESB Runtime");
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 3;
+ lblServerSupplied.setLayoutData(gd);
+
+ Button btnUserSupplied = new Button(runtimeGroup, SWT.RADIO);
+
+
+ Combo cmbRuntimes = new Combo(runtimeGroup, SWT.READ_ONLY);
+ cmbRuntimes.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+
+
+ Button btnNew = new Button(runtimeGroup, SWT.NONE);
+ btnNew.setText("New");
+
+
+
+ }
+
+ private void fillMessageGroup(Composite parent){
+ Group messageGroup = new Group(parent, SWT.BORDER);
+ messageGroup.setText("Target Message Product");
+ messageGroup.setLayout(new GridLayout(1, false));
+ messageGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ }
+
+ public void setConfig(Object config) {
+ this.model = (IDataModel)config;
+ }
+
+
+ public void createControl(Composite parent) {
+
+ setControl(createTopLevelComposite(parent));
+ }
+
+
+ public Object create() throws CoreException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+}
\ No newline at end of file
Added:
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/ESBProjectTemplateWizardPage.java
===================================================================
---
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/ESBProjectTemplateWizardPage.java
(rev 0)
+++
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/ESBProjectTemplateWizardPage.java 2008-08-01
03:07:32 UTC (rev 9461)
@@ -0,0 +1,56 @@
+package org.jboss.tools.esb.projects.wizards.pages;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Text;
+import
org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
+
+public class ESBProjectTemplateWizardPage extends DataModelWizardPage implements
IFacetProjectCreationDataModelProperties {
+
+ public ESBProjectTemplateWizardPage(IDataModel model, String pageName) {
+ super(model, pageName);
+ }
+
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ Composite top = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ top.setLayout(layout);
+
+ Button btnUseTemplate = new Button(top, SWT.CHECK);
+ btnUseTemplate.setText("Create a ESB Project use one of the templates");
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ btnUseTemplate.setLayoutData(gd);
+
+ Label lblAvailable = new Label(top, SWT.NONE);
+ lblAvailable.setText("Available templates:");
+ lblAvailable.setLayoutData(gd);
+
+
+ TreeViewer templates = new TreeViewer(top,SWT.BORDER);
+ templates.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Text txtDescription = new Text(top, SWT.READ_ONLY | SWT.BORDER);
+ txtDescription.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ return top;
+ }
+
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return null;
+ }
+
+
+}
+
Added:
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/NewESBProjectWizardPage.java
===================================================================
---
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/NewESBProjectWizardPage.java
(rev 0)
+++
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/NewESBProjectWizardPage.java 2008-08-01
03:07:32 UTC (rev 9461)
@@ -0,0 +1,261 @@
+package org.jboss.tools.esb.projects.wizards.pages;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.SortedSet;
+
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import
org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
+import
org.eclipse.wst.common.frameworks.internal.operations.IProjectCreationPropertiesNew;
+import org.eclipse.wst.common.frameworks.internal.ui.NewProjectGroup;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
+import org.eclipse.wst.common.project.facet.core.IPreset;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent;
+import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener;
+import org.eclipse.wst.common.project.facet.core.events.IProjectFacetsChangedEvent;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent;
+import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
+import org.eclipse.wst.common.project.facet.core.util.AbstractFilter;
+import org.eclipse.wst.common.project.facet.core.util.FilterEvent;
+import org.eclipse.wst.common.project.facet.core.util.IFilter;
+import org.eclipse.wst.common.project.facet.core.util.IFilter.IFilterEvent;
+import org.eclipse.wst.common.project.facet.ui.ModifyFacetedProjectWizard;
+import org.eclipse.wst.common.project.facet.ui.PresetSelectionPanel;
+import org.eclipse.wst.project.facet.ProductManager;
+import org.eclipse.wst.server.ui.ServerUIUtil;
+import org.eclipse.wst.web.internal.ResourceHandler;
+import org.eclipse.wst.web.internal.facet.RuntimePresetMappingRegistry;
+import
org.eclipse.wst.web.ui.internal.wizards.DataModelFacetCreationWizardPage.Messages;
+
+public class NewESBProjectWizardPage extends DataModelWizardPage implements
IFacetProjectCreationDataModelProperties {
+
+ protected NewProjectGroup projectNameGroup;
+ protected Combo serverTargetCombo;
+ private final IFacetedProjectWorkingCopy fpjwc;
+ private final IFacetedProjectListener fpjwcListener;
+ protected IProjectFacet primaryProjectFacet = null;
+ protected Combo primaryVersionCombo = null;
+
+
+
+ public NewESBProjectWizardPage(IDataModel model, String pageName) {
+ super(model, pageName);
+
+ this.fpjwc = (IFacetedProjectWorkingCopy) this.model.getProperty(
FACETED_PROJECT_WORKING_COPY );
+
+ this.fpjwcListener = new IFacetedProjectListener()
+ {
+ public void handleEvent( final IFacetedProjectEvent event )
+ {
+ validatePage();
+ }
+ };
+
+ this.fpjwc.addListener( this.fpjwcListener,
IFacetedProjectEvent.Type.VALIDATION_PROBLEMS_CHANGED );
+ }
+
+ @Override
+
+ protected Composite createTopLevelComposite(Composite parent) {
+ Composite top = new Composite(parent, SWT.NONE);
+ //PlatformUI.getWorkbench().getHelpSystem().setHelp(top, getInfopopID());
+ top.setLayout(new GridLayout());
+ top.setLayoutData(new GridData(GridData.FILL_BOTH));
+ createProjectGroup(top);
+ createServerTargetComposite(top);
+ createPrimaryFacetComposite(top);
+ //createPresetPanel(top);
+ return top;
+ }
+
+ protected void createPresetPanel(Composite top) {
+ final IFacetedProjectWorkingCopy fpjwc
+ = ( (ModifyFacetedProjectWizard) getWizard()
).getFacetedProjectWorkingCopy();
+
+ final IFilter<IPreset> filter = new AbstractFilter<IPreset>()
+ {
+ {
+ fpjwc.addListener
+ (
+ new IFacetedProjectListener()
+ {
+ public void handleEvent( final IFacetedProjectEvent event )
+ {
+ handleProjectFacetsChangedEvent( (IProjectFacetsChangedEvent)
event );
+ }
+ },
+ IFacetedProjectEvent.Type.PROJECT_FACETS_CHANGED
+ );
+ }
+
+ public boolean check( final IPreset preset )
+ {
+ return true;
+ }
+
+ private void handleProjectFacetsChangedEvent( final
IProjectFacetsChangedEvent event )
+ {
+
+ }
+ };
+
+ final PresetSelectionPanel ppanel = new PresetSelectionPanel( top, fpjwc, filter
);
+
+ ppanel.setLayoutData( gdhfill() );
+ }
+
+ protected static GridData gdhfill() {
+ return new GridData(GridData.FILL_HORIZONTAL);
+ }
+
+ protected void createServerTargetComposite(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setText(ResourceHandler.TargetRuntime);
+ group.setLayoutData(gdhfill());
+ group.setLayout(new GridLayout(2, false));
+ serverTargetCombo = new Combo(group, SWT.BORDER | SWT.READ_ONLY);
+ serverTargetCombo.setLayoutData(gdhfill());
+ Button newServerTargetButton = new Button(group, SWT.NONE);
+ newServerTargetButton.setText(ResourceHandler.NewDotDotDot);
+
+ Control[] deps = new Control[]{newServerTargetButton};
+ synchHelper.synchCombo(serverTargetCombo, FACET_RUNTIME, deps);
+ if (serverTargetCombo.getSelectionIndex() == -1 &&
serverTargetCombo.getVisibleItemCount() != 0)
+ serverTargetCombo.select(0);
+ }
+
+ protected void createPrimaryFacetComposite(Composite top) {
+ primaryProjectFacet = ProjectFacetsManager.getProjectFacet( getModuleTypeID() );
+ if (primaryProjectFacet.getVersions().size() <= 1){
+ //there is no need to create this section if there is only one
+ //facet version to choose from (e.g. utility and static web)
+ return;
+ }
+
+ final Group group = new Group( top, SWT.NONE );
+ group.setLayoutData( gdhfill() );
+ group.setLayout( new GridLayout( 1, false ) );
+ group.setText( Messages.bind( Messages.FACET_VERSION, new Object []
{primaryProjectFacet.getLabel()}));
+
+ primaryVersionCombo = new Combo( group, SWT.BORDER | SWT.READ_ONLY );
+ primaryVersionCombo.setLayoutData( gdhfill() );
+ updatePrimaryVersions();
+
+ primaryVersionCombo.addSelectionListener
+ (
+ new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected( final SelectionEvent e )
+ {
+ //handlePrimaryFacetVersionSelectedEvent();
+ }
+ }
+ );
+
+ fpjwc.addListener(new IFacetedProjectListener() {
+ public void handleEvent(IFacetedProjectEvent event) {
+ if(event.getType() == IFacetedProjectEvent.Type.PROJECT_FACETS_CHANGED){
+ //this block is to update the combo when the underlying facet version changes
+ IProjectFacetsChangedEvent actionEvent = (IProjectFacetsChangedEvent)event;
+ Set<IProjectFacetVersion> changedVersions =
actionEvent.getFacetsWithChangedVersions();
+
+ boolean foundComboVersion = false;
+ for(Iterator <IProjectFacetVersion> iterator = changedVersions.iterator();
iterator.hasNext() && !foundComboVersion;){
+ IProjectFacetVersion next = iterator.next();
+ if(next.getProjectFacet().equals(primaryProjectFacet)){
+ foundComboVersion = true;
+ final IProjectFacetVersion selectedVersion = next;
+ Display.getDefault().asyncExec(new Runnable(){
+ public void run() {
+ String selectedText =
primaryVersionCombo.getItem(primaryVersionCombo.getSelectionIndex());
+ if(!selectedText.equals(selectedVersion.getVersionString())){
+ String [] items = primaryVersionCombo.getItems();
+ int selectedVersionIndex = -1;
+ for(int i=0;i<items.length && selectedVersionIndex == -1; i++){
+ if(items[i].equals(selectedVersion.getVersionString())){
+ selectedVersionIndex = i;
+ primaryVersionCombo.select(selectedVersionIndex);
+ }
+ }
+ }
+ }
+ });
+ }
+ }
+ } else if(event.getType() == IFacetedProjectEvent.Type.PRIMARY_RUNTIME_CHANGED){
+ //this block updates the items in the combo when the runtime changes
+ Display.getDefault().asyncExec(new Runnable(){
+ public void run() {
+ updatePrimaryVersions();
+ }
+ });
+ }
+ }
+
+ }, IFacetedProjectEvent.Type.PROJECT_FACETS_CHANGED,
IFacetedProjectEvent.Type.PRIMARY_RUNTIME_CHANGED);
+ }
+
+ protected void createProjectGroup(Composite parent) {
+ IDataModel nestedProjectDM = model.getNestedModel(NESTED_PROJECT_DM);
+ nestedProjectDM.addListener(this);
+ projectNameGroup = new NewProjectGroup(parent, nestedProjectDM);
+ }
+
+ @Override
+ protected String[] getValidationPropertyNames() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getModuleTypeID(){
+ return "jboss.esb";
+ }
+
+ protected void updatePrimaryVersions(){
+ IProjectFacetVersion selectedVersion =
fpjwc.getProjectFacetVersion(primaryProjectFacet);
+ SortedSet<IProjectFacetVersion> initialVersions =
fpjwc.getAvailableVersions(primaryProjectFacet);
+ String [] items = new String[initialVersions.size()];
+ int i=0;
+ int selectedVersionIndex = -1;
+ for(Iterator <IProjectFacetVersion> iterator = initialVersions.iterator();
iterator.hasNext(); i++){
+ items[i] = iterator.next().getVersionString();
+ if(selectedVersionIndex == -1 &&
items[i].equals(selectedVersion.getVersionString())){
+ selectedVersionIndex = i;
+ }
+ }
+ primaryVersionCombo.clearSelection();
+ primaryVersionCombo.setItems(items);
+ primaryVersionCombo.select(selectedVersionIndex);
+ }
+
+
+}
+
Added:
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/TemplagePackageNameWizardPage.java
===================================================================
---
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/TemplagePackageNameWizardPage.java
(rev 0)
+++
workspace/Denny/org.jboss.tools.esb/src/org/jboss/tools/esb/projects/wizards/pages/TemplagePackageNameWizardPage.java 2008-08-01
03:07:32 UTC (rev 9461)
@@ -0,0 +1,44 @@
+package org.jboss.tools.esb.projects.wizards.pages;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Text;
+import
org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
+
+public class TemplagePackageNameWizardPage extends DataModelWizardPage implements
IFacetProjectCreationDataModelProperties {
+
+ public TemplagePackageNameWizardPage(IDataModel model, String pageName) {
+ super(model, pageName);
+ }
+
+ @Override
+ protected Composite createTopLevelComposite(Composite parent) {
+ Composite top = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ top.setLayout(layout);
+
+ Label lblPackage = new Label(top, SWT.NONE);
+ lblPackage.setText("Java Package Name:");
+
+ Text txtPkg = new Text(top, SWT.BORDER);
+ txtPkg.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ return top;
+ }
+
+ @Override
+ protected String[] getValidationPropertyNames() {
+ return null;
+ }
+
+
+}
+