diff options
author | Juergen Haug | 2015-07-28 18:30:06 +0000 |
---|---|---|
committer | Juergen Haug | 2015-07-30 12:36:59 +0000 |
commit | f50f5625b15b390db451e2c3261ba25bcd8fe012 (patch) | |
tree | e3dfca4ab41c0afdf4b1244d7f4c311a4eec1b1b /plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior | |
parent | 783c894f584934f5e6f96c1f2281468d2c70bbc6 (diff) | |
download | org.eclipse.etrice-f50f5625b15b390db451e2c3261ba25bcd8fe012.tar.gz org.eclipse.etrice-f50f5625b15b390db451e2c3261ba25bcd8fe012.tar.xz org.eclipse.etrice-f50f5625b15b390db451e2c3261ba25bcd8fe012.zip |
Bug 453716 - [ui.behavior] add context dependent behavior of action
editor
Change-Id: Ia934cffbea2b49461d5de71f2c13039f9000202a
Diffstat (limited to 'plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior')
5 files changed, 65 insertions, 34 deletions
diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/ActionCodeEditorRegistry.java b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/ActionCodeEditorRegistry.java index 6645d4b50..83dd12cf7 100644 --- a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/ActionCodeEditorRegistry.java +++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/ActionCodeEditorRegistry.java @@ -22,8 +22,8 @@ import org.eclipse.core.runtime.MultiStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.etrice.core.fsm.fSM.DetailCode; -import org.eclipse.etrice.core.fsm.fSM.ModelComponent; import org.eclipse.etrice.ui.behavior.fsm.Activator; +import org.eclipse.etrice.ui.behavior.fsm.detailcode.IDetailExpressionProvider; import org.eclipse.swt.widgets.Composite; /** @@ -106,14 +106,11 @@ public class ActionCodeEditorRegistry { * * @return the {@link IActionCodeEditor} instance or <code>null</code> */ - public IActionCodeEditor newActionCodeEditor(DetailCode detailCode, - Composite parent, ModelComponent mc, boolean useMembers, - boolean useMessages, boolean useRecvMessagesOnly) { + public IActionCodeEditor newActionCodeEditor(Composite parent, String text, IDetailExpressionProvider exprProvider) { IActionCodeEditorFactory factory = getFactory(); if (factory == null) return null; - return factory.createActionCodeEditor(detailCode, parent, mc, - useMembers, useMessages, useRecvMessagesOnly); + return factory.createActionCodeEditor(parent, text, exprProvider); } /** diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/IActionCodeEditor.java b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/IActionCodeEditor.java index 8da8e96d2..7ae1c91bf 100644 --- a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/IActionCodeEditor.java +++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/IActionCodeEditor.java @@ -13,7 +13,6 @@ package org.eclipse.etrice.ui.behavior.fsm.actioneditor; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; import org.eclipse.swt.widgets.Control; /** @@ -25,13 +24,6 @@ import org.eclipse.swt.widgets.Control; public interface IActionCodeEditor { /** - * Getter for the {@link DetailCode} object being represented by the editor. - * - * @return the DetailCode object associated with the editor instance - */ - DetailCode getDetailCode(); - - /** * Getter for the editor {@link Control} representing the Action Code. * * @return the Control within the editor diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/IActionCodeEditorFactory.java b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/IActionCodeEditorFactory.java index f3bd06e7d..74239e6a1 100644 --- a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/IActionCodeEditorFactory.java +++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/IActionCodeEditorFactory.java @@ -13,8 +13,7 @@ package org.eclipse.etrice.ui.behavior.fsm.actioneditor; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; -import org.eclipse.etrice.core.fsm.fSM.ModelComponent; +import org.eclipse.etrice.ui.behavior.fsm.detailcode.IDetailExpressionProvider; import org.eclipse.swt.widgets.Composite; /** @@ -28,23 +27,11 @@ public interface IActionCodeEditorFactory { * Create a new instance of an implementation of the * {@link IActionCodeEditor} with given configuration parameters. * - * @param detailCode - * the {@link DetailCode} object to be represented * @param parent * the {@link Composite} which will hold the editor - * @param ac - * the {@link ActorClass} class containing the detail Code - * @param useMembers - * true if the editor is to be member aware - * @param useMessages - * true if the editor is to be message aware - * @param useRecvMessagesOnly - * true if the editor is to use only receive only messages * @return the created instance of the action code editor. */ - IActionCodeEditor createActionCodeEditor(DetailCode detailCode, - Composite parent, ModelComponent ac, boolean useMembers, - boolean useMessages, boolean useRecvMessagesOnly); + IActionCodeEditor createActionCodeEditor(Composite parent, String detailCode, IDetailExpressionProvider exprProvider); /** * Disposes all the resources allocate by the factory. diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/detailcode/IDetailExpressionProvider.xtend b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/detailcode/IDetailExpressionProvider.xtend new file mode 100644 index 000000000..9db27e1db --- /dev/null +++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/detailcode/IDetailExpressionProvider.xtend @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2015 protos software gmbh (http://www.protos.de). + * All rights reserved. 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: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ + +package org.eclipse.etrice.ui.behavior.fsm.detailcode + +import java.util.List +import org.eclipse.xtend.lib.annotations.Accessors + +/** + * Defines detail expressions = <i>ExpressionFeature ('.' ExpressionFeature)* </i> + */ +interface IDetailExpressionProvider { + + static val char SEPARATOR = '.' + + /** + * A list of ExpressionFeatures, without preceding '.' and that can start a context + * @return not null + */ + def List<ExpressionFeature> getInitialFeatures() + + /** + * A list of ExpressionFeatures, that can follow ctx + * @param ctx having non-null entries + * @return not null + */ + def List<ExpressionFeature> getContextFeatures(ExpressionFeature ctx) + + /** + * ExpressionFeature = <i>id(postfix)?</i> with <i> postfix = '(' .* ')' | '[' .* ']' + */ + @Accessors // @Data + static class ExpressionFeature { + val String id + val ExpressionPostfix postfix + Object data + } + + enum ExpressionPostfix { + NONE, + PARENTHESES, + BRACKETS + } +} diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/dialogs/AbstractMemberAwarePropertyDialog.java b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/dialogs/AbstractMemberAwarePropertyDialog.java index 98e1bebd9..b2f2d5373 100644 --- a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/dialogs/AbstractMemberAwarePropertyDialog.java +++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/dialogs/AbstractMemberAwarePropertyDialog.java @@ -28,6 +28,8 @@ import org.eclipse.etrice.ui.behavior.fsm.actioneditor.ActionCodeEditorRegistry; import org.eclipse.etrice.ui.behavior.fsm.actioneditor.ActionCodeEditorRegistry.ActionCodeEditorRegistryEntry; import org.eclipse.etrice.ui.behavior.fsm.actioneditor.IActionCodeEditor; import org.eclipse.etrice.ui.behavior.fsm.actioneditor.preferences.PreferenceConstants; +import org.eclipse.etrice.ui.behavior.fsm.detailcode.IDetailExpressionProvider; +import org.eclipse.etrice.ui.behavior.fsm.support.FSMSupportUtil; import org.eclipse.etrice.ui.common.base.dialogs.AbstractPropertyDialog; import org.eclipse.etrice.ui.common.base.dialogs.MultiValidator2; import org.eclipse.jface.preference.IPreferenceStore; @@ -177,9 +179,9 @@ public abstract class AbstractMemberAwarePropertyDialog extends AbstractProperty */ protected IActionCodeEditor createActionCodeEditor(Composite parent, String label, DetailCode detailCode, EObject obj, - EStructuralFeature feat, IConverter s2m, IConverter m2s) { + EStructuralFeature feat, IConverter s2m, IConverter m2s, IDetailExpressionProvider exprPovider) { return createActionCodeEditor(parent, label, detailCode, obj, feat, - null, null, s2m, m2s, true, true, false); + null, null, s2m, m2s, true, true, false, exprPovider); } /** @@ -219,7 +221,7 @@ public abstract class AbstractMemberAwarePropertyDialog extends AbstractProperty String label, DetailCode detailCode, EObject obj, EStructuralFeature feat, IValidator singleValidator, MultiValidator2 multiValidator, IConverter s2m, IConverter m2s, - boolean useMembers, boolean useMessages, boolean useRecvMessagesOnly) { + boolean useMembers, boolean useMessages, boolean useRecvMessagesOnly, IDetailExpressionProvider exprPovider) { Label l = getToolkit().createLabel(parent, label, SWT.NONE); l.setLayoutData(new GridData(SWT.NONE)); @@ -237,8 +239,8 @@ public abstract class AbstractMemberAwarePropertyDialog extends AbstractProperty ActionCodeEditorRegistryEntry editorEntry = ActionCodeEditorRegistry.INSTANCE.getEditorWithId(id); if(editorEntry == null) return null; - IActionCodeEditor actionCodeEditor = editorEntry.newActionCodeEditor(detailCode, parent, - mc, useMembers, useMessages, useRecvMessagesOnly); + String editorText = FSMSupportUtil.getInstance().getFSMHelpers().getDetailCode(detailCode); + IActionCodeEditor actionCodeEditor = editorEntry.newActionCodeEditor(parent, editorText, exprPovider); if (actionCodeEditor != null) { configureMemberAwareness(actionCodeEditor, useMembers, useMessages, useRecvMessagesOnly); |