[267144] RuntimesPropertyPage needs ProgressMonitor
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.project.facet.ui/META-INF/MANIFEST.MF
index 010db29..2d99837 100644
--- a/plugins/org.eclipse.wst.common.project.facet.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.project.facet.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-Vendor: %providerName
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.common.project.facet.ui; singleton:=true
-Bundle-Version: 1.3.2.qualifier
+Bundle-Version: 1.3.3.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.wst.common.project.facet.ui.internal.FacetUiPlugin
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPropertyPage.java b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPropertyPage.java
index 7879f0e..d4be189 100644
--- a/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPropertyPage.java
+++ b/plugins/org.eclipse.wst.common.project.facet.ui/src/org/eclipse/wst/common/project/facet/ui/internal/RuntimesPropertyPage.java
@@ -11,19 +11,25 @@
package org.eclipse.wst.common.project.facet.ui.internal;
+import java.lang.reflect.InvocationTargetException;
import java.util.Set;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.layout.GridData;
@@ -136,7 +142,7 @@
}
);
- Dialog.applyDialogFont( parent );
+ Dialog.applyDialogFont( parent );
return composite;
}
@@ -145,27 +151,81 @@
public boolean performOk()
{
- final Runnable op = new Runnable()
+ final IWorkspaceRunnable wr = new IWorkspaceRunnable()
{
- public void run()
+ public void run( final IProgressMonitor monitor )
+
+ throws CoreException
+
{
- try
- {
- RuntimesPropertyPage.this.fpjwc.commitChanges( null );
- }
- catch( CoreException e )
- {
- final IStatus st = e.getStatus();
-
- ErrorDialog.openError( getShell(), Resources.errDlgTitle,
- st.getMessage(), st );
-
- FacetUiPlugin.log( st );
- }
+ RuntimesPropertyPage.this.fpjwc.commitChanges( monitor );
}
};
- BusyIndicator.showWhile( null, op );
+ final IRunnableWithProgress op = new IRunnableWithProgress()
+ {
+ public void run( final IProgressMonitor monitor )
+
+ throws InvocationTargetException, InterruptedException
+
+ {
+ try
+ {
+ final IWorkspace ws = ResourcesPlugin.getWorkspace();
+ ws.run( wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, monitor );
+ }
+ catch( CoreException e )
+ {
+ throw new InvocationTargetException( e );
+ }
+ }
+ };
+
+ boolean failed = false;
+
+ try
+ {
+ new ProgressMonitorDialog( getShell() ).run( true, false, op );
+ }
+ catch( InterruptedException e )
+ {
+ failed = true;
+ return false;
+ }
+ catch( InvocationTargetException e )
+ {
+ failed = true;
+
+ final Throwable te = e.getTargetException();
+
+ if( te instanceof CoreException )
+ {
+ final IStatus st = ( (CoreException) te ).getStatus();
+
+ ErrorDialog.openError( getShell(), Resources.errDlgTitle,
+ st.getMessage(), st );
+
+ FacetUiPlugin.log( st );
+ }
+ else
+ {
+ throw new RuntimeException( te );
+ }
+ }
+ finally
+ {
+ if( failed )
+ {
+ try
+ {
+ this.fpjwc.revertChanges();
+ }
+ catch( Exception e )
+ {
+ FacetUiPlugin.log( e );
+ }
+ }
+ }
return true;
}