diff options
Diffstat (limited to 'plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java')
-rw-r--r-- | plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java | 114 |
1 files changed, 5 insertions, 109 deletions
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 149819fe4..cbec75c3b 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); } |