|
21 | 21 | import java.util.Map.Entry;
|
22 | 22 |
|
23 | 23 | import org.apache.commons.lang.StringUtils;
|
| 24 | +import org.eclipse.emf.common.util.EList; |
24 | 25 | import org.eclipse.emf.ecore.EObject;
|
25 | 26 | import org.eclipse.graphiti.features.ICreateFeature;
|
26 | 27 | import org.eclipse.jface.text.contentassist.ICompletionProposal;
|
|
31 | 32 | import org.eclipse.triquetrum.commands.api.services.TqCLLibraryProvider;
|
32 | 33 | import org.eclipse.triquetrum.commands.tqcl.Category;
|
33 | 34 | import org.eclipse.triquetrum.commands.tqcl.Insert;
|
| 35 | +import org.eclipse.triquetrum.commands.tqcl.Library; |
| 36 | +import org.eclipse.triquetrum.commands.tqcl.TriquetrumScript; |
34 | 37 | import org.eclipse.triquetrum.workflow.editor.TriqDiagramTypeProvider;
|
35 | 38 | import org.eclipse.triquetrum.workflow.editor.TriqFeatureProvider;
|
36 | 39 | import org.eclipse.triquetrum.workflow.editor.features.ModelElementCreateFeature;
|
@@ -70,29 +73,37 @@ private void initFeatureMap() {
|
70 | 73 | }
|
71 | 74 | }
|
72 | 75 |
|
| 76 | + @SuppressWarnings({ "rawtypes", "unchecked" }) |
73 | 77 | @Override
|
74 | 78 | public void completeInsert_Obj(EObject model, Assignment assignment, ContentAssistContext context,
|
75 | 79 | ICompletionProposalAcceptor acceptor) {
|
76 | 80 |
|
77 | 81 | try {
|
78 | 82 | Insert insert = (Insert) model;
|
| 83 | + TriquetrumScript triquetrumScript = (TriquetrumScript) insert.eContainer(); |
| 84 | + EList<Library> libraries = triquetrumScript.getLibraries(); |
79 | 85 | TqCLLibraryProvider tcqlLibraryProvider = TqCLServices.getInstance().getTcqlLibraryProvider();
|
80 | 86 | Category category = insert.getCategory();
|
| 87 | + List<? extends EntityDescriptor> descriptors = new ArrayList<>(); |
| 88 | + if (libraries == null) { |
| 89 | + return; |
| 90 | + } |
81 | 91 | if (insert.getCategory() == null) {
|
82 | 92 | category = Category.ACTOR;
|
83 | 93 | }
|
84 |
| - List<? extends EntityDescriptor> descriptors = new ArrayList<>(); |
85 |
| - switch (category) { |
86 |
| - case ACTOR: |
87 |
| - descriptors = tcqlLibraryProvider.getActors("Triquetrum"); |
88 |
| - break; |
89 |
| - |
90 |
| - case DIRECTOR: |
91 |
| - descriptors = tcqlLibraryProvider.getDirectors("Triquetrum"); |
92 |
| - break; |
93 |
| - |
94 |
| - default: |
95 |
| - break; |
| 94 | + for (Library library : libraries) { |
| 95 | + switch (category) { |
| 96 | + case ACTOR: |
| 97 | + descriptors.addAll((List) tcqlLibraryProvider.getActors(library.getName())); |
| 98 | + break; |
| 99 | + |
| 100 | + case DIRECTOR: |
| 101 | + descriptors.addAll((List) tcqlLibraryProvider.getDirectors(library.getName())); |
| 102 | + break; |
| 103 | + |
| 104 | + default: |
| 105 | + break; |
| 106 | + } |
96 | 107 | }
|
97 | 108 | for (EntityDescriptor key : descriptors) {
|
98 | 109 | ICompletionProposal completionProposal = createCompletionProposal(key.getClazz(), context);
|
|
0 commit comments