Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2015-03-02 07:25:17 +0000
committerHenrik Rentz-Reichert2015-03-02 07:25:17 +0000
commit498a52105e6b123d1b7aa15f431b94f8477ba7d9 (patch)
tree6cfbdff3bd60b4e4d0ea676dddfb499f6a55a3cc
parentc530eac9a80d5d97654f480818c22ea473bc6ced (diff)
downloadorg.eclipse.etrice-498a52105e6b123d1b7aa15f431b94f8477ba7d9.tar.gz
org.eclipse.etrice-498a52105e6b123d1b7aa15f431b94f8477ba7d9.tar.xz
org.eclipse.etrice-498a52105e6b123d1b7aa15f431b94f8477ba7d9.zip
[ui.behavior.actioneditor] proposals for attributes and operations with
different icons Change-Id: If9babc437f25a343309435a129d8221b010c65d1
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior.actioneditor/src/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/ActionCodeAssistProcessor.java9
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior.actioneditor/src/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/ActionCodeParser.java77
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior.actioneditor/src/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/ActionCodeScanner.java2
3 files changed, 36 insertions, 52 deletions
diff --git a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/src/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/ActionCodeAssistProcessor.java b/plugins/org.eclipse.etrice.ui.behavior.actioneditor/src/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/ActionCodeAssistProcessor.java
index 718c286ac..6977b5ab6 100644
--- a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/src/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/ActionCodeAssistProcessor.java
+++ b/plugins/org.eclipse.etrice.ui.behavior.actioneditor/src/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/ActionCodeAssistProcessor.java
@@ -180,13 +180,18 @@ public class ActionCodeAssistProcessor implements IContentAssistProcessor {
Assert.isNotNull(fConfiguration);
List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
- for (String item : fConfiguration.getActionCodeParser()
- .getAllMemberNames()) {
+ for (String item : fConfiguration.getActionCodeParser().getAllAttributeNames()) {
ICompletionProposal proposal = createPrefixCompletionProposal(
context, item, Activator.getImage("icons/member.gif"));
if (proposal != null)
proposals.add(proposal);
}
+ for (String item : fConfiguration.getActionCodeParser().getAllOperationNames()) {
+ ICompletionProposal proposal = createPrefixCompletionProposal(
+ context, item, Activator.getImage("icons/method.gif"));
+ if (proposal != null)
+ proposals.add(proposal);
+ }
return proposals;
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/src/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/ActionCodeParser.java b/plugins/org.eclipse.etrice.ui.behavior.actioneditor/src/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/ActionCodeParser.java
index a0c011128..fd58311ce 100644
--- a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/src/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/ActionCodeParser.java
+++ b/plugins/org.eclipse.etrice.ui.behavior.actioneditor/src/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/ActionCodeParser.java
@@ -17,7 +17,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-import org.eclipse.emf.common.util.EList;
import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.Attribute;
import org.eclipse.etrice.core.room.CommunicationType;
@@ -27,7 +26,6 @@ import org.eclipse.etrice.core.room.Operation;
import org.eclipse.etrice.core.room.Port;
import org.eclipse.etrice.core.room.PortClass;
import org.eclipse.etrice.core.room.PortOperation;
-import org.eclipse.etrice.core.room.StandardOperation;
import org.eclipse.etrice.core.room.util.RoomHelpers;
import org.eclipse.etrice.ui.behavior.support.SupportUtil;
@@ -41,14 +39,11 @@ import org.eclipse.etrice.ui.behavior.support.SupportUtil;
public class ActionCodeParser {
/** the actor class */
- ActorClass ac;
+ private ActorClass ac;
/** use receive only messages */
- boolean recvOnly;
+ private boolean recvOnly;
/** map for interface items and associated messages or operations */
- HashMap<InterfaceItem, List<MethodItemPair>> item2pairs;
- /** array of objects for members */
- Object[] members;
-
+ private HashMap<InterfaceItem, List<MethodItemPair>> item2pairs;
public ActionCodeParser(ActorClass ac, boolean recvOnly) {
this.ac = ac;
this.recvOnly = recvOnly;
@@ -150,35 +145,6 @@ public class ActionCodeParser {
}
/**
- * Gets the list of all interface items in the associated actor class.
- *
- * @return list of {@link InterfaceItem}s
- */
- public List<InterfaceItem> getAllInterfaceItems() {
- return new ArrayList<InterfaceItem>(item2pairs.keySet());
- }
-
- /**
- * Constructs an array of members in the associated actor class.
- *
- * @return array of members
- */
- public Object[] getMembers() {
- if (members == null) {
- EList<Attribute> attributes = ac.getAttributes();
- EList<StandardOperation> operations = ac.getOperations();
-
- members = new Object[attributes.size() + operations.size()];
- System.arraycopy(attributes.toArray(), 0, members, 0,
- attributes.size());
- System.arraycopy(operations.toArray(), 0, members,
- attributes.size(), operations.size());
- }
-
- return members;
- }
-
- /**
* Gets the list of the names of all {@link InterfaceItem} in the associated
* actor class.
*
@@ -213,21 +179,34 @@ public class ActionCodeParser {
}
/**
- * Gets a list of the name of all members in the associated actor class.
+ * Gets a list of the name of all attributes in the associated actor class.
+ *
+ * @return list of attribute names
+ */
+ public List<String> getAllAttributeNames() {
+ RoomHelpers roomHelpers = SupportUtil.getInstance().getRoomHelpers();
+ List<String> result = new ArrayList<String>();
+ for (Attribute att : roomHelpers.getAllAttributes(ac)) {
+ result.add(att.getName());
+ }
+ return result;
+ }
+
+ /**
+ * returns a list of all (including inherited) operation names including signature
*
- * @return list of member names
+ * @return list of all operation names (including signature)
*/
- public List<String> getAllMemberNames() {
- List<String> memberList = new ArrayList<String>();
- for (Object member : getMembers()) {
- if (member instanceof Attribute)
- memberList.add(((Attribute) member).getName());
- else if (member instanceof Operation)
- memberList.add(((Operation) member).getName()
- + SupportUtil.getInstance().getRoomNameProvider()
- .getTypedArgumentList((Operation) member));
+ public List<String> getAllOperationNames() {
+ RoomHelpers roomHelpers = SupportUtil.getInstance().getRoomHelpers();
+ List<String> result = new ArrayList<String>();
+ for (Operation op : roomHelpers.getAllOperations(ac)) {
+ result.add(op.getName()
+ + SupportUtil.getInstance().getRoomNameProvider()
+ .getTypedArgumentList(op));
}
- return memberList;
+
+ return result;
}
/**
diff --git a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/src/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/ActionCodeScanner.java b/plugins/org.eclipse.etrice.ui.behavior.actioneditor/src/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/ActionCodeScanner.java
index 70a4e49a4..c22f0a1f0 100644
--- a/plugins/org.eclipse.etrice.ui.behavior.actioneditor/src/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/ActionCodeScanner.java
+++ b/plugins/org.eclipse.etrice.ui.behavior.actioneditor/src/org/eclipse/etrice/ui/behavior/actioneditor/sourceviewer/ActionCodeScanner.java
@@ -84,7 +84,7 @@ public class ActionCodeScanner extends RuleBasedScanner {
// Add word to wordRule rule for each Member names.
if (configuration.isMemberAware())
for (String member : configuration.getActionCodeParser()
- .getAllMemberNames())
+ .getAllAttributeNames())
wordRule.addWord(member, memberToken);
// Add wordRule to the list of rules.

Back to the top