diff --git a/org.eclipse.triquetrum.commands.xtext.ui/src/main/java/org/eclipse/triquetrum/commands/ui/contentassist/TqclProposalProvider.java b/org.eclipse.triquetrum.commands.xtext.ui/src/main/java/org/eclipse/triquetrum/commands/ui/contentassist/TqclProposalProvider.java index 17018a2f..a73f1da7 100644 --- a/org.eclipse.triquetrum.commands.xtext.ui/src/main/java/org/eclipse/triquetrum/commands/ui/contentassist/TqclProposalProvider.java +++ b/org.eclipse.triquetrum.commands.xtext.ui/src/main/java/org/eclipse/triquetrum/commands/ui/contentassist/TqclProposalProvider.java @@ -21,6 +21,7 @@ import java.util.Map.Entry; import org.apache.commons.lang.StringUtils; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.graphiti.features.ICreateFeature; import org.eclipse.jface.text.contentassist.ICompletionProposal; @@ -31,6 +32,8 @@ import org.eclipse.triquetrum.commands.api.services.TqCLLibraryProvider; import org.eclipse.triquetrum.commands.tqcl.Category; import org.eclipse.triquetrum.commands.tqcl.Insert; +import org.eclipse.triquetrum.commands.tqcl.Library; +import org.eclipse.triquetrum.commands.tqcl.TriquetrumScript; import org.eclipse.triquetrum.workflow.editor.TriqDiagramTypeProvider; import org.eclipse.triquetrum.workflow.editor.TriqFeatureProvider; import org.eclipse.triquetrum.workflow.editor.features.ModelElementCreateFeature; @@ -70,29 +73,37 @@ private void initFeatureMap() { } } + @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void completeInsert_Obj(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { try { Insert insert = (Insert) model; + TriquetrumScript triquetrumScript = (TriquetrumScript) insert.eContainer(); + EList libraries = triquetrumScript.getLibraries(); TqCLLibraryProvider tcqlLibraryProvider = TqCLServices.getInstance().getTcqlLibraryProvider(); Category category = insert.getCategory(); + List descriptors = new ArrayList<>(); + if (libraries == null) { + return; + } if (insert.getCategory() == null) { category = Category.ACTOR; } - List descriptors = new ArrayList<>(); - switch (category) { - case ACTOR: - descriptors = tcqlLibraryProvider.getActors("Triquetrum"); - break; - - case DIRECTOR: - descriptors = tcqlLibraryProvider.getDirectors("Triquetrum"); - break; - - default: - break; + for (Library library : libraries) { + switch (category) { + case ACTOR: + descriptors.addAll((List) tcqlLibraryProvider.getActors(library.getName())); + break; + + case DIRECTOR: + descriptors.addAll((List) tcqlLibraryProvider.getDirectors(library.getName())); + break; + + default: + break; + } } for (EntityDescriptor key : descriptors) { ICompletionProposal completionProposal = createCompletionProposal(key.getClazz(), context);