Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2019-01-28 10:15:09 -0500
committerJuergen Haug2019-01-28 13:45:31 -0500
commitf81132ac97727eb3f8acf796cec7a29f75b0b5cd (patch)
treeb87c8a1606a25022fa83c2ff626e1e3031199a25
parentf209b1ff7ff93b7ab83cef70643a514a156d600f (diff)
downloadorg.eclipse.etrice-f81132ac97727eb3f8acf796cec7a29f75b0b5cd.tar.gz
org.eclipse.etrice-f81132ac97727eb3f8acf796cec7a29f75b0b5cd.tar.xz
org.eclipse.etrice-f81132ac97727eb3f8acf796cec7a29f75b0b5cd.zip
Bug 541030 - [diagrams] Add action Open in Model
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/plugin.xml26
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/RoomOpeningHelper.java2
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditModelHandler.java11
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/OpenDeclaration.java60
-rw-r--r--plugins/org.eclipse.etrice.ui.common.base/plugin.xml7
-rw-r--r--plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/editor/DiagramEditorBase.java10
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/plugin.xml8
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/ActorContainerRefSupport.java58
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/InterfaceItemSupport.java69
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/PortSupport.java10
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/SPPSupport.java8
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/StructureClassSupport.java56
12 files changed, 316 insertions, 9 deletions
diff --git a/plugins/org.eclipse.etrice.ui.commands/plugin.xml b/plugins/org.eclipse.etrice.ui.commands/plugin.xml
index 2a96967f8..f429711d7 100644
--- a/plugins/org.eclipse.etrice.ui.commands/plugin.xml
+++ b/plugins/org.eclipse.etrice.ui.commands/plugin.xml
@@ -117,6 +117,12 @@
sequence="M3+M"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
</key>
+ <key
+ commandId="org.eclipse.xtext.ui.editor.hyperlinking.OpenDeclaration"
+ contextId="org.eclipse.etrice.ui.common.base.context"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="F3">
+ </key>
</extension>
<extension
point="org.eclipse.ui.menus">
@@ -204,5 +210,25 @@
</command>
</menuContribution>
</extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.etrice.ui.commands.handlers.OpenDeclaration"
+ commandId="org.eclipse.xtext.ui.editor.hyperlinking.OpenDeclaration">
+ <activeWhen>
+ <with
+ variable="activeEditorId">
+ <or>
+ <equals
+ value="org.eclipse.etrice.ui.behavior.editor.BehaviorEditor">
+ </equals>
+ <equals
+ value="org.eclipse.etrice.ui.structure.editor.StructureEditor">
+ </equals>
+ </or>
+ </with>
+ </activeWhen>
+ </handler>
+ </extension>
</plugin>
diff --git a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/RoomOpeningHelper.java b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/RoomOpeningHelper.java
index f644aac0a..43684a53d 100644
--- a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/RoomOpeningHelper.java
+++ b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/RoomOpeningHelper.java
@@ -36,7 +36,7 @@ public class RoomOpeningHelper {
static public void openBehavior(EObject object) {
if (object instanceof ActorClass) {
ActorClass ac = (ActorClass) object;
- boolean hasManualBehavior = ac.getBehaviorAnnotations().parallelStream().anyMatch(new Predicate<Annotation>() {
+ boolean hasManualBehavior = ac.getBehaviorAnnotations().stream().anyMatch(new Predicate<Annotation>() {
@Override
public boolean test(Annotation annotation) {
diff --git a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditModelHandler.java b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditModelHandler.java
index 839b4bc20..29f73c27b 100644
--- a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditModelHandler.java
+++ b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditModelHandler.java
@@ -3,8 +3,11 @@ package org.eclipse.etrice.ui.commands.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.etrice.ui.commands.RoomOpeningHelper;
import org.eclipse.etrice.ui.common.base.editor.DiagramEditorBase;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.services.Graphiti;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
@@ -24,7 +27,13 @@ public class EditModelHandler extends AbstractHandler {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
IEditorPart editor = window.getActivePage().getActiveEditor();
if (editor instanceof DiagramEditorBase) {
- RoomOpeningHelper.showInTextualEditor(((DiagramEditorBase) editor).getModelComponent());
+ Diagram diagram = ((DiagramEditorBase) editor).getDiagramTypeProvider().getDiagram();
+ if(diagram != null) {
+ EObject model = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(diagram);
+ if(model != null && !model.eIsProxy()) {
+ RoomOpeningHelper.showInTextualEditor(model);
+ }
+ }
}
return null;
diff --git a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/OpenDeclaration.java b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/OpenDeclaration.java
new file mode 100644
index 000000000..4ff318b1a
--- /dev/null
+++ b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/OpenDeclaration.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * CONTRIBUTORS:
+ * Juergen Haug (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.ui.commands.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.ui.commands.RoomOpeningHelper;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.ui.platform.GraphitiConnectionEditPart;
+import org.eclipse.graphiti.ui.platform.GraphitiShapeEditPart;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Single diagram selection + F3 => jump to declaration in textual editor
+ */
+public class OpenDeclaration extends AbstractHandler implements IHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IStructuredSelection selection = HandlerUtil.getCurrentStructuredSelection(event);
+ if(selection.size() != 1) {
+ return null;
+ }
+
+ PictogramElement pe = null;
+ if(selection.getFirstElement() instanceof GraphitiShapeEditPart) {
+ pe = ((GraphitiShapeEditPart) selection.getFirstElement()).getPictogramElement();
+ }
+ else if (selection.getFirstElement() instanceof GraphitiConnectionEditPart) {
+ pe = ((GraphitiConnectionEditPart) selection.getFirstElement()).getPictogramElement();
+ }
+
+ if(pe != null) {
+ EObject bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
+ if(bo != null) {
+ RoomOpeningHelper.showInTextualEditor(bo);
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.etrice.ui.common.base/plugin.xml b/plugins/org.eclipse.etrice.ui.common.base/plugin.xml
index fcf53d442..2531c1c06 100644
--- a/plugins/org.eclipse.etrice.ui.common.base/plugin.xml
+++ b/plugins/org.eclipse.etrice.ui.common.base/plugin.xml
@@ -34,5 +34,12 @@
class="org.eclipse.etrice.ui.common.base.preferences.UIBasePreferenceInitializer">
</initializer>
</extension>
+ <extension
+ point="org.eclipse.ui.contexts">
+ <context
+ id="org.eclipse.etrice.ui.common.base.context"
+ name="eTrice Diagram Context">
+ </context>
+ </extension>
</plugin>
diff --git a/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/editor/DiagramEditorBase.java b/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/editor/DiagramEditorBase.java
index 972e7217b..15f5bc95d 100644
--- a/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/editor/DiagramEditorBase.java
+++ b/plugins/org.eclipse.etrice.ui.common.base/src/org/eclipse/etrice/ui/common/base/editor/DiagramEditorBase.java
@@ -39,10 +39,13 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.contexts.IContextService;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.ui.editor.XtextEditor;
import org.eclipse.xtext.util.concurrent.IUnitOfWork;
+import static org.eclipse.ui.PlatformUI.getWorkbench;
+
import com.google.inject.Injector;
/**
@@ -51,6 +54,8 @@ import com.google.inject.Injector;
*/
public abstract class DiagramEditorBase extends DiagramEditor implements IInputUriHolder {
+ private final static String CONTEXT_ID = "org.eclipse.etrice.ui.common.base.context";
+
protected ModificationTrackingEnabler mte = new ModificationTrackingEnabler();
protected URI inputUri;
private Object textEditorClass;
@@ -78,6 +83,8 @@ public abstract class DiagramEditorBase extends DiagramEditor implements IInputU
this.inputUri = ((IDiagramEditorInput) newInput).getUri();
super.init(site, input);
+
+ getWorkbench().getService(IContextService.class).activateContext(CONTEXT_ID);
}
@Override
@@ -116,8 +123,9 @@ public abstract class DiagramEditorBase extends DiagramEditor implements IInputU
Diagram diagram = getDiagramTypeProvider().getDiagram();
EObject diagramBo = diagram.getLink().getBusinessObjects().iterator().next();
- if(diagramBo == null || diagramBo.eIsProxy())
+ if(diagramBo == null || diagramBo.eIsProxy()) {
handleMissingDiagramBo(diagram);
+ }
}
public ModelComponent getModelComponent() {
diff --git a/plugins/org.eclipse.etrice.ui.structure/plugin.xml b/plugins/org.eclipse.etrice.ui.structure/plugin.xml
index 6421078d3..af3481408 100644
--- a/plugins/org.eclipse.etrice.ui.structure/plugin.xml
+++ b/plugins/org.eclipse.etrice.ui.structure/plugin.xml
@@ -68,5 +68,13 @@
editor_id="org.eclipse.etrice.ui.structure.editor.StructureEditor">
</participant>
</extension>
+ <extension
+ point="org.eclipse.ui.contexts">
+ <context
+ id="org.eclipse.etrice.ui.structure.editor.structureEditor"
+ name="ROOM Structure Editor"
+ parentId="org.eclipse.graphiti.ui.diagramEditor">
+ </context>
+ </extension>
</plugin>
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 c39b84e8b..cbc460b53 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
@@ -736,6 +736,61 @@ public class ActorContainerRefSupport {
}
}
+ private static class OpenRefModel extends AbstractCustomFeature {
+
+ public OpenRefModel(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ @Override
+ public String getName() {
+ return "Open Ref Model";
+ }
+
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1) {
+ Object bo = getBusinessObjectForPictogramElement(pes[0]);
+ if (bo instanceof ActorRef) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1) {
+ Object bo = getBusinessObjectForPictogramElement(pes[0]);
+ if (bo instanceof ActorRef) {
+ final ActorClass ac = ((ActorRef)bo).getType();
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ shell.getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ RoomOpeningHelper.showInTextualEditor(ac);
+ }
+ });
+ }
+ }
+ }
+
+ @Override
+ public boolean hasDoneChanges() {
+ ScopedPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.etrice.ui.common");
+ boolean autoSave = store.getBoolean(UIBasePreferenceConstants.SAVE_DIAG_ON_FOCUS_LOST);
+ if (autoSave)
+ return true; // this is needed to trigger the save via a CommandStackListener after this command is completed
+ else
+ return false;
+ }
+ }
+
private class UpdateFeature extends ShapeUpdateFeature {
public UpdateFeature(IFeatureProvider fp) {
@@ -1061,7 +1116,8 @@ public class ActorContainerRefSupport {
return new ICustomFeature[] {
new PropertyFeature(fp),
new OpenRefStructureDiagram(fp),
- new OpenRefBehaviorDiagram(fp)};
+ new OpenRefBehaviorDiagram(fp),
+ new OpenRefModel(fp)};
}
protected static boolean isInherited(ActorContainerRef ar, EObject parent) {
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/InterfaceItemSupport.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/InterfaceItemSupport.java
index a2f782395..12c8f006d 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/InterfaceItemSupport.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/InterfaceItemSupport.java
@@ -14,15 +14,19 @@
package org.eclipse.etrice.ui.structure.support;
+import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.ActorContainerClass;
import org.eclipse.etrice.core.room.ActorContainerRef;
import org.eclipse.etrice.core.room.ActorRef;
+import org.eclipse.etrice.core.room.GeneralProtocolClass;
import org.eclipse.etrice.core.room.InterfaceItem;
import org.eclipse.etrice.core.room.Port;
import org.eclipse.etrice.core.room.SPP;
import org.eclipse.etrice.core.room.SubSystemRef;
+import org.eclipse.etrice.ui.commands.RoomOpeningHelper;
+import org.eclipse.etrice.ui.common.base.preferences.UIBasePreferenceConstants;
import org.eclipse.etrice.ui.common.base.support.BaseToolBehaviorProvider;
import org.eclipse.etrice.ui.common.base.support.CantRemoveFeature;
import org.eclipse.etrice.ui.common.base.support.ChangeAwareCreateFeature;
@@ -50,6 +54,8 @@ import org.eclipse.graphiti.features.context.IRemoveContext;
import org.eclipse.graphiti.features.context.IResizeShapeContext;
import org.eclipse.graphiti.features.context.ITargetContext;
import org.eclipse.graphiti.features.context.IUpdateContext;
+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.AbstractLayoutFeature;
import org.eclipse.graphiti.features.impl.DefaultMoveShapeFeature;
@@ -68,6 +74,9 @@ import org.eclipse.graphiti.services.IPeCreateService;
import org.eclipse.graphiti.ui.features.DefaultFeatureProvider;
import org.eclipse.graphiti.util.ColorConstant;
import org.eclipse.graphiti.util.IColorConstant;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
public class InterfaceItemSupport {
@@ -469,6 +478,61 @@ public class InterfaceItemSupport {
}
+ protected static class OpenProtocolClass extends AbstractCustomFeature {
+
+ public OpenProtocolClass(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ @Override
+ public String getName() {
+ return "Open Protocol Class";
+ }
+
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1) {
+ Object bo = getBusinessObjectForPictogramElement(pes[0]);
+ if (bo instanceof InterfaceItem) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1) {
+ Object bo = getBusinessObjectForPictogramElement(pes[0]);
+ if (bo instanceof InterfaceItem) {
+ final GeneralProtocolClass pc = ((InterfaceItem)bo).getGeneralProtocol();
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ shell.getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ RoomOpeningHelper.showInTextualEditor(pc);
+ }
+ });
+ }
+ }
+ }
+
+ @Override
+ public boolean hasDoneChanges() {
+ ScopedPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.etrice.ui.common");
+ boolean autoSave = store.getBoolean(UIBasePreferenceConstants.SAVE_DIAG_ON_FOCUS_LOST);
+ if (autoSave)
+ return true; // this is needed to trigger the save via a CommandStackListener after this command is completed
+ else
+ return false;
+ }
+ }
+
protected IFeatureProvider fp;
protected FeatureProvider(IDiagramTypeProvider dtp, IFeatureProvider fp) {
@@ -649,6 +713,11 @@ public class InterfaceItemSupport {
return new LayoutFeature(fp);
}
+ @Override
+ public ICustomFeature[] getCustomFeatures(ICustomContext context) {
+ return new ICustomFeature[] { new OpenProtocolClass(fp) };
+ }
+
protected static void adjustLabel(Text label, int x, int y, int width, int margin, int size) {
Orientation align = Orientation.ALIGNMENT_CENTER;
label.setHorizontalAlignment(align);
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/PortSupport.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/PortSupport.java
index 90a438bac..55dcc7615 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/PortSupport.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/PortSupport.java
@@ -15,18 +15,20 @@
package org.eclipse.etrice.ui.structure.support;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature.Setting;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.etrice.core.fsm.fSM.MessageFromIf;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.ActorContainerClass;
import org.eclipse.etrice.core.room.Binding;
import org.eclipse.etrice.core.room.BindingEndPoint;
import org.eclipse.etrice.core.room.ExternalPort;
import org.eclipse.etrice.core.room.InterfaceItem;
-import org.eclipse.etrice.core.fsm.fSM.MessageFromIf;
import org.eclipse.etrice.core.room.Port;
import org.eclipse.etrice.core.room.RoomFactory;
import org.eclipse.etrice.core.room.RoomPackage;
@@ -354,7 +356,11 @@ public class PortSupport extends InterfaceItemSupport {
@Override
public ICustomFeature[] getCustomFeatures(ICustomContext context) {
- return new ICustomFeature[] { new PropertyFeature(fp) };
+ List<ICustomFeature> features = new ArrayList<>();
+ features.add(new PropertyFeature(fp));
+ Arrays.stream(super.getCustomFeatures(context)).forEach(e -> features.add(e));
+
+ return features.toArray(new ICustomFeature[0]);
}
@Override
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 87b91efcc..6d414ff6c 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
@@ -15,7 +15,9 @@
package org.eclipse.etrice.ui.structure.support;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature.Setting;
@@ -314,7 +316,11 @@ public class SPPSupport extends InterfaceItemSupport {
@Override
public ICustomFeature[] getCustomFeatures(ICustomContext context) {
- return new ICustomFeature[] { new PropertyFeature(fp) };
+ List<ICustomFeature> features = new ArrayList<>();
+ features.add(new PropertyFeature(fp));
+ Arrays.stream(super.getCustomFeatures(context)).forEach(e -> features.add(e));
+
+ return features.toArray(new ICustomFeature[0]);
}
@Override
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 65033196c..2b52626bc 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
@@ -263,6 +263,56 @@ public class StructureClassSupport {
return false;
}
}
+
+ private class OpenClassModel extends AbstractCustomFeature {
+
+ public OpenClassModel(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ @Override
+ public String getName() {
+ return "Open Class Model";
+ }
+
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1) {
+ Object bo = getBusinessObjectForPictogramElement(pes[0]);
+ if (bo instanceof StructureClass) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1) {
+ Object bo = getBusinessObjectForPictogramElement(pes[0]);
+ if (bo instanceof StructureClass) {
+ final StructureClass ac = (StructureClass) bo;
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ shell.getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ RoomOpeningHelper.showInTextualEditor(ac);
+ }
+ });
+ }
+ }
+ }
+
+ @Override
+ public boolean hasDoneChanges() {
+ return false;
+ }
+ }
private class ReconnectToModel extends AbstractCustomFeature {
@@ -423,7 +473,9 @@ public class StructureClassSupport {
@Override
public ICustomFeature[] getCustomFeatures(ICustomContext context) {
return new ICustomFeature[] {
- new OpenBehaviorDiagram(fp), new ReconnectToModel(fp)};
+ new OpenBehaviorDiagram(fp),
+ new OpenClassModel(fp),
+ new ReconnectToModel(fp)}; // referenced by index below
}
@Override
@@ -472,7 +524,7 @@ public class StructureClassSupport {
IContextButtonPadData data = super.getContextButtonPad(context);
ICustomContext customContext = new CustomContext();
- ICustomFeature reconnectToModel = afp.getCustomFeatures(customContext)[1];
+ ICustomFeature reconnectToModel = afp.getCustomFeatures(customContext)[2];
if(reconnectToModel.isAvailable(customContext)){
IContextButtonEntry entry = new ContextButtonEntry(reconnectToModel, customContext);
entry.setIconId(IPlatformImageConstants.IMG_ECLIPSE_QUICKASSIST);

Back to the top