Author: akazakov
Date: 2008-10-06 11:03:27 -0400 (Mon, 06 Oct 2008)
New Revision: 10690
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2731
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2008-10-06
14:58:09 UTC (rev 10689)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2008-10-06
15:03:27 UTC (rev 10690)
@@ -78,10 +78,34 @@
public static String DROOLS_LIB_SEAM_RELATED_PATH = "lib"; //$NON-NLS-1$
- public void doExecute(final IProject project, IProjectFacetVersion fv,
- Object config, IProgressMonitor monitor) throws CoreException {
- final IDataModel model = (IDataModel)config;
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#doExecuteForEar(org.eclipse.core.resources.IProject,
org.eclipse.wst.common.project.facet.core.IProjectFacetVersion,
org.eclipse.wst.common.frameworks.datamodel.IDataModel,
org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected void doExecuteForEar(final IProject project, IProjectFacetVersion fv,
+ IDataModel model, IProgressMonitor monitor) throws CoreException {
+ // TODO
+ }
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#doExecuteForEjb(org.eclipse.core.resources.IProject,
org.eclipse.wst.common.project.facet.core.IProjectFacetVersion,
org.eclipse.wst.common.frameworks.datamodel.IDataModel,
org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected void doExecuteForEjb(final IProject project, IProjectFacetVersion fv,
+ IDataModel model, IProgressMonitor monitor) throws CoreException {
+ // TODO
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#doExecuteForWar(org.eclipse.core.resources.IProject,
org.eclipse.wst.common.project.facet.core.IProjectFacetVersion,
org.eclipse.wst.common.frameworks.datamodel.IDataModel,
org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected void doExecuteForWar(final IProject project, IProjectFacetVersion fv,
+ IDataModel model, IProgressMonitor monitor) throws CoreException {
+
// get WebContents folder path from DWP model
IVirtualComponent component = ComponentCore.createComponent(project);
IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new
Path("/")); //$NON-NLS-1$
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-10-06
14:58:09 UTC (rev 10689)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-10-06
15:03:27 UTC (rev 10690)
@@ -35,6 +35,7 @@
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jst.j2ee.model.IModelProvider;
import org.eclipse.jst.j2ee.model.ModelProviderManager;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
import org.eclipse.jst.javaee.core.DisplayName;
import org.eclipse.jst.javaee.core.JavaeeFactory;
import org.eclipse.jst.javaee.core.Listener;
@@ -55,7 +56,9 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
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.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.seam.core.SeamCoreMessages;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.osgi.service.prefs.BackingStoreException;
@@ -239,14 +242,59 @@
*
* @param project
* @param fv
+ * @param model
+ * @param monitor
+ * @throws CoreException
+ */
+ protected abstract void doExecuteForWar(IProject project, IProjectFacetVersion fv,
+ IDataModel model, IProgressMonitor monitor) throws CoreException;
+
+ /**
+ *
+ * @param project
+ * @param fv
+ * @param model
+ * @param monitor
+ * @throws CoreException
+ */
+ protected abstract void doExecuteForEar(IProject project, IProjectFacetVersion fv,
+ IDataModel model, IProgressMonitor monitor) throws CoreException;
+
+ /**
+ *
+ * @param project
+ * @param fv
+ * @param model
+ * @param monitor
+ * @throws CoreException
+ */
+ protected abstract void doExecuteForEjb(IProject project, IProjectFacetVersion fv,
+ IDataModel model, IProgressMonitor monitor) throws CoreException;
+
+ /**
+ *
+ * @param project
+ * @param fv
* @param config
* @param monitor
* @throws CoreException
*/
- protected abstract void doExecute(IProject project, IProjectFacetVersion fv,
- Object config, IProgressMonitor monitor) throws CoreException;
+ public void doExecute(final IProject project, IProjectFacetVersion fv,
+ Object config, IProgressMonitor monitor) throws CoreException {
+ final IDataModel model = (IDataModel)config;
+ IFacetedProject facetedProject = ProjectFacetsManager.create(project);
+ IProjectFacetVersion ejbVersion =
facetedProject.getProjectFacetVersion(IJ2EEFacetConstants.EJB_FACET);
+ IProjectFacetVersion webVersion =
facetedProject.getProjectFacetVersion(IJ2EEFacetConstants.DYNAMIC_WEB_FACET);
+ IProjectFacetVersion earVersion =
facetedProject.getProjectFacetVersion(IJ2EEFacetConstants.ENTERPRISE_APPLICATION_FACET);
+ if(ejbVersion!=null) {
+ doExecuteForEjb(project, fv, model, monitor);
+ } else if(webVersion!=null) {
+ doExecuteForWar(project, fv, model, monitor);
+ } else if(earVersion!=null) {
+ doExecuteForEar(project, fv, model, monitor);
+ }
+ }
-
/**
*
*/
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2008-10-06
14:58:09 UTC (rev 10689)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2008-10-06
15:03:27 UTC (rev 10690)
@@ -22,6 +22,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
import org.eclipse.jst.javaee.core.DisplayName;
import org.eclipse.jst.javaee.core.JavaeeFactory;
import org.eclipse.jst.javaee.web.Filter;
@@ -30,14 +31,16 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
/**
- * Install delegate for seam faset version 1.2
+ * Install delegate for seam facet version 1.2
*
* @author eskimo
*/
@@ -108,9 +111,34 @@
public static String DROOLS_LIB_SEAM_RELATED_PATH = "drools/lib";
//$NON-NLS-1$
- private void doExecuteForWar(final IProject project, IProjectFacetVersion fv,
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#doExecuteForEar(org.eclipse.core.resources.IProject,
org.eclipse.wst.common.project.facet.core.IProjectFacetVersion,
org.eclipse.wst.common.frameworks.datamodel.IDataModel,
org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected void doExecuteForEar(final IProject project, IProjectFacetVersion fv,
IDataModel model, IProgressMonitor monitor) throws CoreException {
+ // TODO
+ }
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#doExecuteForEjb(org.eclipse.core.resources.IProject,
org.eclipse.wst.common.project.facet.core.IProjectFacetVersion,
org.eclipse.wst.common.frameworks.datamodel.IDataModel,
org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected void doExecuteForEjb(final IProject project, IProjectFacetVersion fv,
+ IDataModel model, IProgressMonitor monitor) throws CoreException {
+ // TODO
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#doExecuteForWar(org.eclipse.core.resources.IProject,
org.eclipse.wst.common.project.facet.core.IProjectFacetVersion,
org.eclipse.wst.common.frameworks.datamodel.IDataModel,
org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected void doExecuteForWar(final IProject project, IProjectFacetVersion fv,
+ IDataModel model, IProgressMonitor monitor) throws CoreException {
+
// get WebContents folder path from DWP model
IVirtualComponent component = ComponentCore.createComponent(project);
IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new
Path("/")); //$NON-NLS-1$
@@ -280,17 +308,6 @@
/*
* (non-Javadoc)
- * @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#doExecute(org.eclipse.core.resources.IProject,
org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, java.lang.Object,
org.eclipse.core.runtime.IProgressMonitor)
- */
- public void doExecute(final IProject project, IProjectFacetVersion fv,
- Object config, IProgressMonitor monitor) throws CoreException {
- final IDataModel model = (IDataModel)config;
-
- doExecuteForWar(project, fv, model, monitor);
- }
-
- /*
- * (non-Javadoc)
* @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#configure(org.eclipse.jst.javaee.web.WebApp)
*/
@Override