[jbosstools-commits] JBoss Tools SVN: r41308 - in trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples: dialog and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed May 23 13:55:33 EDT 2012


Author: snjeza
Date: 2012-05-23 13:55:33 -0400 (Wed, 23 May 2012)
New Revision: 41308

Modified:
   trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java
   trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerDialog.java
Log:
JBIDE-11929 - Project examples freezes during quickfix dialog

Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java	2012-05-23 16:35:03 UTC (rev 41307)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java	2012-05-23 17:55:33 UTC (rev 41308)
@@ -45,6 +45,7 @@
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
@@ -215,6 +216,11 @@
 		@Override
 		protected IStatus run(IProgressMonitor monitor) {
 			try {
+				try {
+					ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
+				} catch (CoreException e) {
+					log(e);
+				}
 				Job.getJobManager().join(PROJECT_EXAMPLES_FAMILY, monitor);
 				Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD,
 						monitor);

Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerDialog.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerDialog.java	2012-05-23 16:35:03 UTC (rev 41307)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/dialog/MarkerDialog.java	2012-05-23 17:55:33 UTC (rev 41308)
@@ -19,13 +19,9 @@
 
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResourceChangeEvent;
 import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
 import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.resources.WorkspaceJob;
-import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
@@ -223,41 +219,6 @@
 				try {
 					quickFixButton.setSelection(false);
 					openQuickFixWizard(selected);
-					WorkspaceJob job = new WorkspaceJob("Building workspace") {
-						
-						@Override
-						public IStatus runInWorkspace(IProgressMonitor monitor)
-								throws CoreException {
-							for (ProjectExample project : projects) {
-								if (project.getIncludedProjects() == null) {
-									buildProject(project.getName(), monitor);
-								} else {
-									List<String> includedProjects = project.getIncludedProjects();
-									for (String projectName:includedProjects) {
-										buildProject(projectName, monitor);
-										if (monitor.isCanceled()) {
-											return Status.CANCEL_STATUS;
-										}
-									}
-								}
-							}
-							if (monitor.isCanceled()) {
-								return Status.CANCEL_STATUS;
-							}
-							ProjectExamplesActivator.waitForBuildAndValidation.schedule();
-							try {
-								ProjectExamplesActivator.waitForBuildAndValidation.join();
-							} catch (InterruptedException e) {
-								return Status.CANCEL_STATUS;
-							}
-							if (monitor.isCanceled()) {
-								return Status.CANCEL_STATUS;
-							}
-							return Status.OK_STATUS;
-						}
-					};
-					job.setUser(true);
-					job.schedule();
 				} catch (Exception e) {
 					ProjectExamplesActivator.log(e);
 				} finally {
@@ -266,14 +227,7 @@
 			}
 		}
 	}
-
-	private void buildProject(String projectName, IProgressMonitor monitor) throws CoreException {
-		IProject eclipseProject = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
-		if (eclipseProject != null && eclipseProject.isOpen()) {
-			eclipseProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
-		}
-	}
-
+	
 	private void refreshTableViewer() {
 		tableViewer.setInput(projects);
 		ISelection source = tableViewer.getSelection();



More information about the jbosstools-commits mailing list