Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schuetz2013-07-12 08:40:15 +0000
committerThomas Schuetz2013-07-12 08:40:15 +0000
commit12cda553738ca88662624b6f47066b5564549648 (patch)
treebfa65b6c38aa566a5f1cc98395da6546a6c6e282 /plugins/org.eclipse.etrice.core.config.ui/src/org
parent3447749b1a453735ac54fc09ea7680acdbb19b69 (diff)
parentd65e1d1bdd43feadb43261b85aac2d8aef5e089c (diff)
downloadorg.eclipse.etrice-12cda553738ca88662624b6f47066b5564549648.tar.gz
org.eclipse.etrice-12cda553738ca88662624b6f47066b5564549648.tar.xz
org.eclipse.etrice-12cda553738ca88662624b6f47066b5564549648.zip
Merge remote-tracking branch 'origin/master'
Conflicts: plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.java.zip Change-Id: I98e2df3ab57d6e7e8f27e5b0aee7eaa189bfbc33
Diffstat (limited to 'plugins/org.eclipse.etrice.core.config.ui/src/org')
-rw-r--r--plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/ConfigUiModule.java78
-rw-r--r--plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/contentassist/ConfigProposalProvider.java514
-rw-r--r--plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/labeling/ConfigDescriptionLabelProvider.java54
-rw-r--r--plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/labeling/ConfigLabelProvider.java68
-rw-r--r--plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/linking/ConfigHyperlinkHelper.java148
-rw-r--r--plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/outline/ConfigOutlineTreeProvider.java28
-rw-r--r--plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/quickfix/ConfigQuickfixProvider.java38
7 files changed, 464 insertions, 464 deletions
diff --git a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/ConfigUiModule.java b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/ConfigUiModule.java
index 26a36300d..82cdf8231 100644
--- a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/ConfigUiModule.java
+++ b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/ConfigUiModule.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2012 Juergen Haug
- * 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
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.ui;
-
-import org.eclipse.etrice.core.ui.linking.ConfigHyperlinkHelper;
-import org.eclipse.etrice.core.ui.linking.GlobalNonPlatformURIEditorOpener;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.xtext.ui.editor.hyperlinking.IHyperlinkHelper;
-
-/**
- * Use this class to register components to be used within the IDE.
- */
-public class ConfigUiModule extends
- org.eclipse.etrice.core.ui.AbstractConfigUiModule {
- public ConfigUiModule(AbstractUIPlugin plugin) {
- super(plugin);
- }
-
- // HOWTO: use URI imports - need special editor opener
- public Class<? extends org.eclipse.xtext.ui.editor.IURIEditorOpener> bindIURIEditorOpener() {
- return GlobalNonPlatformURIEditorOpener.class;
- }
-
- // HOWTO: use URI imports - need special class for creating hyper links for
- // imports
- public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() {
- return ConfigHyperlinkHelper.class;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Juergen Haug
+ * 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
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.ui;
+
+import org.eclipse.etrice.core.ui.linking.ConfigHyperlinkHelper;
+import org.eclipse.etrice.core.ui.linking.GlobalNonPlatformURIEditorOpener;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.xtext.ui.editor.hyperlinking.IHyperlinkHelper;
+
+/**
+ * Use this class to register components to be used within the IDE.
+ */
+public class ConfigUiModule extends
+ org.eclipse.etrice.core.ui.AbstractConfigUiModule {
+ public ConfigUiModule(AbstractUIPlugin plugin) {
+ super(plugin);
+ }
+
+ // HOWTO: use URI imports - need special editor opener
+ public Class<? extends org.eclipse.xtext.ui.editor.IURIEditorOpener> bindIURIEditorOpener() {
+ return GlobalNonPlatformURIEditorOpener.class;
+ }
+
+ // HOWTO: use URI imports - need special class for creating hyper links for
+ // imports
+ public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() {
+ return ConfigHyperlinkHelper.class;
+ }
+}
diff --git a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/contentassist/ConfigProposalProvider.java b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/contentassist/ConfigProposalProvider.java
index 2fb05b9f6..381524bf9 100644
--- a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/contentassist/ConfigProposalProvider.java
+++ b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/contentassist/ConfigProposalProvider.java
@@ -1,257 +1,257 @@
-/*******************************************************************************
- * Copyright (c) 2012 Juergen Haug
- * 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
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.ui.contentassist;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.config.ActorInstanceConfig;
-import org.eclipse.etrice.core.config.AttrConfig;
-import org.eclipse.etrice.core.config.AttrInstanceConfig;
-import org.eclipse.etrice.core.config.LiteralArray;
-import org.eclipse.etrice.core.config.RefPath;
-import org.eclipse.etrice.core.config.util.ConfigUtil;
-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.Attribute;
-import org.eclipse.etrice.core.room.DataClass;
-import org.eclipse.etrice.core.room.DataType;
-import org.eclipse.etrice.core.room.LiteralType;
-import org.eclipse.etrice.core.room.PrimitiveType;
-import org.eclipse.etrice.core.room.util.RoomHelpers;
-import org.eclipse.xtext.Assignment;
-import org.eclipse.xtext.Keyword;
-import org.eclipse.xtext.RuleCall;
-import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
-import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
-
-/**
- * see
- * http://www.eclipse.org/Xtext/documentation/latest/xtext.html#contentAssist on
- * how to customize content assistant
- */
-public class ConfigProposalProvider extends AbstractConfigProposalProvider {
-
- @Override
- public void completeImport_ImportURI(EObject model, Assignment assignment,
- final ContentAssistContext context,
- final ICompletionProposalAcceptor acceptor) {
- ImportModelAssist.addPaths(this, context, acceptor, ".room");
- }
-
- @Override
- public void completeActorInstanceConfig_Path(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- super.completeActorInstanceConfig_Path(model, assignment, context,
- acceptor);
-
- List<ActorRef> instances = collectInstances(((ActorInstanceConfig) model));
- for (ActorRef instance : instances)
- acceptor.accept(createCompletionProposal(instance.getName(),
- context));
- }
-
- @Override
- public void completeRefPath_Refs(EObject model, Assignment assignment,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
- super.completeRefPath_Refs(model, assignment, context, acceptor);
-
- if (model instanceof ActorInstanceConfig) {
- completeActorInstanceConfig_Path(model, assignment, context,
- acceptor);
- return;
- }
-
- RefPath path = ((RefPath) model);
- if (path.eContainer() instanceof ActorInstanceConfig) {
- List<ActorRef> instances = collectInstances((ActorInstanceConfig) path
- .eContainer());
- for (ActorRef instance : instances)
- acceptor.accept(createCompletionProposal(instance.getName(),
- context));
- }
- }
-
- private List<ActorRef> collectInstances(ActorInstanceConfig config) {
- List<ActorRef> refs = new ArrayList<ActorRef>();
-
- ActorContainerClass root = config.getSubSystem().getType();
- if (root != null) {
- RefPath path = config.getPath();
- if (path != null && !path.getRefs().isEmpty())
- root = ConfigUtil.resolve(root, path);
- if (root != null) {
- for (ActorContainerRef ref : RoomHelpers.getRefs(root, true)) {
- if (ref instanceof ActorRef) {
- ActorRef aRef = (ActorRef) ref;
- if (aRef.getSize() == 1)
- refs.add((ActorRef) ref);
- }
- }
- }
- }
-
- return refs;
- }
-
- @Override
- public void complete_STRING(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
- Attribute attr = getAttribute(model);
- if (attr != null) {
- LiteralType type = ConfigUtil.getLiteralType(attr);
- if (type != LiteralType.CHAR)
- return;
- }
-
- super.complete_STRING(model, ruleCall, context, acceptor);
- }
-
- @Override
- public void complete_BooleanLiteral(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
- String mult = "";
- Attribute attr = getAttribute(model);
- if (attr != null) {
- mult = (attr.getSize() > 0) ? "[" + attr.getSize() + "]" : "";
- LiteralType type = ConfigUtil.getLiteralType(attr);
- if (type != LiteralType.BOOL)
- return;
- }
-
- acceptor.accept(createCompletionProposal("", "Boolean" + mult, null,
- context));
- acceptor.accept(createCompletionProposal("true", "true", null, context));
- acceptor.accept(createCompletionProposal("false", "false", null,
- context));
- }
-
- @Override
- public void complete_IntLiteral(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
- String mult = "";
- Attribute attr = getAttribute(model);
- if (attr != null) {
- mult = (attr.getSize() > 0) ? "[" + attr.getSize() + "]" : "";
- LiteralType type = ConfigUtil.getLiteralType(attr);
- if (type != LiteralType.INT && type != LiteralType.REAL)
- return;
- }
-
- acceptor.accept(createCompletionProposal("", "Integer" + mult, null,
- context));
- acceptor.accept(createCompletionProposal("", "Hexadecimal" + mult,
- null, context));
- }
-
- @Override
- public void complete_RealLiteral(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
- String mult = "";
- Attribute attr = getAttribute(model);
- if (attr != null) {
- mult = (attr.getSize() > 0) ? "[" + attr.getSize() + "]" : "";
- LiteralType type = ConfigUtil.getLiteralType(attr);
- if (type != LiteralType.REAL)
- return;
- }
-
- acceptor.accept(createCompletionProposal("", "Real" + mult, null,
- context));
- }
-
- @Override
- public void completeKeyword(Keyword keyword,
- ContentAssistContext contentAssistContext,
- ICompletionProposalAcceptor acceptor) {
-
- EObject model = contentAssistContext.getCurrentModel();
- if (model instanceof AttrConfig)
- if (hideKeyword((AttrConfig) model, keyword))
- return;
- if (model instanceof LiteralArray)
- if (hideKeyword((LiteralArray) model, keyword))
- return;
- if (keyword.getValue().equals("true")
- || keyword.getValue().equals("false")) {
- return;
- }
- if (model instanceof AttrInstanceConfig) {
- if (hideKeyword((AttrInstanceConfig) model, keyword))
- return;
- }
-
- super.completeKeyword(keyword, contentAssistContext, acceptor);
- }
-
- private boolean hideKeyword(AttrConfig config, Keyword keyword) {
- LiteralType type = ConfigUtil.getLiteralType(config.getAttribute());
- DataType dataType = config.getAttribute().getRefType().getType();
- if (keyword.getValue().equals("min")
- || keyword.getValue().equals("max")) {
- if (type != LiteralType.INT && type != LiteralType.REAL)
- return true;
- }
- if (keyword.getValue().equals("Attr")) {
- if (!(dataType instanceof PrimitiveType || dataType instanceof DataClass))
- return true;
- }
- if (keyword.getValue().equals("=")) {
- if (!config.getAttribute().eIsProxy())
- if (!(dataType instanceof PrimitiveType))
- return true;
- }
-
- return false;
- }
-
- private boolean hideKeyword(AttrInstanceConfig config, Keyword keyword) {
- if (keyword.getValue().equals("dynamic configuration")) {
- if (!(config.eContainer() instanceof ActorInstanceConfig))
- return true;
- }
-
- return false;
- }
-
- private boolean hideKeyword(LiteralArray array, Keyword keyword) {
- if (keyword.getValue().equals(",")) {
- if (array.eContainer() instanceof AttrConfig) {
- Attribute attr = ((AttrConfig) array.eContainer())
- .getAttribute();
- if (attr.getSize() <= array.getLiterals().size())
- return true;
- if (((PrimitiveType) attr.getRefType().getType()).getType() == LiteralType.CHAR)
- return true;
- }
- }
-
- return false;
- }
-
- private Attribute getAttribute(EObject o) {
- if (o == null)
- return null;
- if (o instanceof Attribute)
- return (Attribute) o;
- if (o instanceof AttrConfig)
- return ((AttrConfig) o).getAttribute();
- else
- return getAttribute(o.eContainer());
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Juergen Haug
+ * 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
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.ui.contentassist;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.config.ActorInstanceConfig;
+import org.eclipse.etrice.core.config.AttrConfig;
+import org.eclipse.etrice.core.config.AttrInstanceConfig;
+import org.eclipse.etrice.core.config.LiteralArray;
+import org.eclipse.etrice.core.config.RefPath;
+import org.eclipse.etrice.core.config.util.ConfigUtil;
+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.Attribute;
+import org.eclipse.etrice.core.room.DataClass;
+import org.eclipse.etrice.core.room.DataType;
+import org.eclipse.etrice.core.room.LiteralType;
+import org.eclipse.etrice.core.room.PrimitiveType;
+import org.eclipse.etrice.core.room.util.RoomHelpers;
+import org.eclipse.xtext.Assignment;
+import org.eclipse.xtext.Keyword;
+import org.eclipse.xtext.RuleCall;
+import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
+import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
+
+/**
+ * see
+ * http://www.eclipse.org/Xtext/documentation/latest/xtext.html#contentAssist on
+ * how to customize content assistant
+ */
+public class ConfigProposalProvider extends AbstractConfigProposalProvider {
+
+ @Override
+ public void completeImport_ImportURI(EObject model, Assignment assignment,
+ final ContentAssistContext context,
+ final ICompletionProposalAcceptor acceptor) {
+ ImportModelAssist.addPaths(this, context, acceptor, ".room");
+ }
+
+ @Override
+ public void completeActorInstanceConfig_Path(EObject model,
+ Assignment assignment, ContentAssistContext context,
+ ICompletionProposalAcceptor acceptor) {
+ super.completeActorInstanceConfig_Path(model, assignment, context,
+ acceptor);
+
+ List<ActorRef> instances = collectInstances(((ActorInstanceConfig) model));
+ for (ActorRef instance : instances)
+ acceptor.accept(createCompletionProposal(instance.getName(),
+ context));
+ }
+
+ @Override
+ public void completeRefPath_Refs(EObject model, Assignment assignment,
+ ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ super.completeRefPath_Refs(model, assignment, context, acceptor);
+
+ if (model instanceof ActorInstanceConfig) {
+ completeActorInstanceConfig_Path(model, assignment, context,
+ acceptor);
+ return;
+ }
+
+ RefPath path = ((RefPath) model);
+ if (path.eContainer() instanceof ActorInstanceConfig) {
+ List<ActorRef> instances = collectInstances((ActorInstanceConfig) path
+ .eContainer());
+ for (ActorRef instance : instances)
+ acceptor.accept(createCompletionProposal(instance.getName(),
+ context));
+ }
+ }
+
+ private List<ActorRef> collectInstances(ActorInstanceConfig config) {
+ List<ActorRef> refs = new ArrayList<ActorRef>();
+
+ ActorContainerClass root = config.getSubSystem().getType();
+ if (root != null) {
+ RefPath path = config.getPath();
+ if (path != null && !path.getRefs().isEmpty())
+ root = ConfigUtil.resolve(root, path);
+ if (root != null) {
+ for (ActorContainerRef ref : RoomHelpers.getRefs(root, true)) {
+ if (ref instanceof ActorRef) {
+ ActorRef aRef = (ActorRef) ref;
+ if (aRef.getSize() == 1)
+ refs.add((ActorRef) ref);
+ }
+ }
+ }
+ }
+
+ return refs;
+ }
+
+ @Override
+ public void complete_STRING(EObject model, RuleCall ruleCall,
+ ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ Attribute attr = getAttribute(model);
+ if (attr != null) {
+ LiteralType type = ConfigUtil.getLiteralType(attr);
+ if (type != LiteralType.CHAR)
+ return;
+ }
+
+ super.complete_STRING(model, ruleCall, context, acceptor);
+ }
+
+ @Override
+ public void complete_BooleanLiteral(EObject model, RuleCall ruleCall,
+ ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ String mult = "";
+ Attribute attr = getAttribute(model);
+ if (attr != null) {
+ mult = (attr.getSize() > 0) ? "[" + attr.getSize() + "]" : "";
+ LiteralType type = ConfigUtil.getLiteralType(attr);
+ if (type != LiteralType.BOOL)
+ return;
+ }
+
+ acceptor.accept(createCompletionProposal("", "Boolean" + mult, null,
+ context));
+ acceptor.accept(createCompletionProposal("true", "true", null, context));
+ acceptor.accept(createCompletionProposal("false", "false", null,
+ context));
+ }
+
+ @Override
+ public void complete_IntLiteral(EObject model, RuleCall ruleCall,
+ ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ String mult = "";
+ Attribute attr = getAttribute(model);
+ if (attr != null) {
+ mult = (attr.getSize() > 0) ? "[" + attr.getSize() + "]" : "";
+ LiteralType type = ConfigUtil.getLiteralType(attr);
+ if (type != LiteralType.INT && type != LiteralType.REAL)
+ return;
+ }
+
+ acceptor.accept(createCompletionProposal("", "Integer" + mult, null,
+ context));
+ acceptor.accept(createCompletionProposal("", "Hexadecimal" + mult,
+ null, context));
+ }
+
+ @Override
+ public void complete_RealLiteral(EObject model, RuleCall ruleCall,
+ ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ String mult = "";
+ Attribute attr = getAttribute(model);
+ if (attr != null) {
+ mult = (attr.getSize() > 0) ? "[" + attr.getSize() + "]" : "";
+ LiteralType type = ConfigUtil.getLiteralType(attr);
+ if (type != LiteralType.REAL)
+ return;
+ }
+
+ acceptor.accept(createCompletionProposal("", "Real" + mult, null,
+ context));
+ }
+
+ @Override
+ public void completeKeyword(Keyword keyword,
+ ContentAssistContext contentAssistContext,
+ ICompletionProposalAcceptor acceptor) {
+
+ EObject model = contentAssistContext.getCurrentModel();
+ if (model instanceof AttrConfig)
+ if (hideKeyword((AttrConfig) model, keyword))
+ return;
+ if (model instanceof LiteralArray)
+ if (hideKeyword((LiteralArray) model, keyword))
+ return;
+ if (keyword.getValue().equals("true")
+ || keyword.getValue().equals("false")) {
+ return;
+ }
+ if (model instanceof AttrInstanceConfig) {
+ if (hideKeyword((AttrInstanceConfig) model, keyword))
+ return;
+ }
+
+ super.completeKeyword(keyword, contentAssistContext, acceptor);
+ }
+
+ private boolean hideKeyword(AttrConfig config, Keyword keyword) {
+ LiteralType type = ConfigUtil.getLiteralType(config.getAttribute());
+ DataType dataType = config.getAttribute().getRefType().getType();
+ if (keyword.getValue().equals("min")
+ || keyword.getValue().equals("max")) {
+ if (type != LiteralType.INT && type != LiteralType.REAL)
+ return true;
+ }
+ if (keyword.getValue().equals("Attr")) {
+ if (!(dataType instanceof PrimitiveType || dataType instanceof DataClass))
+ return true;
+ }
+ if (keyword.getValue().equals("=")) {
+ if (!config.getAttribute().eIsProxy())
+ if (!(dataType instanceof PrimitiveType))
+ return true;
+ }
+
+ return false;
+ }
+
+ private boolean hideKeyword(AttrInstanceConfig config, Keyword keyword) {
+ if (keyword.getValue().equals("dynamic configuration")) {
+ if (!(config.eContainer() instanceof ActorInstanceConfig))
+ return true;
+ }
+
+ return false;
+ }
+
+ private boolean hideKeyword(LiteralArray array, Keyword keyword) {
+ if (keyword.getValue().equals(",")) {
+ if (array.eContainer() instanceof AttrConfig) {
+ Attribute attr = ((AttrConfig) array.eContainer())
+ .getAttribute();
+ if (attr.getSize() <= array.getLiterals().size())
+ return true;
+ if (((PrimitiveType) attr.getRefType().getType()).getType() == LiteralType.CHAR)
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private Attribute getAttribute(EObject o) {
+ if (o == null)
+ return null;
+ if (o instanceof Attribute)
+ return (Attribute) o;
+ if (o instanceof AttrConfig)
+ return ((AttrConfig) o).getAttribute();
+ else
+ return getAttribute(o.eContainer());
+
+ }
+
+}
diff --git a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/labeling/ConfigDescriptionLabelProvider.java b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/labeling/ConfigDescriptionLabelProvider.java
index a92b689f9..3cdc1c622 100644
--- a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/labeling/ConfigDescriptionLabelProvider.java
+++ b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/labeling/ConfigDescriptionLabelProvider.java
@@ -1,27 +1,27 @@
-/*
-* generated by Xtext
-*/
-package org.eclipse.etrice.core.ui.labeling;
-
-import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider;
-
-/**
- * Provides labels for a IEObjectDescriptions and IResourceDescriptions.
- *
- * see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
- */
-public class ConfigDescriptionLabelProvider extends DefaultDescriptionLabelProvider {
-
-/*
- //Labels and icons can be computed like this:
-
- String text(IEObjectDescription ele) {
- return "my "+ele.getName();
- }
-
- String image(IEObjectDescription ele) {
- return ele.getEClass().getName() + ".gif";
- }
-*/
-
-}
+/*
+* generated by Xtext
+*/
+package org.eclipse.etrice.core.ui.labeling;
+
+import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider;
+
+/**
+ * Provides labels for a IEObjectDescriptions and IResourceDescriptions.
+ *
+ * see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
+ */
+public class ConfigDescriptionLabelProvider extends DefaultDescriptionLabelProvider {
+
+/*
+ //Labels and icons can be computed like this:
+
+ String text(IEObjectDescription ele) {
+ return "my "+ele.getName();
+ }
+
+ String image(IEObjectDescription ele) {
+ return ele.getEClass().getName() + ".gif";
+ }
+*/
+
+}
diff --git a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/labeling/ConfigLabelProvider.java b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/labeling/ConfigLabelProvider.java
index c60be4f89..05911c24d 100644
--- a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/labeling/ConfigLabelProvider.java
+++ b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/labeling/ConfigLabelProvider.java
@@ -1,34 +1,34 @@
-/*
-* generated by Xtext
-*/
-package org.eclipse.etrice.core.ui.labeling;
-
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider;
-
-import com.google.inject.Inject;
-
-/**
- * Provides labels for a EObjects.
- *
- * see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
- */
-public class ConfigLabelProvider extends DefaultEObjectLabelProvider {
-
- @Inject
- public ConfigLabelProvider(AdapterFactoryLabelProvider delegate) {
- super(delegate);
- }
-
-/*
- //Labels and icons can be computed like this:
-
- String text(MyModel ele) {
- return "my "+ele.getName();
- }
-
- String image(MyModel ele) {
- return "MyModel.gif";
- }
-*/
-}
+/*
+* generated by Xtext
+*/
+package org.eclipse.etrice.core.ui.labeling;
+
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider;
+
+import com.google.inject.Inject;
+
+/**
+ * Provides labels for a EObjects.
+ *
+ * see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
+ */
+public class ConfigLabelProvider extends DefaultEObjectLabelProvider {
+
+ @Inject
+ public ConfigLabelProvider(AdapterFactoryLabelProvider delegate) {
+ super(delegate);
+ }
+
+/*
+ //Labels and icons can be computed like this:
+
+ String text(MyModel ele) {
+ return "my "+ele.getName();
+ }
+
+ String image(MyModel ele) {
+ return "MyModel.gif";
+ }
+*/
+}
diff --git a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/linking/ConfigHyperlinkHelper.java b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/linking/ConfigHyperlinkHelper.java
index ce7c5f47a..e8491aadd 100644
--- a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/linking/ConfigHyperlinkHelper.java
+++ b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/linking/ConfigHyperlinkHelper.java
@@ -1,74 +1,74 @@
-/*******************************************************************************
- * Copyright (c) 2012 Juergen Haug
- * 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
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.ui.linking;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.config.ActorInstanceConfig;
-import org.eclipse.etrice.core.room.ActorContainerClass;
-import org.eclipse.etrice.core.room.ActorRef;
-import org.eclipse.jface.text.Region;
-import org.eclipse.xtext.AbstractRule;
-import org.eclipse.xtext.RuleCall;
-import org.eclipse.xtext.nodemodel.ILeafNode;
-import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
-import org.eclipse.xtext.parser.IParseResult;
-import org.eclipse.xtext.resource.XtextResource;
-import org.eclipse.xtext.ui.editor.hyperlinking.IHyperlinkAcceptor;
-
-public class ConfigHyperlinkHelper extends ImportAwareHyperlinkHelper {
-
- @Override
- public void createHyperlinksByOffset(XtextResource resource, int offset,
- IHyperlinkAcceptor acceptor) {
- IParseResult parseResult = resource.getParseResult();
- if (parseResult != null && parseResult.getRootNode() != null) {
- ILeafNode leaf = NodeModelUtils.findLeafNodeAtOffset(
- parseResult.getRootNode(), offset);
- EObject grammarElement = leaf.getParent().getGrammarElement();
- if (grammarElement instanceof RuleCall) {
- RuleCall rc = (RuleCall) grammarElement;
- AbstractRule rule = rc.getRule();
-
- EObject crossLinkedEObject = null;
- if (rule.getName().equals("RefPath")) {
- EObject parent = leaf.getSemanticElement().eContainer();
- if (parent instanceof ActorInstanceConfig) {
- crossLinkedEObject = getCrossLinkedEObject((ActorInstanceConfig) parent);
- }
- }
- if (crossLinkedEObject != null) {
- Region region = new Region(leaf.getOffset(), leaf.getLength());
- createHyperlinksTo(resource, region, crossLinkedEObject,
- acceptor);
- }
- }
- }
-
- super.createHyperlinksByOffset(resource, offset, acceptor);
- }
-
- private EObject getCrossLinkedEObject(ActorInstanceConfig config) {
- ActorContainerClass lastAcContainer = config.getSubSystem().getType();
- ActorRef lastRef = null;
- for (String ref : config.getPath().getRefs()) {
- for (ActorRef r : lastAcContainer.getActorRefs())
- if (r.getName().equals(ref)) {
- lastRef = r;
- lastAcContainer = lastRef.getType();
- break;
- }
- }
-
- return lastRef;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Juergen Haug
+ * 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
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.ui.linking;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.config.ActorInstanceConfig;
+import org.eclipse.etrice.core.room.ActorContainerClass;
+import org.eclipse.etrice.core.room.ActorRef;
+import org.eclipse.jface.text.Region;
+import org.eclipse.xtext.AbstractRule;
+import org.eclipse.xtext.RuleCall;
+import org.eclipse.xtext.nodemodel.ILeafNode;
+import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
+import org.eclipse.xtext.parser.IParseResult;
+import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.ui.editor.hyperlinking.IHyperlinkAcceptor;
+
+public class ConfigHyperlinkHelper extends ImportAwareHyperlinkHelper {
+
+ @Override
+ public void createHyperlinksByOffset(XtextResource resource, int offset,
+ IHyperlinkAcceptor acceptor) {
+ IParseResult parseResult = resource.getParseResult();
+ if (parseResult != null && parseResult.getRootNode() != null) {
+ ILeafNode leaf = NodeModelUtils.findLeafNodeAtOffset(
+ parseResult.getRootNode(), offset);
+ EObject grammarElement = leaf.getParent().getGrammarElement();
+ if (grammarElement instanceof RuleCall) {
+ RuleCall rc = (RuleCall) grammarElement;
+ AbstractRule rule = rc.getRule();
+
+ EObject crossLinkedEObject = null;
+ if (rule.getName().equals("RefPath")) {
+ EObject parent = leaf.getSemanticElement().eContainer();
+ if (parent instanceof ActorInstanceConfig) {
+ crossLinkedEObject = getCrossLinkedEObject((ActorInstanceConfig) parent);
+ }
+ }
+ if (crossLinkedEObject != null) {
+ Region region = new Region(leaf.getOffset(), leaf.getLength());
+ createHyperlinksTo(resource, region, crossLinkedEObject,
+ acceptor);
+ }
+ }
+ }
+
+ super.createHyperlinksByOffset(resource, offset, acceptor);
+ }
+
+ private EObject getCrossLinkedEObject(ActorInstanceConfig config) {
+ ActorContainerClass lastAcContainer = config.getSubSystem().getType();
+ ActorRef lastRef = null;
+ for (String ref : config.getPath().getRefs()) {
+ for (ActorRef r : lastAcContainer.getActorRefs())
+ if (r.getName().equals(ref)) {
+ lastRef = r;
+ lastAcContainer = lastRef.getType();
+ break;
+ }
+ }
+
+ return lastRef;
+ }
+}
diff --git a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/outline/ConfigOutlineTreeProvider.java b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/outline/ConfigOutlineTreeProvider.java
index 5498616f9..e653b972e 100644
--- a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/outline/ConfigOutlineTreeProvider.java
+++ b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/outline/ConfigOutlineTreeProvider.java
@@ -1,14 +1,14 @@
-/*
-* generated by Xtext
-*/
-package org.eclipse.etrice.core.ui.outline;
-
-import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider;
-
-/**
- * customization of the default outline structure
- *
- */
-public class ConfigOutlineTreeProvider extends DefaultOutlineTreeProvider {
-
-}
+/*
+* generated by Xtext
+*/
+package org.eclipse.etrice.core.ui.outline;
+
+import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider;
+
+/**
+ * customization of the default outline structure
+ *
+ */
+public class ConfigOutlineTreeProvider extends DefaultOutlineTreeProvider {
+
+}
diff --git a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/quickfix/ConfigQuickfixProvider.java b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/quickfix/ConfigQuickfixProvider.java
index 28bfedce9..3febfcd8b 100644
--- a/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/quickfix/ConfigQuickfixProvider.java
+++ b/plugins/org.eclipse.etrice.core.config.ui/src/org/eclipse/etrice/core/ui/quickfix/ConfigQuickfixProvider.java
@@ -1,19 +1,19 @@
-
-package org.eclipse.etrice.core.ui.quickfix;
-
-import org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider;
-
-public class ConfigQuickfixProvider extends DefaultQuickfixProvider {
-
-// @Fix(MyJavaValidator.INVALID_NAME)
-// public void capitalizeName(final Issue issue, IssueResolutionAcceptor acceptor) {
-// acceptor.accept(issue, "Capitalize name", "Capitalize the name.", "upcase.png", new IModification() {
-// public void apply(IModificationContext context) throws BadLocationException {
-// IXtextDocument xtextDocument = context.getXtextDocument();
-// String firstLetter = xtextDocument.get(issue.getOffset(), 1);
-// xtextDocument.replace(issue.getOffset(), 1, firstLetter.toUpperCase());
-// }
-// });
-// }
-
-}
+
+package org.eclipse.etrice.core.ui.quickfix;
+
+import org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider;
+
+public class ConfigQuickfixProvider extends DefaultQuickfixProvider {
+
+// @Fix(MyJavaValidator.INVALID_NAME)
+// public void capitalizeName(final Issue issue, IssueResolutionAcceptor acceptor) {
+// acceptor.accept(issue, "Capitalize name", "Capitalize the name.", "upcase.png", new IModification() {
+// public void apply(IModificationContext context) throws BadLocationException {
+// IXtextDocument xtextDocument = context.getXtextDocument();
+// String firstLetter = xtextDocument.get(issue.getOffset(), 1);
+// xtextDocument.replace(issue.getOffset(), 1, firstLetter.toUpperCase());
+// }
+// });
+// }
+
+}

Back to the top