[jboss-cvs] jbosside/ejb3/plugins/org.jboss.ide.eclipse.ejb3.wizards.core/src/main/org/jboss/ide/eclipse/ejb3/core/facet ...
Robert Stryker
rawblem at gmail.com
Mon Jan 22 15:19:23 EST 2007
User: rawb
Date: 07/01/22 15:19:23
Modified: ejb3/plugins/org.jboss.ide.eclipse.ejb3.wizards.core/src/main/org/jboss/ide/eclipse/ejb3/core/facet
Ejb30FacetPostInstallDelegate.java
Log:
Changes to use correct API. See eclipse bug 171282
Revision Changes Path
1.2 +39 -17 jbosside/ejb3/plugins/org.jboss.ide.eclipse.ejb3.wizards.core/src/main/org/jboss/ide/eclipse/ejb3/core/facet/Ejb30FacetPostInstallDelegate.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Ejb30FacetPostInstallDelegate.java
===================================================================
RCS file: /cvsroot/jboss/jbosside/ejb3/plugins/org.jboss.ide.eclipse.ejb3.wizards.core/src/main/org/jboss/ide/eclipse/ejb3/core/facet/Ejb30FacetPostInstallDelegate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Ejb30FacetPostInstallDelegate.java 6 Nov 2006 17:04:26 -0000 1.1
+++ Ejb30FacetPostInstallDelegate.java 22 Jan 2007 20:19:23 -0000 1.2
@@ -4,6 +4,8 @@
import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -27,11 +29,12 @@
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
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.eclipse.wst.common.project.facet.core.runtime.IRuntime;
import org.jboss.ide.eclipse.ejb3.core.classpath.AopFromRuntimeClasspathContainer;
import org.jboss.ide.eclipse.ejb3.core.classpath.EJB3ClasspathContainer;
-import org.jboss.ide.eclipse.jdt.aop.core.classpath.AopJdk15ClasspathContainer;
public class Ejb30FacetPostInstallDelegate extends J2EEFacetInstallDelegate implements IDelegate {
@@ -88,26 +91,45 @@
}
public void addClasspathEntries(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor) throws CoreException {
+ try {
+ IFacetedProject facetedProj = ProjectFacetsManager.create(project);
+ IRuntime runtime = facetedProj.getPrimaryRuntime();
+ String runtimeName = runtime.getName();
+
ArrayList list = new ArrayList();
String runtimeKey = IFacetProjectCreationDataModelProperties.FACET_RUNTIME;
if( config instanceof IDataModel ) {
- IDataModel model = (IDataModel)config;
- Object runtime = model.getProperty(runtimeKey);
- String runtimeName = null;
- if( runtime instanceof IRuntime ) {
+
+ if( runtime != null && runtime instanceof IRuntime ) {
runtimeName = ((IRuntime)runtime).getName();
- }
//list.add(JavaCore.newContainerEntry(new Path(AopJdk15ClasspathContainer.CONTAINER_ID)));
list.add(JavaCore.newContainerEntry(new Path(EJB3ClasspathContainer.CONTAINER_ID).append(runtimeName)));
list.add(JavaCore.newContainerEntry(new Path(AopFromRuntimeClasspathContainer.CONTAINER_ID).append(runtimeName)));
ClasspathHelper.addClasspathEntries(project, fv, list);
}
+ }
+ } catch( Exception e ) {
+ e.printStackTrace();
+ }
if (monitor != null) {
monitor.worked(1);
}
}
+
+ private void printModelProperties(IDataModel model) {
+ // diag
+ System.out.println("\n\n");
+ Collection c = model.getAllProperties();
+ Object o;
+ for( Iterator i = c.iterator(); i.hasNext();) {
+ o = i.next();
+ System.out.println(o + " - " + model.getProperty((String)o));
+ }
+
+ }
+
public void addJNDIFile(IProject project) {
try {
String sourcePath = findSourcePaths(project);
More information about the jboss-cvs-commits
mailing list