Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2011-05-18 08:34:13 +0000
committerHenrik Rentz-Reichert2011-05-18 08:34:13 +0000
commit33819dd00e9869881552c4ec434fa251e69b9f6a (patch)
treead917f6a99bf981d0d89c0b9c04a1e26bd82c2cb
parente4627398b000d125bca7aee84e12f9261e2bb223 (diff)
downloadorg.eclipse.etrice-33819dd00e9869881552c4ec434fa251e69b9f6a.tar.gz
org.eclipse.etrice-33819dd00e9869881552c4ec434fa251e69b9f6a.tar.xz
org.eclipse.etrice-33819dd00e9869881552c4ec434fa251e69b9f6a.zip
[ui.structure] 345731: use OperationCancelledException to cancel
Graphiti Features https://bugs.eclipse.org/bugs/show_bug.cgi?id=345731 using haveDoneChanges() everywhere, no exception needed anymore
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/DiagramTypeProvider.java33
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/ActorContainerRefSupport.java10
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SPPSupport.java12
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/StructureClassSupport.java2
4 files changed, 53 insertions, 4 deletions
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/DiagramTypeProvider.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/DiagramTypeProvider.java
index 190a774a2..3c3f3d5a2 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/DiagramTypeProvider.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/DiagramTypeProvider.java
@@ -12,8 +12,12 @@
package org.eclipse.etrice.ui.structure;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.etrice.core.ui.RoomUiModule;
import org.eclipse.graphiti.dt.AbstractDiagramTypeProvider;
+import org.eclipse.graphiti.internal.GraphitiPlugin;
+import org.eclipse.graphiti.internal.pref.GFPreferences;
import org.eclipse.graphiti.tb.IToolBehaviorProvider;
import org.eclipse.xtext.scoping.IScopeProvider;
@@ -28,6 +32,7 @@ public class DiagramTypeProvider extends AbstractDiagramTypeProvider {
@Inject
private IScopeProvider scopeProvider;
+ @SuppressWarnings("restriction")
public DiagramTypeProvider() {
super();
@@ -36,6 +41,10 @@ public class DiagramTypeProvider extends AbstractDiagramTypeProvider {
dispatcher = new ProviderDispatcher(this);
setFeatureProvider(dispatcher.getFeatureProvider());
+
+ IEclipsePreferences node = new DefaultScope().getNode(GraphitiPlugin.PLUGIN_ID);
+ if (node!=null)
+ node.putBoolean(GFPreferences.RECURSIVE_CHECK_FOR_UPDATE_ACTIVE, true);
}
@Override
@@ -48,6 +57,30 @@ public class DiagramTypeProvider extends AbstractDiagramTypeProvider {
return toolBehaviorProviders;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.graphiti.dt.AbstractDiagramTypeProvider#isAutoUpdateAtStartup()
+ */
+ @Override
+ public boolean isAutoUpdateAtStartup() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.graphiti.dt.AbstractDiagramTypeProvider#isAutoUpdateAtReset()
+ */
+ @Override
+ public boolean isAutoUpdateAtReset() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.graphiti.dt.AbstractDiagramTypeProvider#isAutoUpdateAtRuntime()
+ */
+ @Override
+ public boolean isAutoUpdateAtRuntime() {
+ return true;
+ }
+
public IScopeProvider getScopeProvider() {
return scopeProvider;
}
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/ActorContainerRefSupport.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/ActorContainerRefSupport.java
index a6d9dd9ae..2754e9bd5 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/ActorContainerRefSupport.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/ActorContainerRefSupport.java
@@ -353,6 +353,8 @@ public class ActorContainerRefSupport {
private static class PropertyFeature extends AbstractCustomFeature {
+ private boolean doneChanges = false;
+
public PropertyFeature(IFeatureProvider fp) {
super(fp);
}
@@ -391,11 +393,17 @@ public class ActorContainerRefSupport {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
ActorContainerRefPropertyDialog dlg = new ActorContainerRefPropertyDialog(shell, acr, scope, sc, false);
if (dlg.open()!=Window.OK)
- throw new RuntimeException();
+ return;
+ doneChanges = true;
updateLabel(acr, context.getPictogramElements()[0]);
}
+ @Override
+ public boolean hasDoneChanges() {
+ return doneChanges;
+ }
+
}
private static class OpenRefStructureDiagram extends AbstractCustomFeature {
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SPPSupport.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SPPSupport.java
index 29dbeea54..50f0c544f 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SPPSupport.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SPPSupport.java
@@ -135,6 +135,8 @@ public class SPPSupport extends InterfaceItemSupport {
private static class PropertyFeature extends InterfaceItemSupport.FeatureProvider.PropertyFeature {
+ private boolean doneChanges = false;
+
public PropertyFeature(IFeatureProvider fp) {
super(fp, "Edit SPP...", "Edit SPP Properties");
}
@@ -163,13 +165,17 @@ public class SPPSupport extends InterfaceItemSupport {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
SPPPropertyDialog dlg = new SPPPropertyDialog(shell, spp, scope, acc, false, refport);
if (dlg.open()!=Window.OK)
- // TODOHRR: introduce a method to revert changes, does hasDoneChanges=false roll back changes?
- throw new RuntimeException();
- //return;
+ return;
+ doneChanges = true;
updateSPPFigure(spp, context.getPictogramElements()[0], manageColor(DARK_COLOR), manageColor(BRIGHT_COLOR));
}
+ @Override
+ public boolean hasDoneChanges() {
+ return doneChanges;
+ }
+
}
private class UpdateFeature extends InterfaceItemSupport.FeatureProvider.UpdateFeature {
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/StructureClassSupport.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/StructureClassSupport.java
index a112fa264..59553576c 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/StructureClassSupport.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/StructureClassSupport.java
@@ -297,6 +297,8 @@ public class StructureClassSupport {
@Override
public boolean update(IUpdateContext context) {
ContainerShape containerShape = (ContainerShape)context.getPictogramElement();
+ if (containerShape instanceof Diagram)
+ containerShape = (ContainerShape) containerShape.getChildren().get(0);
Object bo = getBusinessObjectForPictogramElement(containerShape);
if (bo instanceof EObject && ((EObject)bo).eIsProxy()) {
IRemoveContext rc = new RemoveContext(containerShape);

Back to the top