summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJayant Gupta2013-11-01 13:28:56 (EDT)
committerJayant Gupta2013-11-01 13:28:56 (EDT)
commit47de5978b98de5f8b479d41b8104584a0db5a35e (patch)
treefd9e2d81611a25981edc27c629de3f9e8e644601
parentec0a37ccd1e3515f8317561d0059ee4fbccaffe1 (diff)
downloadorg.eclipse.etrice-47de5978b98de5f8b479d41b8104584a0db5a35e.zip
org.eclipse.etrice-47de5978b98de5f8b479d41b8104584a0db5a35e.tar.gz
org.eclipse.etrice-47de5978b98de5f8b479d41b8104584a0db5a35e.tar.bz2
Solves unresolved issues for Quick Fixes in State Chart Diagrams.refs/changes/70/17970/1
1. Removes multiple diagnostics for same Issues. 2. (by-virtue-of 1) Corrects duplication of Issues in Quick Fix Dialog. 3. Corrects visibility of labels on first invocation of the Dialog. 4. Extracts Quick Fix Feature as common to all Feature Providers. 5. Invokes properties dialogs independent of the Property Feature. 6. Adds Quick Fix Icon for context menu entry. Change-Id: I41673d06f531d5af833c1ec76dcf7c997b31b05d Signed-off-by: Jayant Gupta <gsocjayant@gmail.com>
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/icons/quickfix/error.gifbin1765 -> 0 bytes
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/icons/quickfix/information.gifbin267 -> 0 bytes
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/icons/quickfix/warning.gifbin219 -> 0 bytes
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/Activator.java2
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/ImageProvider.java2
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/StatePropertyDialog.java94
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TransitionPropertyDialog.java14
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/markers/DiagnosingModelObserver.java23
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/quickfix/BehaviorQuickfixProvider.java154
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/QuickFixFeature.java91
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateGraphSupport.java73
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java114
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java74
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TransitionSupport.java96
14 files changed, 247 insertions, 490 deletions
diff --git a/plugins/org.eclipse.etrice.ui.behavior/icons/quickfix/error.gif b/plugins/org.eclipse.etrice.ui.behavior/icons/quickfix/error.gif
deleted file mode 100644
index d2fc32e..0000000
--- a/plugins/org.eclipse.etrice.ui.behavior/icons/quickfix/error.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.etrice.ui.behavior/icons/quickfix/information.gif b/plugins/org.eclipse.etrice.ui.behavior/icons/quickfix/information.gif
deleted file mode 100644
index 3679f84..0000000
--- a/plugins/org.eclipse.etrice.ui.behavior/icons/quickfix/information.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.etrice.ui.behavior/icons/quickfix/warning.gif b/plugins/org.eclipse.etrice.ui.behavior/icons/quickfix/warning.gif
deleted file mode 100644
index a01bb24..0000000
--- a/plugins/org.eclipse.etrice.ui.behavior/icons/quickfix/warning.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/Activator.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/Activator.java
index 25ee68d..13c8d7b 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/Activator.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/Activator.java
@@ -77,7 +77,7 @@ public class Activator extends AbstractUIPlugin {
System.err.println("image not found: "+path);
else {
getDefault().getImageRegistry().put(path, desc);
- getDefault().getImageRegistry().get(path);
+ img = getDefault().getImageRegistry().get(path);
}
}
return img;
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/ImageProvider.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/ImageProvider.java
index 37af0b3..fb8134d 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/ImageProvider.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/ImageProvider.java
@@ -27,6 +27,7 @@ public class ImageProvider extends AbstractImageProvider {
public static final String IMG_CP = PREFIX + "cp";
public static final String IMG_INITIAL = PREFIX + "initial";
public static final String IMG_TRANSITION = PREFIX + "transition";
+ public static final String IMG_QUICKFIX = PREFIX + "quickfix";
@Override
protected void addAvailableImages() {
@@ -37,6 +38,7 @@ public class ImageProvider extends AbstractImageProvider {
addImageFilePath(IMG_INITIAL, "icons/InitialPoint.gif");
addImageFilePath(IMG_CP, "icons/ChoicePoint.gif");
addImageFilePath(IMG_TRANSITION, "icons/Transition.gif");
+ addImageFilePath(IMG_QUICKFIX, "icons/quickfix/quickassist.gif");
}
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/StatePropertyDialog.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/StatePropertyDialog.java
index b477490..dc1eaa4 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/StatePropertyDialog.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/StatePropertyDialog.java
@@ -1,5 +1,7 @@
package org.eclipse.etrice.ui.behavior.dialogs;
+import java.util.EnumSet;
+
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.databinding.validation.ValidationStatus;
@@ -43,10 +45,20 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog {
private State state;
private boolean inherited;
+ /**
+ * Enum for quickfix. Used when {@link StatePropertyDialog} is invoked from
+ * {@link QuickFixDialog}.
+ *
+ * @author jayant
+ *
+ */
+ public enum Where {
+ ENTRY, EXIT, DO
+ }
+
private boolean addCode = false;
- private String entryCodeSelectionString = "";
- private String exitCodeSelectionString = "";
- private String doCodeSelectionString = "";
+ private String codeSelectionString = "";
+ private EnumSet<Where> where = EnumSet.noneOf(Where.class);
private String messageToDisplay = "";
private String messageTitle = "";
@@ -76,6 +88,9 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog {
name.setFocus();
name.selectAll();
+
+ if (!where.isEmpty())
+ name.setEnabled(false);
}
else {
createFixedText(body, "Name:", state.getName(), false);
@@ -92,10 +107,12 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog {
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 100;
entry.setLayoutData(gd);
-
- if (addCode && !entryCodeSelectionString.isEmpty())
- entry.append(entryCodeSelectionString + "();\n");
- setTextSelectionAndFocus(entry, entryCodeSelectionString);
+
+ if (where.contains(Where.ENTRY)) {
+ if (addCode)
+ entry.append(codeSelectionString + "();\n");
+ setTextSelectionAndFocus(entry, codeSelectionString);
+ }
}
else {
if (state instanceof RefinedState)
@@ -106,9 +123,11 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog {
gd.heightHint = 100;
entry.setLayoutData(gd);
- if (addCode && !entryCodeSelectionString.isEmpty())
- entry.append(entryCodeSelectionString + "();\n");
- setTextSelectionAndFocus(entry, entryCodeSelectionString);
+ if (where.contains(Where.ENTRY)) {
+ if (addCode)
+ entry.append(codeSelectionString + "();\n");
+ setTextSelectionAndFocus(entry, codeSelectionString);
+ }
}
{
@@ -118,9 +137,11 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog {
gd.heightHint = 100;
entry.setLayoutData(gd);
- if (addCode && !entryCodeSelectionString.isEmpty())
- entry.append(entryCodeSelectionString + "();\n");
- setTextSelectionAndFocus(entry, entryCodeSelectionString);
+ if (where.contains(Where.ENTRY)) {
+ if (addCode)
+ entry.append(codeSelectionString + "();\n");
+ setTextSelectionAndFocus(entry, codeSelectionString);
+ }
}
}
@@ -133,9 +154,11 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog {
gd.heightHint = 100;
entry.setLayoutData(gd);
- if (addCode && !exitCodeSelectionString.isEmpty())
- entry.append(exitCodeSelectionString + "();\n");
- setTextSelectionAndFocus(entry, exitCodeSelectionString);
+ if (where.contains(Where.EXIT)) {
+ if (addCode)
+ entry.append(codeSelectionString + "();\n");
+ setTextSelectionAndFocus(entry, codeSelectionString);
+ }
}
else {
{
@@ -145,9 +168,11 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog {
gd.heightHint = 100;
exit.setLayoutData(gd);
- if (addCode && !exitCodeSelectionString.isEmpty())
- exit.append(exitCodeSelectionString + "();\n");
- setTextSelectionAndFocus(exit, exitCodeSelectionString);
+ if (where.contains(Where.EXIT)) {
+ if (addCode)
+ exit.append(codeSelectionString + "();\n");
+ setTextSelectionAndFocus(exit, codeSelectionString);
+ }
}
if (state instanceof RefinedState)
@@ -158,9 +183,11 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog {
gd.heightHint = 100;
entry.setLayoutData(gd);
- if (addCode && !exitCodeSelectionString.isEmpty())
- entry.append(exitCodeSelectionString + "();\n");
- setTextSelectionAndFocus(entry, exitCodeSelectionString);
+ if (where.contains(Where.EXIT)) {
+ if (addCode)
+ entry.append(codeSelectionString + "();\n");
+ setTextSelectionAndFocus(entry, codeSelectionString);
+ }
}
}
@@ -173,9 +200,11 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog {
gd.heightHint = 100;
dotxt.setLayoutData(gd);
- if (addCode && !doCodeSelectionString.isEmpty())
- dotxt.append(doCodeSelectionString + "();\n");
- setTextSelectionAndFocus(dotxt, doCodeSelectionString);
+ if (where.contains(Where.DO)) {
+ if (addCode)
+ dotxt.append(codeSelectionString + "();\n");
+ setTextSelectionAndFocus(dotxt, codeSelectionString);
+ }
}
createMembersAndMessagesButtons(body);
@@ -194,20 +223,13 @@ public class StatePropertyDialog extends AbstractMemberAwarePropertyDialog {
addCode = add;
}
- public void setEntryCodeSelectionString(String selectionString) {
- entryCodeSelectionString = selectionString;
- }
-
- public void setExitCodeSelectionString(String selectionString) {
- exitCodeSelectionString = selectionString;
- }
-
- public void setDoCodeSelectionString(String selectionString) {
- doCodeSelectionString = selectionString;
+ public void setCodeSelectionString(String selectionString, EnumSet<Where> where) {
+ this.where = where;
+ codeSelectionString = selectionString;
}
public void setMessageDialogContents(String message, String title) {
messageToDisplay = message;
- messageTitle = title;
+ messageTitle = title;
}
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TransitionPropertyDialog.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TransitionPropertyDialog.java
index 84c8d30..9d13d37 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TransitionPropertyDialog.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TransitionPropertyDialog.java
@@ -185,7 +185,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
private boolean triggerError = false;
private boolean inherited;
private RefinedTransition refined;
- private String actionCodeSelectionString = "";
+ private String codeSelectionString = "";
private String messageToDisplay = "";
private String messageTitle = "";
@@ -244,6 +244,8 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
name.selectAll();
name.setFocus();
+ if (!codeSelectionString.isEmpty())
+ name.setEnabled(false);
}
}
@@ -309,7 +311,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
String code = RoomHelpers.getInheritedActionCode(trans, getActorClass());
if (code!=null){
Text baseActionCode = createFixedText(body, "Base Action Code:", code, true);
- setTextSelectionAndFocus(baseActionCode, actionCodeSelectionString);
+ setTextSelectionAndFocus(baseActionCode, codeSelectionString);
}
}
@@ -320,7 +322,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 100;
action.setLayoutData(gd);
- setTextSelectionAndFocus(action, actionCodeSelectionString);
+ setTextSelectionAndFocus(action, codeSelectionString);
}
}
else
@@ -330,7 +332,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 100;
action.setLayoutData(gd);
- setTextSelectionAndFocus(action, actionCodeSelectionString);
+ setTextSelectionAndFocus(action, codeSelectionString);
}
createMembersAndMessagesButtons(body);
@@ -769,8 +771,8 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
}
}
- public void setActionCodeSelectionString(String selectionString){
- this.actionCodeSelectionString = selectionString;
+ public void setCodeSelectionString(String selectionString){
+ this.codeSelectionString = selectionString;
}
public void setMessageDialogContents(String message, String title) {
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/markers/DiagnosingModelObserver.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/markers/DiagnosingModelObserver.java
index 86084ee..a6349b7 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/markers/DiagnosingModelObserver.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/markers/DiagnosingModelObserver.java
@@ -14,6 +14,7 @@ package org.eclipse.etrice.ui.behavior.markers;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import org.eclipse.emf.common.notify.Notification;
@@ -110,6 +111,10 @@ public class DiagnosingModelObserver extends EContentAdapter {
// Perform Model Validation and get the diagnostic
Diagnostic diagnostics = Diagnostician.INSTANCE.validate(roomModel);
+ // A local HashMap for ensuring uniqueness of diagnostics
+ HashMap<EObject, HashSet<String>> uniqueEnsurer = new HashMap<EObject, HashSet<String>>();
+ uniqueEnsurer.clear();
+
// Inspect each child diagnostic
for (Diagnostic diagnostic : diagnostics.getChildren()) {
@@ -133,17 +138,23 @@ public class DiagnosingModelObserver extends EContentAdapter {
eObject = source.eContainer();
else
eObject = source;
-
+
if (eObject != null) {
// Add diagnostic to elementDiagnosticMap keyed on model element
- if (elementDiagnosticMap.get(eObject) == null)
+ if (elementDiagnosticMap.get(eObject) == null){
elementDiagnosticMap.put(eObject,
new ArrayList<Diagnostic>());
+ uniqueEnsurer.put(eObject, new HashSet<String>());
+ }
- // FIXME Some Diagnostics are added Multiple times. Remove
- // duplicate diagnostics. This is the reason for multiple
- // entries for same issue in Quick Fix Dialog.
- elementDiagnosticMap.get(eObject).add(diagnostic);
+ //Insert only if the Diagnostic reports a new error/warning
+ String certificate = featureBasedDiagnostic.getIssueCode();
+ for(String data : featureBasedDiagnostic.getIssueData())
+ certificate += data;
+ if (!(uniqueEnsurer.get(eObject).contains(certificate))){
+ uniqueEnsurer.get(eObject).add(certificate);
+ elementDiagnosticMap.get(eObject).add(diagnostic);
+ }
}
}
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/quickfix/BehaviorQuickfixProvider.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/quickfix/BehaviorQuickfixProvider.java
index f990b3c..5cdaed3 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/quickfix/BehaviorQuickfixProvider.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/quickfix/BehaviorQuickfixProvider.java
@@ -13,6 +13,7 @@
package org.eclipse.etrice.ui.behavior.quickfix;
+import java.util.EnumSet;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
@@ -31,27 +32,26 @@ import org.eclipse.etrice.core.room.TransitionTerminal;
import org.eclipse.etrice.core.room.Trigger;
import org.eclipse.etrice.core.room.TriggeredTransition;
import org.eclipse.etrice.core.room.util.RoomHelpers;
-import org.eclipse.etrice.ui.behavior.support.StateSupport.FeatureProvider.PropertyFeature;
+import org.eclipse.etrice.ui.behavior.dialogs.StatePropertyDialog;
+import org.eclipse.etrice.ui.behavior.dialogs.StatePropertyDialog.Where;
+import org.eclipse.etrice.ui.behavior.dialogs.TransitionPropertyDialog;
import org.eclipse.etrice.ui.behavior.support.SupportUtil;
-import org.eclipse.etrice.ui.behavior.support.TransitionSupport;
import org.eclipse.etrice.ui.common.quickfix.AbstractQuickfixProvider;
import org.eclipse.etrice.ui.common.quickfix.IDiagramModification;
import org.eclipse.etrice.ui.common.quickfix.IssueResolutionAcceptor;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.IRemoveFeature;
-import org.eclipse.graphiti.features.context.ICustomContext;
import org.eclipse.graphiti.features.context.IRemoveContext;
import org.eclipse.graphiti.features.context.impl.AddConnectionContext;
-import org.eclipse.graphiti.features.context.impl.CustomContext;
import org.eclipse.graphiti.features.context.impl.RemoveContext;
import org.eclipse.graphiti.features.context.impl.UpdateContext;
-import org.eclipse.graphiti.features.custom.ICustomFeature;
import org.eclipse.graphiti.mm.pictograms.Anchor;
import org.eclipse.graphiti.mm.pictograms.ContainerShape;
import org.eclipse.graphiti.mm.pictograms.Diagram;
import org.eclipse.graphiti.mm.pictograms.PictogramElement;
import org.eclipse.graphiti.services.Graphiti;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.xtext.ui.editor.quickfix.Fix;
@@ -195,31 +195,21 @@ public class BehaviorQuickfixProvider extends AbstractQuickfixProvider {
// unexpected
return false;
- // Open StatePropertyDialog, add line, select added
- // line
- PropertyFeature propertyFeature = null;
- ICustomContext customContext = new CustomContext(pes
- .toArray(new PictogramElement[pes.size()]));
- ICustomFeature features[] = fp
- .getCustomFeatures(customContext);
- for (ICustomFeature feature : features) {
- if (feature instanceof PropertyFeature) {
- propertyFeature = (PropertyFeature) feature;
- break;
- }
- }
- if (propertyFeature != null) {
- propertyFeature
- .setEntryCodeSelectionString(codeString);
- propertyFeature.setAddCode(true);
- propertyFeature
- .setMessageDialogContents(
- "Please complete the code with the newly inserted and highlighted fragment.",
- "Quick Fix");
- propertyFeature.execute(customContext);
- return propertyFeature.hasDoneChanges();
+ // Open StatePropertyDialog, add line, select added line
+ ActorClass ac = SupportUtil.getActorClass(diagram);
+ Shell shell = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell();
+ StatePropertyDialog dlg = new StatePropertyDialog(
+ shell, ac, state, true);
+ dlg.setCodeSelectionString(codeString,
+ EnumSet.of(Where.ENTRY));
+ dlg.setAddCode(true);
+ dlg.setMessageDialogContents(
+ "Please complete the code with the newly inserted and highlighted fragment.",
+ "Quick Fix");
+ if (dlg.open() == Window.OK) {
+ return true;
}
-
return false;
}
});
@@ -249,31 +239,21 @@ public class BehaviorQuickfixProvider extends AbstractQuickfixProvider {
// unexpected
return false;
- // Open StatePropertyDialog, add line & select added
- // line
- PropertyFeature propertyFeature = null;
- ICustomContext customContext = new CustomContext(pes
- .toArray(new PictogramElement[pes.size()]));
- ICustomFeature features[] = fp
- .getCustomFeatures(customContext);
- for (ICustomFeature feature : features) {
- if (feature instanceof PropertyFeature) {
- propertyFeature = (PropertyFeature) feature;
- break;
- }
- }
- if (propertyFeature != null) {
- propertyFeature
- .setExitCodeSelectionString(codeString);
- propertyFeature.setAddCode(true);
- propertyFeature
- .setMessageDialogContents(
- "Please complete the code with the newly inserted and highlighted fragment.",
- "Quick Fix");
- propertyFeature.execute(customContext);
- return propertyFeature.hasDoneChanges();
+ // Open StatePropertyDialog, add line, select added line
+ ActorClass ac = SupportUtil.getActorClass(diagram);
+ Shell shell = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell();
+ StatePropertyDialog dlg = new StatePropertyDialog(
+ shell, ac, state, true);
+ dlg.setCodeSelectionString(codeString,
+ EnumSet.of(Where.EXIT));
+ dlg.setAddCode(true);
+ dlg.setMessageDialogContents(
+ "Please complete the code with the newly inserted and highlighted fragment.",
+ "Quick Fix");
+ if (dlg.open() == Window.OK) {
+ return true;
}
-
return false;
}
});
@@ -405,31 +385,20 @@ public class BehaviorQuickfixProvider extends AbstractQuickfixProvider {
// Open StatePropertyDialog & select the offending
// code
- PropertyFeature propertyFeature = null;
- ICustomContext customContext = new CustomContext(
- pes.toArray(new PictogramElement[pes.size()]));
- ICustomFeature features[] = fp
- .getCustomFeatures(customContext);
- for (ICustomFeature feature : features) {
- if (feature instanceof PropertyFeature) {
- propertyFeature = (PropertyFeature) feature;
- break;
- }
- }
- if (propertyFeature != null) {
- propertyFeature
- .setEntryCodeSelectionString(codeString);
- propertyFeature
- .setExitCodeSelectionString(codeString);
- propertyFeature
- .setDoCodeSelectionString(codeString);
- propertyFeature
- .setMessageDialogContents(
- "Please remove the highlighted code after inspection.",
- "Quick Fix");
- propertyFeature.execute(customContext);
- return propertyFeature.hasDoneChanges();
+ ActorClass ac = SupportUtil.getActorClass(diagram);
+ Shell shell = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell();
+ StatePropertyDialog dlg = new StatePropertyDialog(
+ shell, ac, state, true);
+ dlg.setCodeSelectionString(codeString, EnumSet.of(
+ Where.ENTRY, Where.EXIT, Where.DO));
+ dlg.setMessageDialogContents(
+ "Please remove the highlighted code after inspection.",
+ "Quick Fix");
+ if (dlg.open() == Window.OK) {
+ return true;
}
+ return false;
} else if (obj instanceof Transition
|| obj instanceof Trigger) {
@@ -449,26 +418,17 @@ public class BehaviorQuickfixProvider extends AbstractQuickfixProvider {
// Open TransitionPropertyDialog & select the
// offending piece of code
- TransitionSupport.FeatureProvider.PropertyFeature propertyFeature = null;
- ICustomContext customContext = new CustomContext(
- pes.toArray(new PictogramElement[pes.size()]));
- ICustomFeature features[] = fp
- .getCustomFeatures(customContext);
- for (ICustomFeature feature : features) {
- if (feature instanceof TransitionSupport.FeatureProvider.PropertyFeature) {
- propertyFeature = (TransitionSupport.FeatureProvider.PropertyFeature) feature;
- break;
- }
- }
- if (propertyFeature != null) {
- propertyFeature
- .setActionCodeSelectionString(codeString);
- propertyFeature
- .setMessageDialogContents(
- "Please remove the highlighted code after inspection.",
- "Quick Fix");
- propertyFeature.execute(customContext);
- return propertyFeature.hasDoneChanges();
+ Shell shell = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell();
+ TransitionPropertyDialog dlg = new TransitionPropertyDialog(
+ shell, SupportUtil.getActorClass(diagram),
+ transition);
+ dlg.setCodeSelectionString(codeString);
+ dlg.setMessageDialogContents(
+ "Please remove the highlighted code after inspection.",
+ "Quick Fix");
+ if (dlg.open() == Window.OK) {
+ return true;
}
}
return false;
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/QuickFixFeature.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/QuickFixFeature.java
new file mode 100644
index 0000000..e395011
--- /dev/null
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/QuickFixFeature.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Jayant Gupta
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Jayant Gupta (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.ui.behavior.support;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.etrice.ui.behavior.ImageProvider;
+import org.eclipse.etrice.ui.behavior.dialogs.QuickFixDialog;
+import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor;
+import org.eclipse.etrice.ui.behavior.quickfix.BehaviorQuickfixProvider;
+import org.eclipse.etrice.ui.common.quickfix.IssueResolution;
+import org.eclipse.etrice.ui.common.support.ChangeAwareCustomFeature;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.xtext.validation.FeatureBasedDiagnostic;
+
+public class QuickFixFeature extends ChangeAwareCustomFeature {
+
+ public QuickFixFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ @Override
+ public String getName() {
+ return "Quick Fix";
+ }
+
+ @Override
+ public String getDescription() {
+ return "Apply Quick fixes";
+ }
+
+ @Override
+ public String getImageId() {
+ return ImageProvider.IMG_QUICKFIX;
+ }
+
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ return true;
+ }
+
+ @Override
+ public boolean doExecute(ICustomContext context) {
+
+ // Get the issue Resolutions Map
+ Object bo = getBusinessObjectForPictogramElement(context
+ .getPictogramElements()[0]);
+ ArrayList<Diagnostic> issues = ((BehaviorEditor) getDiagramBehavior()
+ .getDiagramContainer()).getDiagnosingModelObserver()
+ .getElementDiagonsticMap().get(bo);
+
+ HashMap<FeatureBasedDiagnostic, List<IssueResolution>> issueResolutionsMap = new HashMap<FeatureBasedDiagnostic, List<IssueResolution>>();
+ BehaviorQuickfixProvider behaviorQuickfixProvider = new BehaviorQuickfixProvider();
+ for (Diagnostic issue : issues) {
+ issueResolutionsMap.put((FeatureBasedDiagnostic) issue,
+ behaviorQuickfixProvider
+ .getResolutions((FeatureBasedDiagnostic) issue));
+ }
+
+ // Create & Open the Quick Fix Dialog
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell();
+ QuickFixDialog dlg = new QuickFixDialog(shell, issueResolutionsMap);
+
+ if (dlg.open() == Window.OK) {
+ Object[] result = dlg.getResult();
+ if (result != null)
+ return ((IssueResolution) result[0]).apply(getDiagram(),
+ getFeatureProvider());
+ }
+
+ return false;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateGraphSupport.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateGraphSupport.java
index bd0cf64..600dd15 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateGraphSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateGraphSupport.java
@@ -13,7 +13,6 @@
package org.eclipse.etrice.ui.behavior.support;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import org.eclipse.emf.common.util.Diagnostic;
@@ -26,11 +25,8 @@ import org.eclipse.etrice.core.room.StateGraph;
import org.eclipse.etrice.core.room.TrPoint;
import org.eclipse.etrice.core.room.Transition;
import org.eclipse.etrice.ui.behavior.commands.StateGraphContext;
-import org.eclipse.etrice.ui.behavior.dialogs.QuickFixDialog;
import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor;
import org.eclipse.etrice.ui.behavior.markers.DecoratorUtil;
-import org.eclipse.etrice.ui.behavior.quickfix.BehaviorQuickfixProvider;
-import org.eclipse.etrice.ui.common.quickfix.IssueResolution;
import org.eclipse.etrice.ui.common.support.DeleteWithoutConfirmFeature;
import org.eclipse.graphiti.dt.IDiagramTypeProvider;
import org.eclipse.graphiti.features.IAddFeature;
@@ -77,10 +73,6 @@ import org.eclipse.graphiti.tb.ImageDecorator;
import org.eclipse.graphiti.ui.features.DefaultFeatureProvider;
import org.eclipse.graphiti.util.ColorConstant;
import org.eclipse.graphiti.util.IColorConstant;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.xtext.validation.FeatureBasedDiagnostic;
public class StateGraphSupport {
@@ -531,70 +523,6 @@ public class StateGraphSupport {
}
}
- private static class QuickFixFeature extends AbstractCustomFeature {
-
- private boolean doneChanges = false;
-
- public QuickFixFeature(IFeatureProvider fp) {
- super(fp);
- }
-
- @Override
- public String getName() {
- return "Quick Fix";
- }
-
- @Override
- public String getDescription() {
- return "Apply Quick fixes";
- }
-
- @Override
- public boolean canExecute(ICustomContext context) {
- return true;
- }
-
- @Override
- public void execute(ICustomContext context) {
-
- // Get the issue Resolutions Map
- Object bo = getBusinessObjectForPictogramElement(context
- .getPictogramElements()[0]);
- ArrayList<Diagnostic> issues = ((BehaviorEditor) getDiagramBehavior()
- .getDiagramContainer()).getDiagnosingModelObserver()
- .getElementDiagonsticMap().get(bo);
-
- HashMap<FeatureBasedDiagnostic, List<IssueResolution>> issueResolutionsMap = new HashMap<FeatureBasedDiagnostic, List<IssueResolution>>();
- BehaviorQuickfixProvider behaviorQuickfixProvider = new BehaviorQuickfixProvider();
- for (Diagnostic issue : issues) {
- issueResolutionsMap
- .put((FeatureBasedDiagnostic) issue,
- behaviorQuickfixProvider
- .getResolutions((FeatureBasedDiagnostic) issue));
- }
-
- // Create & Open the Quick Fix Dialog
- Shell shell = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell();
- QuickFixDialog dlg = new QuickFixDialog(shell, issueResolutionsMap);
-
- if (dlg.open() != Window.OK)
- return;
-
- Object[] result = dlg.getResult();
- if (result == null)
- return;
- else{
- doneChanges = ((IssueResolution)result[0]).apply(getDiagram(), getFeatureProvider());
- }
- }
-
- @Override
- public boolean hasDoneChanges() {
- return doneChanges;
- }
- }
-
private IFeatureProvider fp;
public FeatureProvider(IDiagramTypeProvider dtp, IFeatureProvider fp) {
@@ -655,7 +583,6 @@ public class StateGraphSupport {
return result.toArray(features);
}
}
-
private class BehaviorProvider extends DefaultToolBehaviorProvider {
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java
index 149819f..cbec75c 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java
@@ -13,8 +13,6 @@
package org.eclipse.etrice.ui.behavior.support;
import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.ecore.EObject;
@@ -30,13 +28,10 @@ import org.eclipse.etrice.core.room.TrPoint;
import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.ui.behavior.ImageProvider;
import org.eclipse.etrice.ui.behavior.dialogs.StatePropertyDialog;
-import org.eclipse.etrice.ui.common.support.ChangeAwareCreateFeature;
-import org.eclipse.etrice.ui.common.support.ChangeAwareCustomFeature;
-import org.eclipse.etrice.ui.behavior.dialogs.QuickFixDialog;
import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor;
import org.eclipse.etrice.ui.behavior.markers.DecoratorUtil;
-import org.eclipse.etrice.ui.behavior.quickfix.BehaviorQuickfixProvider;
-import org.eclipse.etrice.ui.common.quickfix.IssueResolution;
+import org.eclipse.etrice.ui.common.support.ChangeAwareCreateFeature;
+import org.eclipse.etrice.ui.common.support.ChangeAwareCustomFeature;
import org.eclipse.etrice.ui.common.support.CommonSupportUtil;
import org.eclipse.etrice.ui.common.support.DeleteWithoutConfirmFeature;
import org.eclipse.graphiti.datatypes.IDimension;
@@ -105,7 +100,6 @@ import org.eclipse.graphiti.util.IColorConstant;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.xtext.validation.FeatureBasedDiagnostic;
public class StateSupport {
@@ -124,7 +118,7 @@ public class StateSupport {
private static final IColorConstant BACKGROUND = new ColorConstant(200, 200, 200);
private static final IColorConstant INHERITED_BACKGROUND = new ColorConstant(230, 230, 230);
- public static class FeatureProvider extends DefaultFeatureProvider {
+ private static class FeatureProvider extends DefaultFeatureProvider {
private class CreateFeature extends ChangeAwareCreateFeature {
@@ -330,17 +324,10 @@ public class StateSupport {
}
}
- public static class PropertyFeature extends ChangeAwareCustomFeature {
+ private static class PropertyFeature extends ChangeAwareCustomFeature {
private boolean editable;
- private boolean addCode = false;
- private String entryCodeSelectionString = "";
- private String exitCodeSelectionString = "";
- private String doCodeSelectionString = "";
- private String messageToDisplay = "";
- private String messageTitle = "";
-
public PropertyFeature(IFeatureProvider fp, boolean editable) {
super(fp);
@@ -376,12 +363,6 @@ public class StateSupport {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
StatePropertyDialog dlg = new StatePropertyDialog(shell, ac, s, editable);
- dlg.setAddCode(addCode);
- dlg.setEntryCodeSelectionString(entryCodeSelectionString);
- dlg.setExitCodeSelectionString(exitCodeSelectionString);
- dlg.setDoCodeSelectionString(doCodeSelectionString);
- dlg.setMessageDialogContents(messageToDisplay, messageTitle);
-
if (dlg.open()==Window.OK){
updateFigure(s, context);
adjustSubgraphLabels(s, ac);
@@ -433,27 +414,6 @@ public class StateSupport {
}
}
-
- public void setAddCode(boolean add) {
- addCode = add;
- }
-
- public void setEntryCodeSelectionString(String selectionString){
- entryCodeSelectionString = selectionString;
- }
-
- public void setExitCodeSelectionString(String selectionString){
- exitCodeSelectionString = selectionString;
- }
-
- public void setDoCodeSelectionString(String selectionString){
- doCodeSelectionString = selectionString;
- }
-
- public void setMessageDialogContents(String message, String title) {
- messageToDisplay = message;
- messageTitle = title;
- }
}
private static class GoDownFeature extends AbstractCustomFeature implements
@@ -881,70 +841,6 @@ public class StateSupport {
}
}
- private static class QuickFixFeature extends AbstractCustomFeature {
-
- private boolean doneChanges = false;
-
- public QuickFixFeature(IFeatureProvider fp) {
- super(fp);
- }
-
- @Override
- public String getName() {
- return "Quick Fix";
- }
-
- @Override
- public String getDescription() {
- return "Apply Quick fixes";
- }
-
- @Override
- public boolean canExecute(ICustomContext context) {
- return true;
- }
-
- @Override
- public void execute(ICustomContext context) {
-
- // Get the issue Resolutions Map
- Object bo = getBusinessObjectForPictogramElement(context
- .getPictogramElements()[0]);
- ArrayList<Diagnostic> issues = ((BehaviorEditor) getDiagramBehavior()
- .getDiagramContainer()).getDiagnosingModelObserver()
- .getElementDiagonsticMap().get(bo);
-
- HashMap<FeatureBasedDiagnostic, List<IssueResolution>> issueResolutionsMap = new HashMap<FeatureBasedDiagnostic, List<IssueResolution>>();
- BehaviorQuickfixProvider behaviorQuickfixProvider = new BehaviorQuickfixProvider();
- for (Diagnostic issue : issues) {
- issueResolutionsMap
- .put((FeatureBasedDiagnostic) issue,
- behaviorQuickfixProvider
- .getResolutions((FeatureBasedDiagnostic) issue));
- }
-
- // Create & Open the Quick Fix Dialog
- Shell shell = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell();
- QuickFixDialog dlg = new QuickFixDialog(shell, issueResolutionsMap);
-
- if (dlg.open() != Window.OK)
- return;
-
- Object[] result = dlg.getResult();
- if (result == null)
- return;
- else{
- doneChanges = ((IssueResolution)result[0]).apply(getDiagram(), getFeatureProvider());
- }
- }
-
- @Override
- public boolean hasDoneChanges() {
- return doneChanges;
- }
- }
-
private IFeatureProvider fp;
public FeatureProvider(IDiagramTypeProvider dtp, IFeatureProvider fp) {
@@ -1040,7 +936,7 @@ public class StateSupport {
.get(bo);
if (diagnostics != null)
result.add(new QuickFixFeature(fp));
-
+
ICustomFeature features[] = new ICustomFeature[result.size()];
return result.toArray(features);
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java
index cc1abd3..69595c4 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java
@@ -13,7 +13,6 @@
package org.eclipse.etrice.ui.behavior.support;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import org.eclipse.emf.common.util.Diagnostic;
@@ -31,14 +30,11 @@ import org.eclipse.etrice.core.room.TransitionPoint;
import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.core.validation.ValidationUtil;
import org.eclipse.etrice.ui.behavior.ImageProvider;
-import org.eclipse.etrice.ui.behavior.dialogs.QuickFixDialog;
import org.eclipse.etrice.ui.behavior.dialogs.TrPointPropertyDialog;
-import org.eclipse.etrice.ui.common.support.ChangeAwareCreateFeature;
-import org.eclipse.etrice.ui.common.support.ChangeAwareCustomFeature;
import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor;
import org.eclipse.etrice.ui.behavior.markers.DecoratorUtil;
-import org.eclipse.etrice.ui.behavior.quickfix.BehaviorQuickfixProvider;
-import org.eclipse.etrice.ui.common.quickfix.IssueResolution;
+import org.eclipse.etrice.ui.common.support.ChangeAwareCreateFeature;
+import org.eclipse.etrice.ui.common.support.ChangeAwareCustomFeature;
import org.eclipse.etrice.ui.common.support.CommonSupportUtil;
import org.eclipse.etrice.ui.common.support.DeleteWithoutConfirmFeature;
import org.eclipse.etrice.ui.common.support.NoResizeFeature;
@@ -68,7 +64,6 @@ import org.eclipse.graphiti.features.context.IUpdateContext;
import org.eclipse.graphiti.features.context.impl.AddContext;
import org.eclipse.graphiti.features.context.impl.CreateConnectionContext;
import org.eclipse.graphiti.features.context.impl.RemoveContext;
-import org.eclipse.graphiti.features.custom.AbstractCustomFeature;
import org.eclipse.graphiti.features.custom.ICustomFeature;
import org.eclipse.graphiti.features.impl.AbstractAddFeature;
import org.eclipse.graphiti.features.impl.AbstractUpdateFeature;
@@ -104,7 +99,6 @@ import org.eclipse.graphiti.util.IColorConstant;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.xtext.validation.FeatureBasedDiagnostic;
public class TrPointSupport {
@@ -698,70 +692,6 @@ public class TrPointSupport {
}
}
- private static class QuickFixFeature extends AbstractCustomFeature {
-
- private boolean doneChanges = false;
-
- public QuickFixFeature(IFeatureProvider fp) {
- super(fp);
- }
-
- @Override
- public String getName() {
- return "Quick Fix";
- }
-
- @Override
- public String getDescription() {
- return "Apply Quick fixes";
- }
-
- @Override
- public boolean canExecute(ICustomContext context) {
- return true;
- }
-
- @Override
- public void execute(ICustomContext context) {
-
- // Get the issue Resolutions Map
- Object bo = getBusinessObjectForPictogramElement(context
- .getPictogramElements()[0]);
- ArrayList<Diagnostic> issues = ((BehaviorEditor) getDiagramBehavior()
- .getDiagramContainer()).getDiagnosingModelObserver()
- .getElementDiagonsticMap().get(bo);
-
- HashMap<FeatureBasedDiagnostic, List<IssueResolution>> issueResolutionsMap = new HashMap<FeatureBasedDiagnostic, List<IssueResolution>>();
- BehaviorQuickfixProvider behaviorQuickfixProvider = new BehaviorQuickfixProvider();
- for (Diagnostic issue : issues) {
- issueResolutionsMap
- .put((FeatureBasedDiagnostic) issue,
- behaviorQuickfixProvider
- .getResolutions((FeatureBasedDiagnostic) issue));
- }
-
- // Create & Open the Quick Fix Dialog
- Shell shell = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell();
- QuickFixDialog dlg = new QuickFixDialog(shell, issueResolutionsMap);
-
- if (dlg.open() != Window.OK)
- return;
-
- Object[] result = dlg.getResult();
- if (result == null)
- return;
- else{
- doneChanges = ((IssueResolution)result[0]).apply(getDiagram(), getFeatureProvider());
- }
- }
-
- @Override
- public boolean hasDoneChanges() {
- return doneChanges;
- }
- }
-
protected IFeatureProvider fp;
protected FeatureProvider(IDiagramTypeProvider dtp, IFeatureProvider fp) {
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TransitionSupport.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TransitionSupport.java
index 99656c5..afcd606 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TransitionSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TransitionSupport.java
@@ -13,8 +13,6 @@
package org.eclipse.etrice.ui.behavior.support;
import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.ecore.EObject;
@@ -40,15 +38,12 @@ import org.eclipse.etrice.core.room.TriggeredTransition;
import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.core.validation.ValidationUtil;
import org.eclipse.etrice.ui.behavior.ImageProvider;
-import org.eclipse.etrice.ui.behavior.dialogs.QuickFixDialog;
import org.eclipse.etrice.ui.behavior.dialogs.TransitionPropertyDialog;
+import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor;
+import org.eclipse.etrice.ui.behavior.markers.DecoratorUtil;
import org.eclipse.etrice.ui.common.support.CantRemoveFeature;
import org.eclipse.etrice.ui.common.support.ChangeAwareCreateConnectionFeature;
import org.eclipse.etrice.ui.common.support.ChangeAwareCustomFeature;
-import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor;
-import org.eclipse.etrice.ui.behavior.markers.DecoratorUtil;
-import org.eclipse.etrice.ui.behavior.quickfix.BehaviorQuickfixProvider;
-import org.eclipse.etrice.ui.common.quickfix.IssueResolution;
import org.eclipse.etrice.ui.common.support.DeleteWithoutConfirmFeature;
import org.eclipse.graphiti.datatypes.ILocation;
import org.eclipse.graphiti.dt.IDiagramTypeProvider;
@@ -105,7 +100,6 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.xtext.validation.FeatureBasedDiagnostic;
public class TransitionSupport {
@@ -115,7 +109,7 @@ public class TransitionSupport {
private static final int LINE_WIDTH = 1;
private static final int MAX_LABEL_LENGTH = 20;
- public static class FeatureProvider extends DefaultFeatureProvider {
+ static class FeatureProvider extends DefaultFeatureProvider {
private class CreateFeature extends ChangeAwareCreateConnectionFeature {
@@ -587,12 +581,9 @@ public class TransitionSupport {
}
}
- public static class PropertyFeature extends ChangeAwareCustomFeature {
+ private static class PropertyFeature extends ChangeAwareCustomFeature {
private boolean editable;
- private String actionCodeSelectionString = "";
- private String messageToDisplay = "";
- private String messageTitle = "";
public PropertyFeature(IFeatureProvider fp, boolean editable) {
super(fp);
@@ -638,8 +629,6 @@ public class TransitionSupport {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
TransitionPropertyDialog dlg = new TransitionPropertyDialog(shell, SupportUtil.getActorClass(getDiagram()), trans);
- dlg.setActionCodeSelectionString(actionCodeSelectionString);
- dlg.setMessageDialogContents(messageToDisplay, messageTitle);
if (dlg.open()==Window.OK){
boolean inherited = SupportUtil.isInherited(getDiagram(), trans);
Color lineColor = inherited? manageColor(INHERITED_COLOR):manageColor(LINE_COLOR);
@@ -652,15 +641,6 @@ public class TransitionSupport {
return false;
}
-
- public void setActionCodeSelectionString(String selectionString){
- actionCodeSelectionString = selectionString;
- }
-
- public void setMessageDialogContents(String message, String title) {
- messageToDisplay = message;
- messageTitle = title;
- }
}
private static class RefineTransitionFeature extends AbstractCustomFeature {
@@ -752,70 +732,6 @@ public class TransitionSupport {
}
}
- private static class QuickFixFeature extends AbstractCustomFeature {
-
- private boolean doneChanges = false;
-
- public QuickFixFeature(IFeatureProvider fp) {
- super(fp);
- }
-
- @Override
- public String getName() {
- return "Quick Fix";
- }
-
- @Override
- public String getDescription() {
- return "Apply Quick fixes";
- }
-
- @Override
- public boolean canExecute(ICustomContext context) {
- return true;
- }
-
- @Override
- public void execute(ICustomContext context) {
-
- // Get the issue Resolutions Map
- Object bo = getBusinessObjectForPictogramElement(context
- .getPictogramElements()[0]);
- ArrayList<Diagnostic> issues = ((BehaviorEditor) getDiagramBehavior()
- .getDiagramContainer()).getDiagnosingModelObserver()
- .getElementDiagonsticMap().get(bo);
-
- HashMap<FeatureBasedDiagnostic, List<IssueResolution>> issueResolutionsMap = new HashMap<FeatureBasedDiagnostic, List<IssueResolution>>();
- BehaviorQuickfixProvider behaviorQuickfixProvider = new BehaviorQuickfixProvider();
- for (Diagnostic issue : issues) {
- issueResolutionsMap
- .put((FeatureBasedDiagnostic) issue,
- behaviorQuickfixProvider
- .getResolutions((FeatureBasedDiagnostic) issue));
- }
-
- // Create & Open the Quick Fix Dialog
- Shell shell = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell();
- QuickFixDialog dlg = new QuickFixDialog(shell, issueResolutionsMap);
-
- if (dlg.open() != Window.OK)
- return;
-
- Object[] result = dlg.getResult();
- if (result == null)
- return;
- else{
- doneChanges = ((IssueResolution)result[0]).apply(getDiagram(), getFeatureProvider());
- }
- }
-
- @Override
- public boolean hasDoneChanges() {
- return doneChanges;
- }
- }
-
private IFeatureProvider fp;
public FeatureProvider(IDiagramTypeProvider dtp, IFeatureProvider fp) {
@@ -882,7 +798,7 @@ public class TransitionSupport {
if (!editable)
result.add(new RefineTransitionFeature(fp));
}
-
+
// Provide quick fix feature only for those edit parts which have
// errors, warnings or infos.
ArrayList<Diagnostic> diagnostics = ((BehaviorEditor) getDiagramTypeProvider()
@@ -891,7 +807,7 @@ public class TransitionSupport {
.get(bo);
if (diagnostics != null)
result.add(new QuickFixFeature(fp));
-
+
ICustomFeature features[] = new ICustomFeature[result.size()];
return result.toArray(features);
}