Skip to content

Commit

Permalink
eclipse-archived#190 TqCL: Fixed deadlock restoring editor at eclipse…
Browse files Browse the repository at this point in the history
… startup

Signed-off-by: Rodolfo Totaro <[email protected]>
  • Loading branch information
rtotaro committed Feb 14, 2017
1 parent 3d3a036 commit b988c50
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -40,6 +42,9 @@ static BundleContext getContext() {
public void start(BundleContext bundleContext) throws Exception {
TqCLServices.context = bundleContext;
instance=this;

ServiceReference<TcQLLibraryProviderProxy> serviceReference = getContext().getServiceReference(TcQLLibraryProviderProxy.class);
tcQLLibraryProviderProxy = getContext().getService(serviceReference);
}

/*
Expand Down Expand Up @@ -80,9 +85,7 @@ public ModelBuilderService getModelBuilderService(Class<?> modelClass) {

public TqCLLibraryProvider getTqclLibraryProvider()
{
ServiceReference<TcQLLibraryProviderProxy> serviceReference = getContext().getServiceReference(TcQLLibraryProviderProxy.class);
TcQLLibraryProviderProxy service = getContext().getService(serviceReference);
return service;
return tcQLLibraryProviderProxy;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -41,7 +43,11 @@ public class TriquetrumLibraryProvider implements TqCLLibraryProvider {
private Map<String, PortDescriptor> ports = new HashMap<>();

private boolean initialized = false;


public TriquetrumLibraryProvider() {
init();
}

private void init() {
if (initialized) {
return;
Expand Down Expand Up @@ -176,32 +182,27 @@ public void fillPorts(ActorDescriptor actorDescriptor, Entity<?> entity) {

@Override
public List<ActorDescriptor> getActors(String library) throws TqCLLibraryException {
init();
return new ArrayList<>(actors.values());
}

@Override
public List<DirectorDescriptor> getDirectors(String library) throws TqCLLibraryException {
init();
return new ArrayList<>(directors.values());
}

@Override
public List<ParameterDescriptor> getParameterTypes(String library) throws TqCLLibraryException {

init();
return new ArrayList<>(parameters.values());
}

@Override
public List<PortDescriptor> getPortTypes(String library) throws TqCLLibraryException {
init();
return new ArrayList<>(ports.values());
}

@Override
public List<PortDescriptor> getActorPorts(String actor) throws TqCLLibraryException {
init();
return actors.get(actor).getPorts();
}

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit b988c50

Please sign in to comment.