Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2012-06-22 15:40:33 +0000
committerHenrik Rentz-Reichert2012-06-22 15:40:33 +0000
commita8f47d402d4e6497ed5c10fe30a7336bee8bc92a (patch)
treebbc974fc0a1b690a373b031d5f6515ba651306c3
parent67ea730b7137da07eaba3a6a1bfec74bbe0b3f8d (diff)
downloadorg.eclipse.etrice-a8f47d402d4e6497ed5c10fe30a7336bee8bc92a.tar.gz
org.eclipse.etrice-a8f47d402d4e6497ed5c10fe30a7336bee8bc92a.tar.xz
org.eclipse.etrice-a8f47d402d4e6497ed5c10fe30a7336bee8bc92a.zip
[ui.behavior, ui.common] bug 380309: Action functions of a derived actor will not be generated
https://bugs.eclipse.org/bugs/show_bug.cgi?id=380309 inherited transitions are read-only
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TransitionPropertyDialog.java47
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TransitionSupport.java17
-rw-r--r--plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/dialogs/AbstractPropertyDialog.java15
-rw-r--r--plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/editor/RoomDiagramEditor.java3
4 files changed, 49 insertions, 33 deletions
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 ec2894461..7cc24f81f 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
@@ -9,7 +9,6 @@ import org.eclipse.core.databinding.validation.ValidationStatus;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.CPBranchTransition;
@@ -22,7 +21,6 @@ import org.eclipse.etrice.core.room.Message;
import org.eclipse.etrice.core.room.MessageFromIf;
import org.eclipse.etrice.core.room.RoomFactory;
import org.eclipse.etrice.core.room.RoomPackage;
-import org.eclipse.etrice.core.room.StateGraph;
import org.eclipse.etrice.core.room.Transition;
import org.eclipse.etrice.core.room.Trigger;
import org.eclipse.etrice.core.room.TriggeredTransition;
@@ -51,6 +49,7 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
@@ -174,9 +173,10 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
private Text guardText;
private Button removeMifButton;
private boolean triggerError = false;
+ private boolean inherited;
- public TransitionPropertyDialog(Shell shell, StateGraph sg, Transition trans) {
- super(shell, "Edit Transition", getActorClass(sg));
+ public TransitionPropertyDialog(Shell shell, ActorClass ac, Transition trans) {
+ super(shell, "Edit Transition", ac);
this.trans = trans;
m2s = new DetailCodeToString();
@@ -184,19 +184,8 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
s2m = new StringToDetailCode();
s2m_not_null = new StringToDetailCode(false);
- interfaceItems = RoomHelpers.getAllInterfaceItems(getActorClass());
- }
-
- private static ActorClass getActorClass(StateGraph sg) {
- EObject obj = sg;
- while (obj!=null) {
- if (obj instanceof ActorClass) {
- return (ActorClass) obj;
-
- }
- obj = obj.eContainer();
- }
- return null;
+ interfaceItems = RoomHelpers.getAllInterfaceItems(ac);
+ inherited = RoomHelpers.getActorClass(trans)!=ac;
}
@Override
@@ -205,8 +194,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
}
@Override
- protected void createContent(IManagedForm mform, Composite body,
- DataBindingContext bindingContext) {
+ protected void createContent(IManagedForm mform, Composite body, DataBindingContext bindingContext) {
if (!(trans instanceof InitialTransition)) {
NameValidator nv = new NameValidator();
@@ -271,6 +259,17 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
}
createMembersAndMessagesButtons(body);
+
+ if (inherited)
+ disableAll(body);
+ }
+
+ private void disableAll(Composite parent) {
+ for (Control child : parent.getChildren()) {
+ child.setEnabled(false);
+ if (child instanceof Composite)
+ disableAll((Composite) child);
+ }
}
private boolean triggersAvailable() {
@@ -293,6 +292,10 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
ok = false;
setValidationText("no triggers available");
}
+ if (ok && inherited) {
+ ok = false;
+ setValidationText("inherited transition not editable");
+ }
super.updateValidationFeedback(ok);
}
@@ -315,7 +318,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
tableCompartment.setLayoutData(gd);
- Table triggerTable = toolkit.createTable(tableCompartment, SWT.NONE | SWT.SINGLE);
+ Table triggerTable = toolkit.createTable(tableCompartment, SWT.BORDER | SWT.SINGLE);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.heightHint = 50;
gd.widthHint = 100;
@@ -376,7 +379,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
tableCompartment.setLayoutData(gd);
- Table mifTable = toolkit.createTable(tableCompartment, SWT.NONE | SWT.SINGLE);
+ Table mifTable = toolkit.createTable(tableCompartment, SWT.BORDER | SWT.SINGLE);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.heightHint = 50;
gd.widthHint = 100;
@@ -665,7 +668,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
@Override
protected void createButtonsForButtonBar(Composite parent) {
super.createButtonsForButtonBar(parent);
- if (!triggersAvailable())
+ if (inherited || !triggersAvailable())
getButton(IDialogConstants.OK_ID).setEnabled(false);
}
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 6f452d387..27e7d2d83 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
@@ -202,7 +202,7 @@ public class TransitionSupport {
sg.getTransitions().add(trans);
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- TransitionPropertyDialog dlg = new TransitionPropertyDialog(shell, sg, trans);
+ TransitionPropertyDialog dlg = new TransitionPropertyDialog(shell, SupportUtil.getActorClass(getDiagram()), trans);
if (dlg.open()!=Window.OK) {
if (inherited) {
SupportUtil.undoInsertRefinedState(sg, ac, targetContainer, getFeatureProvider());
@@ -331,8 +331,8 @@ public class TransitionSupport {
if (!super.canReconnect(context))
return false;
- StateGraph sg = SupportUtil.getStateGraph((ContainerShape) context.getTargetPictogramElement().eContainer(), fp);
- boolean inherited = SupportUtil.isInherited(getDiagram(), sg);
+ Transition trans = (Transition) getBusinessObjectForPictogramElement(context.getConnection());
+ boolean inherited = SupportUtil.isInherited(getDiagram(), trans);
if (inherited)
return false;
@@ -343,7 +343,6 @@ public class TransitionSupport {
else
tgt = context.getNewAnchor();
- Transition trans = (Transition) getBusinessObjectForPictogramElement(context.getConnection());
return SupportUtil.canConnect(src, tgt, trans, (ContainerShape) context.getTargetPictogramElement().eContainer(), fp);
}
@@ -358,6 +357,7 @@ public class TransitionSupport {
// in the following we set source and target of the connection regardless of whether they have changed
// if the type of the transition changed we create a new one and open the property dialog
+ ActorClass ac = SupportUtil.getActorClass(getDiagram());
Transition orig = (Transition) getBusinessObjectForPictogramElement(context.getConnection());
Transition trans = null;
if (src==null) {
@@ -398,7 +398,6 @@ public class TransitionSupport {
trans = t;
}
else {
- ActorClass ac = SupportUtil.getActorClass(getDiagram());
NonInitialTransition t = ac.getCommType()==ActorCommunicationType.DATA_DRIVEN?
((orig instanceof GuardedTransition)?
(GuardedTransition)orig : RoomFactory.eINSTANCE.createGuardedTransition()
@@ -428,7 +427,7 @@ public class TransitionSupport {
sg.getTransitions().add(trans);
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- TransitionPropertyDialog dlg = new TransitionPropertyDialog(shell, sg, trans);
+ TransitionPropertyDialog dlg = new TransitionPropertyDialog(shell, ac, trans);
if (dlg.open()!=Window.OK) {
sg.getTransitions().add(orig);
sg.getTransitions().remove(trans);
@@ -579,12 +578,10 @@ public class TransitionSupport {
pe = (PictogramElement) pe.eContainer();
Transition trans = (Transition) getBusinessObjectForPictogramElement(pe);
Connection conn = (Connection) pe;
- StateGraph sg = (StateGraph)trans.eContainer();
- StateGraph currentSG = SupportUtil.getStateGraph((ContainerShape) conn.getStart().eContainer(), getFeatureProvider());
- boolean inherited = SupportUtil.isInherited(getDiagram(), currentSG);
+ boolean inherited = SupportUtil.isInherited(getDiagram(), trans);
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- TransitionPropertyDialog dlg = new TransitionPropertyDialog(shell, sg, trans);
+ TransitionPropertyDialog dlg = new TransitionPropertyDialog(shell, SupportUtil.getActorClass(getDiagram()), trans);
if (dlg.open()!=Window.OK)
throw new OperationCanceledException();
diff --git a/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/dialogs/AbstractPropertyDialog.java b/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/dialogs/AbstractPropertyDialog.java
index b986ea39c..066598328 100644
--- a/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/dialogs/AbstractPropertyDialog.java
+++ b/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/dialogs/AbstractPropertyDialog.java
@@ -303,6 +303,21 @@ public abstract class AbstractPropertyDialog extends FormDialog {
return text;
}
+ protected Text createFixedText(Composite parent, String label, String txt, boolean multiline) {
+ Label l = toolkit.createLabel(parent, label, SWT.NONE);
+ l.setLayoutData(new GridData(SWT.NONE));
+
+ int style = SWT.BORDER;
+ if (multiline)
+ style |= SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL;
+ Text text = toolkit.createText(parent, txt, style);
+ GridData gd = new GridData(multiline?GridData.FILL_BOTH:GridData.FILL_HORIZONTAL);
+ text.setLayoutData(gd);
+ text.setEnabled(false);
+
+ return text;
+ }
+
protected Button createCheck(Composite parent, String label, EObject obj, EAttribute att) {
return createCheck(parent, label, obj, att, null);
}
diff --git a/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/editor/RoomDiagramEditor.java b/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/editor/RoomDiagramEditor.java
index 63f5fe7cd..834fea0de 100644
--- a/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/editor/RoomDiagramEditor.java
+++ b/plugins/org.eclipse.etrice.ui.common/src/org/eclipse/etrice/ui/common/editor/RoomDiagramEditor.java
@@ -16,6 +16,7 @@ import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature.Setting;
@@ -159,7 +160,7 @@ public class RoomDiagramEditor extends DiagramEditor {
* did not work correctly
*/
// if (AutoUpdateFeature.isLastDoneChanges())
- doSave(null);
+ doSave(new NullProgressMonitor());
}
/* (non-Javadoc)

Back to the top