geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r368515 - /geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoFacetInstallDelegate.java
Date Thu, 12 Jan 2006 23:25:04 GMT
Author: sppatel
Date: Thu Jan 12 15:25:01 2006
New Revision: 368515

URL: http://svn.apache.org/viewcvs?rev=368515&view=rev
Log:
propegate geronimo facet up to all ears on project creation

Modified:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoFacetInstallDelegate.java

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoFacetInstallDelegate.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoFacetInstallDelegate.java?rev=368515&r1=368514&r2=368515&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoFacetInstallDelegate.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoFacetInstallDelegate.java
Thu Jan 12 15:25:01 2006
@@ -20,15 +20,21 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.jst.j2ee.internal.archive.operations.JavaComponentCreationDataModelProvider;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
 import org.eclipse.wst.common.componentcore.ComponentCore;
 import org.eclipse.wst.common.componentcore.datamodel.properties.IComponentCreationDataModelProperties;
 import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
 import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
 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.IProjectFacet;
 import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
 
 public class GeronimoFacetInstallDelegate implements IDelegate {
+	
+	public static final String FACET_ID = "org.apache.geronimo.facet";
 
 	public GeronimoFacetInstallDelegate() {
 		super();
@@ -44,13 +50,27 @@
 	public void execute(IProject project, IProjectFacetVersion fv,
 			Object config, IProgressMonitor monitor) throws CoreException {
 		
-		IVirtualComponent comp = ComponentCore.createComponent(project);
+		DeploymentPlanCreationOperation op = createDeploymentPlanCreationOp(project);
+		op.execute();
 		
+		IProject[] ears = J2EEProjectUtilities.getReferencingEARProjects(project);
+		IProjectFacet facet = ProjectFacetsManager.getProjectFacet(FACET_ID);
+		for(int i = 0; i < ears.length; i++) {
+			IFacetedProject fp = ProjectFacetsManager.create(ears[i]);
+			if(!fp.hasProjectFacet(facet)) {
+				op = createDeploymentPlanCreationOp(ears[i]);
+				op.execute();
+			}
+		}
+	}
+
+	private DeploymentPlanCreationOperation createDeploymentPlanCreationOp(IProject project)
{
+		IVirtualComponent comp = ComponentCore.createComponent(project);
 		IDataModel model = DataModelFactory.createDataModel(new JavaComponentCreationDataModelProvider());
 		model.setStringProperty(IComponentCreationDataModelProperties.COMPONENT_NAME, comp.getName());
 		model.setStringProperty(IComponentCreationDataModelProperties.PROJECT_NAME, project.getName());
 		DeploymentPlanCreationOperation op = new DeploymentPlanCreationOperation(model);
-		op.execute();
+		return op;
 	}
 
 }



Mime
View raw message