Author: snjeza
Date: 2009-02-03 17:27:26 -0500 (Tue, 03 Feb 2009)
New Revision: 13456
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/META-INF/MANIFEST.MF
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java
Log:
JBIDE-3414 Trouble during expanding project view in package explorer.
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/META-INF/MANIFEST.MF
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/META-INF/MANIFEST.MF 2009-02-03
18:13:49 UTC (rev 13455)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/META-INF/MANIFEST.MF 2009-02-03
22:27:26 UTC (rev 13456)
@@ -20,6 +20,7 @@
org.eclipse.ui.ide,
org.eclipse.wst.validation,
org.eclipse.ui.views,
- org.eclipse.ui.cheatsheets
+ org.eclipse.ui.cheatsheets,
+ org.eclipse.jdt.core
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java 2009-02-03
18:13:49 UTC (rev 13455)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java 2009-02-03
22:27:26 UTC (rev 13456)
@@ -35,7 +35,6 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -43,6 +42,12 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.core.JavaElementInfo;
+import org.eclipse.jdt.internal.core.JavaProject;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
@@ -192,6 +197,11 @@
return;
}
if (showQuickFix) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+
+ }
List<IMarker> markers = ProjectExamplesActivator
.getMarkers(projects);
if (markers != null && markers.size() > 0) {
@@ -342,6 +352,7 @@
structureProvider, OVERWRITE_ALL_QUERY, filesToImport);
operation.setContext(getShell());
operation.run(monitor);
+ reconfigure(project, monitor);
}
}
}
@@ -378,6 +389,7 @@
OVERWRITE_ALL_QUERY);
operation.setContext(getShell());
operation.run(monitor);
+ reconfigure(project, monitor);
}
public void init(IWorkbench workbench, IStructuredSelection selection) {
@@ -421,4 +433,23 @@
}
return list;
}
+
+ private 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();
+ }
+ }
+ }
}
Show replies by thread