Author: rob.stryker(a)jboss.com
Date: 2009-02-24 00:58:38 -0500 (Tue, 24 Feb 2009)
New Revision: 13743
Added:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/export/
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/export/ESBComponentExportDataModelProvider.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/export/ESBComponentExportOperation.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/export/ESBComponentExportPage.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/export/ESBComponentExportWizard.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
trunk/esb/plugins/org.jboss.tools.esb.project.core/META-INF/MANIFEST.MF
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleFactory.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/META-INF/MANIFEST.MF
trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.xml
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUI.properties
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUIMessages.java
Log:
JBIDE-3772 - export wizard for ESB
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF 2009-02-24 05:19:22
UTC (rev 13742)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF 2009-02-24 05:58:38
UTC (rev 13743)
@@ -51,7 +51,8 @@
Export-Package: org.jboss.ide.eclipse.as.ui,
org.jboss.ide.eclipse.as.ui.dialogs,
org.jboss.ide.eclipse.as.ui.views.server.extensions,
- org.jboss.ide.eclipse.as.ui.wizards
+ org.jboss.ide.eclipse.as.ui.wizards,
+ org.jboss.tools.as.wst.server.ui.xpl
Bundle-ClassPath: jbossui.jar
Bundle-Activator: org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin
Bundle-Vendor: %Bundle-Vendor.0
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.core/META-INF/MANIFEST.MF 2009-02-24
05:19:22 UTC (rev 13742)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.core/META-INF/MANIFEST.MF 2009-02-24
05:58:38 UTC (rev 13743)
@@ -34,6 +34,7 @@
Export-Package: org.jboss.tools.esb.core,
org.jboss.tools.esb.core.facet,
org.jboss.tools.esb.core.messages,
+ org.jboss.tools.esb.core.module,
org.jboss.tools.esb.core.runtime,
org.jboss.tools.esb.core.utils
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleFactory.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleFactory.java 2009-02-24
05:19:22 UTC (rev 13742)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.core/src/org/jboss/tools/esb/core/module/JBossESBModuleFactory.java 2009-02-24
05:58:38 UTC (rev 13743)
@@ -12,25 +12,49 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.internal.ModuleFactory;
+import org.eclipse.wst.server.core.internal.ServerPlugin;
import org.eclipse.wst.server.core.model.ModuleDelegate;
import org.eclipse.wst.server.core.util.ProjectModuleFactoryDelegate;
import org.jboss.tools.esb.core.ESBProjectConstant;
import org.jboss.tools.esb.core.ESBProjectCorePlugin;
public class JBossESBModuleFactory extends ProjectModuleFactoryDelegate {
+ public static final String FACTORY_ID =
"org.jboss.tools.esb.project.core.moduleFactory";
+ private static ModuleFactory factory;
+ private static JBossESBModuleFactory factDelegate;
+ public static JBossESBModuleFactory getFactory() {
+ if (factDelegate == null) {
+ ModuleFactory[] factories = ServerPlugin.getModuleFactories();
+ for (int i = 0; i < factories.length; i++) {
+ if (factories[i].getId().equals(FACTORY_ID)) {
+ Object o = factories[i]
+ .getDelegate(new NullProgressMonitor());
+ if (o instanceof JBossESBModuleFactory) {
+ factory = factories[i];
+ factDelegate = (JBossESBModuleFactory) o;
+ return factDelegate;
+ }
+ }
+ }
+ }
+ return factDelegate;
+ }
+
public JBossESBModuleFactory() {
}
@Override
public ModuleDelegate getModuleDelegate(IModule module) {
- if(module instanceof JBossESBModule){
+ if (module instanceof JBossESBModule) {
IProject project = module.getProject();
- return new JBossESBModuleDelegate(project);
+ return new JBossESBModuleDelegate(project);
}
return null;
}
@@ -42,17 +66,19 @@
if (facetProject == null) {
return null;
}
- IProjectFacet esbFacet =
ProjectFacetsManager.getProjectFacet(ESBProjectConstant.ESB_PROJECT_FACET);
+ IProjectFacet esbFacet = ProjectFacetsManager
+ .getProjectFacet(ESBProjectConstant.ESB_PROJECT_FACET);
- if(facetProject.hasProjectFacet(esbFacet)){
- JBossESBModule module = new JBossESBModule(project, this, this.getId());
- return new IModule[]{ module };
+ if (facetProject.hasProjectFacet(esbFacet)) {
+ JBossESBModule module = new JBossESBModule(project, this, this
+ .getId());
+ return new IModule[] { module };
}
} catch (CoreException e) {
ESBProjectCorePlugin.getDefault().getLog().log(e.getStatus());
}
return null;
-
+
}
-
+
}
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.ui/META-INF/MANIFEST.MF 2009-02-24
05:19:22 UTC (rev 13742)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.ui/META-INF/MANIFEST.MF 2009-02-24
05:58:38 UTC (rev 13743)
@@ -32,7 +32,8 @@
org.eclipse.jdt.core;bundle-version="3.4.0",
org.jboss.tools.esb.project.core;bundle-version="1.0.0",
org.jboss.tools.common.model.ui;bundle-version="2.0.0",
- org.eclipse.jdt.ui;bundle-version="3.4.1"
+ org.eclipse.jdt.ui;bundle-version="3.4.1",
+ org.jboss.ide.eclipse.as.ui;bundle-version="1.0.0"
Eclipse-LazyStart: true
Bundle-Vendor: %Bundle-Vendor.0
Export-Package: org.jboss.tools.esb.project.ui
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.xml
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.xml 2009-02-24 05:19:22 UTC
(rev 13742)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.ui/plugin.xml 2009-02-24 05:58:38 UTC
(rev 13743)
@@ -73,7 +73,29 @@
<classpathContainerPage
class="org.jboss.tools.esb.project.ui.wizards.pages.JBossESBRuntimeContainerPage"
id="org.jboss.esb.runtime.classpath"
- name="JBoss ESB Libraries">
+ name="JBoss ESB Libraries">
</classpathContainerPage>
</extension>
+
+
+ <extension
+ point="org.eclipse.ui.exportWizards">
+ <category
+ name="ESB"
+ id="org.jboss.tools.esb.category">
+ </category>
+ <wizard
+ name="ESB File"
+ icon="icons/obj16/esb_module.gif"
+
class="org.jboss.tools.esb.project.ui.wizards.export.ESBComponentExportWizard"
+ category="org.jboss.tools.esb.category"
+
id="org.jboss.tools.esb.project.ui.wizards.temp.ESBExportWizard">
+ <description>
+ ESB File
+ </description>
+ <selection
+ class="org.eclipse.core.resources.IResource">
+ </selection>
+ </wizard>
+ </extension>
</plugin>
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUI.properties
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUI.properties 2009-02-24
05:19:22 UTC (rev 13742)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUI.properties 2009-02-24
05:58:38 UTC (rev 13743)
@@ -65,3 +65,7 @@
ESBProjectWizard_Title=New ESB Project Wizard
+ESBExportWizard_NotValidProject=Project "{0}" is not a valid ESB Project
+ESBExportWizard_Title=ESB Export
+ESBExportWizard_Description=Export an ESB project to the local file system.
+ESBExportWizard_ESBProject=ESB Project:
\ No newline at end of file
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUIMessages.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUIMessages.java 2009-02-24
05:19:22 UTC (rev 13742)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/messages/JBossESBUIMessages.java 2009-02-24
05:58:38 UTC (rev 13743)
@@ -121,9 +121,12 @@
public static String ESBProjectWizard_Title;
+ public static String ESBExportWizard_NotValidProject;
+ public static String ESBExportWizard_Title;
+ public static String ESBExportWizard_Description;
+ public static String ESBExportWizard_ESBProject;
+
-
-
static {
NLS.initializeMessages(BUNDLE_NAME, JBossESBUIMessages.class);
}
Added:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/export/ESBComponentExportDataModelProvider.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/export/ESBComponentExportDataModelProvider.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/export/ESBComponentExportDataModelProvider.java 2009-02-24
05:58:38 UTC (rev 13743)
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.esb.project.ui.wizards.export;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import
org.eclipse.jst.j2ee.application.internal.operations.J2EEComponentExportDataModelProvider;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+import org.jboss.tools.esb.core.ESBProjectConstant;
+import org.jboss.tools.esb.core.utils.JBossESBProjectUtil;
+import org.jboss.tools.esb.project.ui.ESBProjectPlugin;
+import org.jboss.tools.esb.project.ui.messages.JBossESBUIMessages;
+
+public class ESBComponentExportDataModelProvider extends
+ J2EEComponentExportDataModelProvider {
+
+ public IDataModelOperation getDefaultOperation() {
+ return new ESBComponentExportOperation(model);
+ }
+
+ public Set getPropertyNames() {
+ return super.getPropertyNames();
+ }
+
+ public Object getDefaultProperty(String propertyName) {
+ return super.getDefaultProperty(propertyName);
+ }
+
+ protected String getProjectType() {
+ return ESBProjectConstant.ESB_PROJECT_FACET;
+ }
+
+ protected String getWrongComponentTypeString(String projectName) {
+ return NLS.bind(JBossESBUIMessages.ESBExportWizard_NotValidProject, projectName);
+ }
+
+ protected String getModuleExtension() {
+ return ".esb"; //$NON-NLS-1$
+ }
+
+ public IStatus validate(String propertyName) {
+ if (PROJECT_NAME.equals(propertyName)) {
+ String projectName = (String) model.getProperty(PROJECT_NAME);
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if( project != null ) {
+ if(JBossESBProjectUtil.isESBProject(project))
+ return Status.OK_STATUS;
+ }
+ return new Status(IStatus.ERROR, ESBProjectPlugin.PLUGIN_ID,
+ NLS.bind(JBossESBUIMessages.ESBExportWizard_NotValidProject, projectName));
+ }
+ return super.validate(propertyName);
+ }
+
+ public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
+ if (propertyName.equals(PROJECT_NAME)) {
+ List componentNames = new ArrayList();
+ IVirtualComponent[] wbComps = ComponentUtilities.getAllWorkbenchComponents();
+
+ List relevantComponents = new ArrayList();
+ IProject aProj = null;
+ for (int i = 0; i < wbComps.length; i++) {
+ aProj = wbComps[i].getProject();
+ if( JBossESBProjectUtil.isESBProject(aProj) ) {
+ relevantComponents.add(wbComps[i]);
+ getComponentMap().put(wbComps[i].getName(), wbComps[i]);
+ }
+ }
+
+ if (relevantComponents == null || relevantComponents.size() == 0)
+ return null;
+
+ for (int j = 0; j < relevantComponents.size(); j++) {
+ componentNames.add(((IVirtualComponent) relevantComponents.get(j)).getName());
+ }
+ String[] names = (String[]) componentNames.toArray(new
String[componentNames.size()]);
+
+ return DataModelPropertyDescriptor.createDescriptors(names);
+ }
+ return super.getValidPropertyDescriptors(propertyName);
+ }
+}
Added:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/export/ESBComponentExportOperation.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/export/ESBComponentExportOperation.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/export/ESBComponentExportOperation.java 2009-02-24
05:58:38 UTC (rev 13743)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.esb.project.ui.wizards.export;
+
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.jboss.tools.as.wst.server.ui.xpl.J2EEModuleExportOperation;
+import org.jboss.tools.esb.core.ESBProjectConstant;
+
+public class ESBComponentExportOperation extends J2EEModuleExportOperation {
+ public ESBComponentExportOperation() {
+ super();
+ }
+
+ public ESBComponentExportOperation(IDataModel model) {
+ super(model);
+ }
+
+ protected String getModuleTypeID() {
+ return ESBProjectConstant.ESB_PROJECT_FACET;
+ }
+
+ protected String archiveString() {
+ return "ESB File";
+ }
+}
Added:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/export/ESBComponentExportPage.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/export/ESBComponentExportPage.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/export/ESBComponentExportPage.java 2009-02-24
05:58:38 UTC (rev 13743)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.esb.project.ui.wizards.export;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jst.j2ee.internal.wizard.J2EEModuleExportPage;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.jboss.tools.common.model.ui.ModelUIImages;
+import org.jboss.tools.esb.project.ui.messages.JBossESBUIMessages;
+
+public class ESBComponentExportPage extends J2EEModuleExportPage {
+ public ESBComponentExportPage(IDataModel model, String pageName, IStructuredSelection
selection) {
+ super(model, pageName, selection);
+ setTitle(JBossESBUIMessages.ESBExportWizard_Title);
+ setDescription(JBossESBUIMessages.ESBExportWizard_Description);
+ setImageDescriptor(ModelUIImages.getImageDescriptor(ModelUIImages.WIZARD_NEW_PROJECT));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getProjectImportLabel()
+ */
+ protected String getComponentLabel() {
+ return JBossESBUIMessages.ESBExportWizard_ESBProject;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEImportPage#getFilterExpression()
+ */
+ protected String[] getFilterExpression() {
+ return new String[]{"*.esb"}; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.eclipse.jst.j2ee.internal.internal.internal.ui.wizard.J2EEExportPage#isMetaTypeSupported(java.lang.Object)
+ */
+ protected boolean isMetaTypeSupported(Object o) {
+ return true;
+ }
+
+ protected String getCompnentID() {
+ return "test9"; //$NON-NLS-1$
+ }
+
+}
Added:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/export/ESBComponentExportWizard.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/export/ESBComponentExportWizard.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/export/ESBComponentExportWizard.java 2009-02-24
05:58:38 UTC (rev 13743)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.esb.project.ui.wizards.export;
+
+import org.eclipse.jst.j2ee.internal.wizard.J2EEArtifactExportWizard;
+import org.eclipse.ui.IExportWizard;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
+import org.jboss.tools.common.model.ui.ModelUIImages;
+
+public class ESBComponentExportWizard extends J2EEArtifactExportWizard
+ implements IExportWizard {
+
+ public ESBComponentExportWizard() {
+ super();
+ }
+
+ public ESBComponentExportWizard(IDataModel model) {
+ super(model);
+ }
+
+ protected IDataModelProvider getDefaultProvider() {
+ return new ESBComponentExportDataModelProvider();
+ }
+
+ public void doAddPages() {
+ addPage(new ESBComponentExportPage(getDataModel(), MAIN_PG, getSelection()));
+ }
+
+ protected void doInit() {
+ setDefaultPageImageDescriptor(ModelUIImages.getImageDescriptor(ModelUIImages.WIZARD_NEW_PROJECT));
+ }
+}