Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/customization')
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/EditContextAction.java35
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/RemoveContextAction.java29
2 files changed, 57 insertions, 7 deletions
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/EditContextAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/EditContextAction.java
index 7952664d377..6324af0db46 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/EditContextAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/EditContextAction.java
@@ -11,9 +11,17 @@
*****************************************************************************/
package org.eclipse.papyrus.customization.properties.ui;
+import java.lang.reflect.InvocationTargetException;
+
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.papyrus.customization.properties.Activator;
import org.eclipse.papyrus.customization.properties.util.ProjectUtil;
import org.eclipse.papyrus.views.properties.contexts.Context;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;
@@ -34,9 +42,30 @@ public class EditContextAction {
* @throws Exception
* If the context cannot be edited
*/
- public void openEditor(Context context) throws Exception {
- IFile contextFile = ProjectUtil.getContextFile(context);
+ public void openEditor(final Context context) {
+
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(Display.getCurrent().getActiveShell());
+ try {
+ dialog.run(false, false, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ monitor.beginTask("Opening the property view configuration: " + context.getName(), IProgressMonitor.UNKNOWN);
+ runOpenEditor(context);
+ monitor.done();
+ } catch (CoreException ex) {
+ Activator.log.error(ex);
+ }
+ }
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(new FileEditorInput(contextFile), "org.eclipse.papyrus.customization.properties.UIEditor", true); //$NON-NLS-1$
+ });
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+ protected void runOpenEditor(Context context) throws CoreException {
+ IFile contextFile = ProjectUtil.getContextFile(context);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(new FileEditorInput(contextFile), "org.eclipse.papyrus.customization.properties.UIEditor", true); //$NON-NLS-1$;
}
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/RemoveContextAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/RemoveContextAction.java
index 547ebd6e258..dbd5d32a44c 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/RemoveContextAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/RemoveContextAction.java
@@ -12,9 +12,15 @@
package org.eclipse.papyrus.customization.properties.ui;
import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.papyrus.customization.properties.Activator;
import org.eclipse.papyrus.views.properties.contexts.Context;
import org.eclipse.papyrus.views.properties.runtime.ConfigurationManager;
+import org.eclipse.swt.widgets.Display;
/**
* An action to delete an existing context. This action cannot be undone.
@@ -30,11 +36,25 @@ public class RemoveContextAction {
* @param sourceContext
* The context to delete
*/
- public void removeContext(Context sourceContext) {
+ public void removeContext(final Context sourceContext) {
//TODO : Close editors for the context being deleted
- File directory = new File(sourceContext.eResource().getURI().toFileString()).getParentFile();
- ConfigurationManager.instance.deleteContext(sourceContext);
- delete(directory);
+ final File directory = new File(sourceContext.eResource().getURI().toFileString()).getParentFile();
+
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(Display.getCurrent().getActiveShell());
+ try {
+ dialog.run(false, false, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ monitor.beginTask("Deleting the property view configuration: " + sourceContext.getName(), IProgressMonitor.UNKNOWN);
+ ConfigurationManager.instance.deleteContext(sourceContext);
+ delete(directory);
+ monitor.done();
+ }
+
+ });
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
}
/**
@@ -48,6 +68,7 @@ public class RemoveContextAction {
for(File subFile : file.listFiles()) {
delete(subFile);
}
+
}
file.delete();
}

Back to the top