diff --git a/org.eclipse.triquetrum.commands.api/src/main/java/org/eclipse/triquetrum/commands/api/TqCLServices.java b/org.eclipse.triquetrum.commands.api/src/main/java/org/eclipse/triquetrum/commands/api/TqCLServices.java index 0834e1f3..866b7b05 100644 --- a/org.eclipse.triquetrum.commands.api/src/main/java/org/eclipse/triquetrum/commands/api/TqCLServices.java +++ b/org.eclipse.triquetrum.commands.api/src/main/java/org/eclipse/triquetrum/commands/api/TqCLServices.java @@ -26,6 +26,8 @@ public class TqCLServices implements BundleActivator { private static BundleContext context; private static TqCLServices instance; + + private TcQLLibraryProviderProxy tcQLLibraryProviderProxy; static BundleContext getContext() { return context; @@ -40,6 +42,9 @@ static BundleContext getContext() { public void start(BundleContext bundleContext) throws Exception { TqCLServices.context = bundleContext; instance=this; + + ServiceReference serviceReference = getContext().getServiceReference(TcQLLibraryProviderProxy.class); + tcQLLibraryProviderProxy = getContext().getService(serviceReference); } /* @@ -80,9 +85,7 @@ public ModelBuilderService getModelBuilderService(Class modelClass) { public TqCLLibraryProvider getTqclLibraryProvider() { - ServiceReference serviceReference = getContext().getServiceReference(TcQLLibraryProviderProxy.class); - TcQLLibraryProviderProxy service = getContext().getService(serviceReference); - return service; + return tcQLLibraryProviderProxy; } diff --git a/org.eclipse.triquetrum.workflow.editor/src/main/java/org/eclipse/triquetrum/workflow/editor/TriquetrumLibraryProvider.java b/org.eclipse.triquetrum.workflow.editor/src/main/java/org/eclipse/triquetrum/workflow/editor/TriquetrumLibraryProvider.java index 07417335..338aa357 100644 --- a/org.eclipse.triquetrum.workflow.editor/src/main/java/org/eclipse/triquetrum/workflow/editor/TriquetrumLibraryProvider.java +++ b/org.eclipse.triquetrum.workflow.editor/src/main/java/org/eclipse/triquetrum/workflow/editor/TriquetrumLibraryProvider.java @@ -12,6 +12,8 @@ import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.Platform; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.widgets.Display; import org.eclipse.triquetrum.commands.api.services.ActorDescriptor; import org.eclipse.triquetrum.commands.api.services.DirectorDescriptor; import org.eclipse.triquetrum.commands.api.services.EntityDescriptor; @@ -41,7 +43,11 @@ public class TriquetrumLibraryProvider implements TqCLLibraryProvider { private Map ports = new HashMap<>(); private boolean initialized = false; - + + public TriquetrumLibraryProvider() { + init(); + } + private void init() { if (initialized) { return; @@ -176,32 +182,27 @@ public void fillPorts(ActorDescriptor actorDescriptor, Entity entity) { @Override public List getActors(String library) throws TqCLLibraryException { - init(); return new ArrayList<>(actors.values()); } @Override public List getDirectors(String library) throws TqCLLibraryException { - init(); return new ArrayList<>(directors.values()); } @Override public List getParameterTypes(String library) throws TqCLLibraryException { - init(); return new ArrayList<>(parameters.values()); } @Override public List getPortTypes(String library) throws TqCLLibraryException { - init(); return new ArrayList<>(ports.values()); } @Override public List getActorPorts(String actor) throws TqCLLibraryException { - init(); return actors.get(actor).getPorts(); } @@ -243,7 +244,6 @@ public DirectorDescriptor getDirector(String directorClass) throws TqCLLibraryEx @Override public boolean hasElementInLibrary(String element, String library, String category) { - init(); if (getLibraryNames().contains(library)) { BoCategory boCategory = BoCategory.valueOf(StringUtils.capitalize(category)); switch (boCategory) {