provide utility method to run workspace op in status bar vs pop up dialog


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@995292 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/SigilUI.java b/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/SigilUI.java
index 6c52ccf..a34c71b 100644
--- a/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/SigilUI.java
+++ b/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/SigilUI.java
@@ -35,6 +35,7 @@
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 
@@ -149,6 +150,27 @@
         }
     }
 
+    public static void runWorkspaceOperationSync(IRunnableWithProgress op) throws CoreException
+    {
+        try
+        {
+            PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(false, true, op);
+        }
+        catch (InvocationTargetException e)
+        {
+            if (e.getCause() instanceof CoreException) {
+                throw (CoreException) e.getCause();
+            }
+            else {
+                throw SigilCore.newCoreException("Failed to execute task", e.getCause());
+            }
+        }
+        catch (InterruptedException e1)
+        {
+            SigilCore.log("Workspace operation interrupted");
+        }
+    }
+    
     public static IWorkbenchWindow getActiveWorkbenchWindow()
     {
         return getDefault().getWorkbench().getActiveWorkbenchWindow();