summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2013-03-05 16:41:56 (EST)
committerJuergen Haug2013-03-05 16:41:56 (EST)
commit17ca5a6a99cf0be2aef5876746abcfa4fc62395a (patch)
tree1e33b880eb3f0d4bc2949fc59a825573bc50e7dd
parent91fe7f5032f5bc365ac0530d53d67567ce932174 (diff)
downloadorg.eclipse.etrice-17ca5a6a99cf0be2aef5876746abcfa4fc62395a.zip
org.eclipse.etrice-17ca5a6a99cf0be2aef5876746abcfa4fc62395a.tar.gz
org.eclipse.etrice-17ca5a6a99cf0be2aef5876746abcfa4fc62395a.tar.bz2
[ui] (Bug 398474) linking from editor to outline doesn't work forrefs/changes/74/10874/1
elements nested in custom entries (e.g. Structure) Change-Id: I7e10d154911ec971bba767d7d2c88879910e76d0
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/ExtraOutlineNode.java28
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/RoomOutlineTreeProvider.java67
2 files changed, 52 insertions, 43 deletions
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/ExtraOutlineNode.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/ExtraOutlineNode.java
deleted file mode 100644
index d908f98..0000000
--- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/ExtraOutlineNode.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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
- *******************************************************************************/
-
-package org.eclipse.etrice.core.ui.outline;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.ui.internal.RoomActivator;
-import org.eclipse.xtext.ui.editor.outline.IOutlineNode;
-import org.eclipse.xtext.ui.editor.outline.impl.EObjectNode;
-
-/**
- * description
- *
- * @author Henrik Rentz-Reichert initial contribution and API
- *
- */
-public class ExtraOutlineNode extends EObjectNode {
-
- public ExtraOutlineNode(EObject obj, IOutlineNode parent, Object text) {
- super(obj, parent, RoomActivator.getInstance().getImageRegistry().get("defaultoutlinenode.gif"), text, false);
- }
-
-}
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/RoomOutlineTreeProvider.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/RoomOutlineTreeProvider.java
index 9fe1e3a..be372de 100644
--- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/RoomOutlineTreeProvider.java
+++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/RoomOutlineTreeProvider.java
@@ -12,6 +12,7 @@
package org.eclipse.etrice.core.ui.outline;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.ActorInstanceMapping;
import org.eclipse.etrice.core.room.ActorRef;
@@ -27,7 +28,11 @@ import org.eclipse.etrice.core.room.SAPRef;
import org.eclipse.etrice.core.room.SPPRef;
import org.eclipse.etrice.core.room.ServiceImplementation;
import org.eclipse.etrice.core.room.State;
+import org.eclipse.etrice.core.room.StateGraph;
import org.eclipse.etrice.core.room.SubSystemClass;
+import org.eclipse.etrice.core.ui.internal.RoomActivator;
+import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.xtext.ui.editor.outline.IOutlineNode;
import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider;
@@ -63,20 +68,30 @@ public class RoomOutlineTreeProvider extends DefaultOutlineTreeProvider {
}
protected void _createChildren(IOutlineNode parentNode, ActorClass ac) {
+ Object nodeName = parentNode.getText();
+ if(parentNode.getText() instanceof StyledString)
+ nodeName = ((StyledString)parentNode.getText()).getString();
+ if(nodeName.equals(ac.getName()))
+ createChildren1(parentNode, ac);
+ else
+ createChildren2(parentNode, ac);
+ }
+
+ private void createChildren1(IOutlineNode parentNode, ActorClass ac) {
if (ac.getIfPorts().size()>0 || ac.getIfSPPs().size()>0) {
- new ExtraOutlineNode(ac, parentNode, INTERFACE_LABEL);
+ createExtraNode(ac, parentNode, INTERFACE_LABEL);
}
if (ac.getIntPorts().size()>0 || ac.getExtPorts().size()>0 || ac.getServiceImplementations().size()>0 ||
ac.getStrSAPs().size()>0 || ac.getAttributes().size()>0 ||
ac.getActorRefs().size()>0) {
- new ExtraOutlineNode(ac, parentNode, STRUCTURE_LABEL);
+ createExtraNode(ac, parentNode, STRUCTURE_LABEL);
}
if (ac.getOperations().size()>0 || ac.getStateMachine()!=null) {
- new ExtraOutlineNode(ac, parentNode, BEHAVIOR_LABEL);
+ createExtraNode(ac, parentNode, BEHAVIOR_LABEL);
}
}
- protected void _createChildren(ExtraOutlineNode parentNode, ActorClass ac) {
+ private void createChildren2(IOutlineNode parentNode, ActorClass ac) {
if (parentNode.getText().equals(INTERFACE_LABEL)) {
for (Port port : ac.getIfPorts())
createNode(parentNode, port);
@@ -101,16 +116,24 @@ public class RoomOutlineTreeProvider extends DefaultOutlineTreeProvider {
for (Operation op : ac.getOperations())
createNode(parentNode, op);
if (ac.getStateMachine()!=null) {
- new ExtraOutlineNode(ac, parentNode, STATE_MACHINE_LABEL);
- }
- }
- else if (parentNode.getText().equals(STATE_MACHINE_LABEL)) {
- for (State s : ac.getStateMachine().getStates()) {
- createNode(parentNode, s);
+ createNode(parentNode, ac.getStateMachine());
}
}
}
+ protected void _createChildren(IOutlineNode parentNode, StateGraph st) {
+ for (State s : st.getStates())
+ createNode(parentNode, s);
+ }
+
+ protected Object _text(StateGraph modelElement) {
+ return STATE_MACHINE_LABEL;
+ }
+
+ protected Image _image(StateGraph modelElement) {
+ return RoomActivator.getInstance().getImageRegistry().get("defaultoutlinenode.gif");
+ }
+
protected boolean _isLeaf(SubSystemClass ssc) {
if (!ssc.getActorRefs().isEmpty()) {
return false;
@@ -146,19 +169,29 @@ public class RoomOutlineTreeProvider extends DefaultOutlineTreeProvider {
}
protected void _createChildren(IOutlineNode parentNode, ProtocolClass pc) {
+ Object nodeName = parentNode.getText();
+ if(parentNode.getText() instanceof StyledString)
+ nodeName = ((StyledString)parentNode.getText()).getString();
+ if(nodeName.equals(pc.getName()))
+ createChildren1(parentNode, pc);
+ else
+ createChildren2(parentNode, pc);
+ }
+
+ private void createChildren1(IOutlineNode parentNode, ProtocolClass pc) {
if (pc.getIncomingMessages().size()>0) {
- new ExtraOutlineNode(pc, parentNode, INCOMING_LABEL);
+ createExtraNode(pc, parentNode, INCOMING_LABEL);
}
if (pc.getOutgoingMessages().size()>0) {
- new ExtraOutlineNode(pc, parentNode, OUTGOING_LABEL);
+ createExtraNode(pc, parentNode, OUTGOING_LABEL);
}
if (pc.getRegular()!=null)
- new ExtraOutlineNode(pc, parentNode, REG_PORT_CLASS_LABEL);
+ createExtraNode(pc, parentNode, REG_PORT_CLASS_LABEL);
if (pc.getConjugate()!=null)
- new ExtraOutlineNode(pc, parentNode, CONJ_PORT_CLASS_LABEL);
+ createExtraNode(pc, parentNode, CONJ_PORT_CLASS_LABEL);
}
- protected void _createChildren(ExtraOutlineNode parentNode, ProtocolClass pc) {
+ private void createChildren2(IOutlineNode parentNode, ProtocolClass pc) {
if (parentNode.getText().equals(INCOMING_LABEL)) {
for (Message m : pc.getIncomingMessages()) {
createNode(parentNode, m);
@@ -198,4 +231,8 @@ public class RoomOutlineTreeProvider extends DefaultOutlineTreeProvider {
protected boolean _isLeaf(Attribute ac) {
return true;
}
+
+ private void createExtraNode(EObject obj, IOutlineNode parent, Object text){
+ createEObjectNode(parent, obj, RoomActivator.getInstance().getImageRegistry().get("defaultoutlinenode.gif"), text, false);
+ }
}