Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2012-11-16 17:31:31 -0500
committerHenrik Rentz-Reichert2012-11-16 17:31:31 -0500
commit031eed4af279087b9ae2cca676e3d662a297e809 (patch)
tree797b3470182e4031deef77d5e3d80755a248c881
parent488cb57e4de0da85ae20fc7b3a658197fbc703ae (diff)
downloadorg.eclipse.etrice-031eed4af279087b9ae2cca676e3d662a297e809.tar.gz
org.eclipse.etrice-031eed4af279087b9ae2cca676e3d662a297e809.tar.xz
org.eclipse.etrice-031eed4af279087b9ae2cca676e3d662a297e809.zip
[core.etmap, core.etphys, core.room] outline labels
-rw-r--r--plugins/org.eclipse.etrice.core.etmap.ui/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.etrice.core.etmap.ui/src/org/eclipse/etrice/core/etmap/ui/labeling/ETMapLabelProvider.java56
-rw-r--r--plugins/org.eclipse.etrice.core.etmap/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.etrice.core.etphys.ui/src/org/eclipse/etrice/core/etphys/ui/labeling/ETPhysLabelProvider.java65
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java9
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/outline/RoomOutlineTreeProvider.java8
6 files changed, 123 insertions, 20 deletions
diff --git a/plugins/org.eclipse.etrice.core.etmap.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.core.etmap.ui/META-INF/MANIFEST.MF
index 9f2b35780..35ac60648 100644
--- a/plugins/org.eclipse.etrice.core.etmap.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.core.etmap.ui/META-INF/MANIFEST.MF
@@ -7,6 +7,7 @@ Bundle-SymbolicName: org.eclipse.etrice.core.etmap.ui; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.etrice.core.room.ui;bundle-version="0.3.0",
org.eclipse.etrice.core.etmap;bundle-version="0.3.0";visibility:=reexport,
+ org.eclipse.etrice.core.etphys;bundle-version="0.3.0",
org.eclipse.xtext.ui,
org.eclipse.ui.editors;bundle-version="3.5.0",
org.eclipse.ui.ide;bundle-version="3.5.0",
diff --git a/plugins/org.eclipse.etrice.core.etmap.ui/src/org/eclipse/etrice/core/etmap/ui/labeling/ETMapLabelProvider.java b/plugins/org.eclipse.etrice.core.etmap.ui/src/org/eclipse/etrice/core/etmap/ui/labeling/ETMapLabelProvider.java
index d140c3148..d3f8df6dd 100644
--- a/plugins/org.eclipse.etrice.core.etmap.ui/src/org/eclipse/etrice/core/etmap/ui/labeling/ETMapLabelProvider.java
+++ b/plugins/org.eclipse.etrice.core.etmap.ui/src/org/eclipse/etrice/core/etmap/ui/labeling/ETMapLabelProvider.java
@@ -13,7 +13,17 @@
package org.eclipse.etrice.core.etmap.ui.labeling;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.etrice.core.etmap.eTMap.Import;
+import org.eclipse.etrice.core.etmap.eTMap.Mapping;
+import org.eclipse.etrice.core.etmap.eTMap.SubSystemMapping;
+import org.eclipse.etrice.core.etmap.eTMap.ThreadMapping;
+import org.eclipse.jface.resource.FontDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.jface.viewers.StyledString.Styler;
+import org.eclipse.swt.SWT;
import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider;
+import org.eclipse.xtext.ui.label.StylerFactory;
import com.google.inject.Inject;
@@ -24,20 +34,48 @@ import com.google.inject.Inject;
*/
public class ETMapLabelProvider extends DefaultEObjectLabelProvider {
+ private static final String KEYWORD_COLOR = "KEYWORD_COLOR";
+
+ @Inject
+ private StylerFactory stylerFactory;
+ private Styler keywordStyler = null;
+
@Inject
public ETMapLabelProvider(AdapterFactoryLabelProvider delegate) {
super(delegate);
}
-/*
- //Labels and icons can be computed like this:
+ String text(Mapping m) {
+ return "Mapping "+m.getLogicalSys().getName()+" -> "+m.getPhysicalSys().getName();
+ }
+
+ String text(SubSystemMapping ssm) {
+ return "SubSystemMapping "+ssm.getLogicalSubSys().getName()+" -> Node "+ssm.getNode().getName();
+ }
+
+ String text(ThreadMapping tm) {
+ return "ThreadMapping "+tm.getLogicalThread().getName()+" -> "+tm.getPhysicalThread().getName();
+ }
+
+ StyledString text(Import im) {
+ if (im.getImportedNamespace()==null) {
+ StyledString txt = new StyledString("import model "+im.getImportURI());
+ txt.setStyle(0, 12, getKeywordStyler());
+ return txt;
+ }
+ else {
+ StyledString txt = new StyledString("import ns "+im.getImportedNamespace());
+ txt.setStyle(0, 9, getKeywordStyler());
+ return txt;
+ }
+ }
- String text(MyModel ele) {
- return "my "+ele.getName();
+ private Styler getKeywordStyler() {
+ if (keywordStyler==null) {
+ FontDescriptor font = JFaceResources.getFontDescriptor(JFaceResources.TEXT_FONT);
+ FontDescriptor boldFont = font.setStyle(SWT.BOLD);
+ keywordStyler = stylerFactory.createStyler(boldFont, KEYWORD_COLOR, null);
+ }
+ return keywordStyler;
}
-
- String image(MyModel ele) {
- return "MyModel.gif";
- }
-*/
}
diff --git a/plugins/org.eclipse.etrice.core.etmap/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.core.etmap/META-INF/MANIFEST.MF
index ed78261e0..7e289e9b0 100644
--- a/plugins/org.eclipse.etrice.core.etmap/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.core.etmap/META-INF/MANIFEST.MF
@@ -5,8 +5,8 @@ Bundle-Vendor: eTrice (Incubation)
Bundle-Version: 0.3.0.qualifier
Bundle-SymbolicName: org.eclipse.etrice.core.etmap; singleton:=true
Bundle-ActivationPolicy: lazy
-Require-Bundle: org.eclipse.etrice.core.room;bundle-version="0.2.0",
- org.eclipse.etrice.core.etphys;bundle-version="0.2.0",
+Require-Bundle: org.eclipse.etrice.core.room;bundle-version="0.3.0",
+ org.eclipse.etrice.core.etphys;bundle-version="0.3.0",
org.eclipse.xtext;visibility:=reexport,
org.eclipse.xtext.xbase;resolution:=optional;visibility:=reexport,
org.eclipse.xtext.generator;resolution:=optional,
diff --git a/plugins/org.eclipse.etrice.core.etphys.ui/src/org/eclipse/etrice/core/etphys/ui/labeling/ETPhysLabelProvider.java b/plugins/org.eclipse.etrice.core.etphys.ui/src/org/eclipse/etrice/core/etphys/ui/labeling/ETPhysLabelProvider.java
index b9a8ef63f..7d39f9b6c 100644
--- a/plugins/org.eclipse.etrice.core.etphys.ui/src/org/eclipse/etrice/core/etphys/ui/labeling/ETPhysLabelProvider.java
+++ b/plugins/org.eclipse.etrice.core.etphys.ui/src/org/eclipse/etrice/core/etphys/ui/labeling/ETPhysLabelProvider.java
@@ -13,7 +13,16 @@
package org.eclipse.etrice.core.etphys.ui.labeling;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.etrice.core.etphys.eTPhys.Import;
+import org.eclipse.etrice.core.etphys.eTPhys.NodeRef;
+import org.eclipse.etrice.core.etphys.eTPhys.RuntimeClass;
+import org.eclipse.jface.resource.FontDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.jface.viewers.StyledString.Styler;
+import org.eclipse.swt.SWT;
import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider;
+import org.eclipse.xtext.ui.label.StylerFactory;
import com.google.inject.Inject;
@@ -24,20 +33,58 @@ import com.google.inject.Inject;
*/
public class ETPhysLabelProvider extends DefaultEObjectLabelProvider {
+ private static final String KEYWORD_COLOR = "KEYWORD_COLOR";
+
+ @Inject
+ private StylerFactory stylerFactory;
+ private Styler keywordStyler = null;
+ private Styler typeStyler = null;
+
@Inject
public ETPhysLabelProvider(AdapterFactoryLabelProvider delegate) {
super(delegate);
}
-/*
- //Labels and icons can be computed like this:
+ String text(RuntimeClass rc) {
+ return rc.getName()+"("+rc.getThreadModel().getLiteral()+")";
+ }
+
+ StyledString text(NodeRef ref) {
+ String cls = ref.getType()!=null? (" : "+ref.getType().getName()):"";
+ StyledString txt = new StyledString("NodeRef "+ref.getName()+cls);
+ if (!cls.isEmpty())
+ txt.setStyle(txt.length()-cls.length()+2, cls.length()-2, getTypeStyler());
+ return txt;
+ }
+
+ StyledString text(Import im) {
+ if (im.getImportedNamespace()==null) {
+ StyledString txt = new StyledString("import model "+im.getImportURI());
+ txt.setStyle(0, 12, getKeywordStyler());
+ return txt;
+ }
+ else {
+ StyledString txt = new StyledString("import ns "+im.getImportedNamespace());
+ txt.setStyle(0, 9, getKeywordStyler());
+ return txt;
+ }
+ }
- String text(MyModel ele) {
- return "my "+ele.getName();
+ private Styler getKeywordStyler() {
+ if (keywordStyler==null) {
+ FontDescriptor font = JFaceResources.getFontDescriptor(JFaceResources.TEXT_FONT);
+ FontDescriptor boldFont = font.setStyle(SWT.BOLD);
+ keywordStyler = stylerFactory.createStyler(boldFont, KEYWORD_COLOR, null);
+ }
+ return keywordStyler;
+ }
+
+ private Styler getTypeStyler() {
+ if (typeStyler==null) {
+ FontDescriptor font = JFaceResources.getFontDescriptor(JFaceResources.TEXT_FONT);
+ FontDescriptor italicFont = font.setStyle(SWT.ITALIC);
+ typeStyler = stylerFactory.createStyler(italicFont, null, null);
+ }
+ return typeStyler;
}
-
- String image(MyModel ele) {
- return "MyModel.gif";
- }
-*/
}
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java
index 567b10d4c..f7432a08e 100644
--- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java
+++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/labeling/RoomLabelProvider.java
@@ -15,6 +15,7 @@ package org.eclipse.etrice.core.ui.labeling;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.etrice.core.naming.RoomNameProvider;
import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.ActorInstanceMapping;
import org.eclipse.etrice.core.room.ActorRef;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.Binding;
@@ -346,6 +347,14 @@ public class RoomLabelProvider extends DefaultEObjectLabelProvider {
return s.getName();
}
+ String text(ActorInstanceMapping aim) {
+ StringBuilder path = new StringBuilder();
+ for (String seg : aim.getPath().getRefs()) {
+ path.append("/"+seg);
+ }
+ return path+" -> "+aim.getThread().getName();
+ }
+
private Styler getKeywordStyler() {
if (keywordStyler==null) {
FontDescriptor font = JFaceResources.getFontDescriptor(JFaceResources.TEXT_FONT);
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 25ae97a73..9fe1e3a9d 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
@@ -13,9 +13,11 @@
package org.eclipse.etrice.core.ui.outline;
import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.ActorInstanceMapping;
import org.eclipse.etrice.core.room.ActorRef;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.ExternalPort;
+import org.eclipse.etrice.core.room.LogicalThread;
import org.eclipse.etrice.core.room.Message;
import org.eclipse.etrice.core.room.Operation;
import org.eclipse.etrice.core.room.Port;
@@ -120,6 +122,12 @@ public class RoomOutlineTreeProvider extends DefaultOutlineTreeProvider {
for (ActorRef aref : ssc.getActorRefs()) {
createNode(parentNode, aref);
}
+ for (LogicalThread thread : ssc.getThreads()) {
+ createNode(parentNode, thread);
+ }
+ for (ActorInstanceMapping aim : ssc.getActorInstanceMappings()) {
+ createNode(parentNode, aim);
+ }
}
protected void _createChildren(IOutlineNode parentNode, State s) {

Back to the top