Author: snjeza
Date: 2009-01-20 18:32:03 -0500 (Tue, 20 Jan 2009)
New Revision: 13154
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java
Log:
JBIDE-3414 Trouble during expanding project view in package explorer.
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2009-01-20
17:34:56 UTC (rev 13153)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2009-01-20
23:32:03 UTC (rev 13154)
@@ -19,6 +19,7 @@
import org.apache.tools.ant.types.FilterSetCollection;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -256,9 +257,10 @@
IProjectFacet sf = ProjectFacetsManager.getProjectFacet("jst.ejb");
IProjectFacetVersion pfv =
ProjectFacetsManager.create(ejbProjectToBeImported).getInstalledVersion(sf);
ClasspathHelper.addClasspathEntries(ejbProjectToBeImported, pfv);
-
+ WtpUtils.reconfigure(ejbProjectToBeImported,monitor);
IProject earProjectToBeImported = wsRoot.getProject(earProjectName);
ResourcesUtils.importExistingProject(earProjectToBeImported, wsPath + "/" +
earProjectName, earProjectName, monitor, false);
+ WtpUtils.reconfigure(earProjectToBeImported, monitor);
}
IProject testProjectToBeImported = wsRoot.getProject(testProjectName);
@@ -270,10 +272,12 @@
if (!testLevel.equals(level)) {
JavaFacetUtils.setCompilerLevel(testProjectToBeImported, level);
}
-
+ testProjectToBeImported.refreshLocal(IResource.DEPTH_INFINITE, monitor);
SeamFacetAbstractInstallDelegate.toggleHibernateOnProject(testProjectToBeImported,
consoleName);
createSeamProjectPreferenes();
+ WtpUtils.reconfigure(seamWebProject, monitor);
+ WtpUtils.reconfigure(testProjectToBeImported, monitor);
}
/**
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java 2009-01-20
17:34:56 UTC (rev 13153)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java 2009-01-20
23:32:03 UTC (rev 13154)
@@ -30,9 +30,12 @@
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaModelStatus;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaConventions;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.core.JavaElementInfo;
+import org.eclipse.jdt.internal.core.JavaProject;
import org.eclipse.jdt.internal.ui.util.CoreUtility;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.ui.PreferenceConstants;
@@ -175,6 +178,11 @@
if(outputFolder != null) {
CoreUtility.createDerivedFolder(project.getFolder(outputFolder), true, true, new
NullProgressMonitor());
}
+ IFolder newSourceFolder= javaProject.getProject().getFolder(path);
+ if (!newSourceFolder.exists()) {
+ CoreUtility.createFolder(newSourceFolder, true, true, new NullProgressMonitor());
+ }
+
IClasspathEntry newEntry = JavaCore.newSourceEntry(newSourceFolderPath,new
Path[]{},new
Path[]{},outputFolder!=null?project.getFullPath().append(outputFolder):null);
if (projectEntryIndex != -1) {
@@ -199,11 +207,6 @@
}
}
- IFolder newSourceFolder= javaProject.getProject().getFolder(path);
- if (!newSourceFolder.exists()) {
- CoreUtility.createFolder(newSourceFolder, true, true, new NullProgressMonitor());
- }
-
javaProject.setRawClasspath(newClasspathEntries, newOutputLocation, new
NullProgressMonitor());
return newSourceFolder;
} catch (CoreException e) {
@@ -260,4 +263,23 @@
jProject.setRawClasspath(cps, monitor);
}
+ public static void reconfigure(IProject project, IProgressMonitor monitor) throws
CoreException {
+ if (project == null || !project.exists() || !project.isOpen() ||
!project.hasNature(JavaCore.NATURE_ID)) {
+ return;
+ }
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ IJavaProject javaProject = JavaCore.create(project);
+ if (javaProject != null && javaProject.exists() && javaProject.isOpen()
&& javaProject instanceof JavaProject) {
+ Object object = ((JavaProject) javaProject).getElementInfo();
+ if (object instanceof JavaElementInfo) {
+ // copied from JavaProject.buildStructure(...)
+ JavaElementInfo info = (JavaElementInfo) object;
+ IClasspathEntry[] resolvedClasspath = ((JavaProject)
javaProject).getResolvedClasspath();
+ IPackageFragmentRoot[] children = ((JavaProject)
javaProject).computePackageFragmentRoots(resolvedClasspath,false, null /* no reverse map
*/);
+ info.setChildren(children);
+ ((JavaProject) javaProject).getPerProjectInfo().rememberExternalLibTimestamps();
+ }
+ }
+ }
+
}