import jalview.ws.seqfetcher.DbSourceProxy;
import jalview.ws2.client.api.WebServiceDiscovererI;
import jalview.ws2.client.ebi.JobDispatcherWSDiscoverer;
+import jalview.ws2.client.jpred4.JPred4WSDiscoverer;
import jalview.ws2.client.slivka.SlivkaWSDiscoverer;
import jalview.ws2.gui.WebServicesMenuManager;
menu.setInProgress(discoverer.isRunning());
menu.setNoServices(services.isEmpty() && discoverer.isDone());
};
+
+ private WebServiceDiscovererI.ServicesChangeListener jpred4ServiceChangeListener =
+ (discoverer, services) -> {
+ // run when jpred4 services change
+ var menu = AlignFrame.this.jpred4Menu;
+ menu.setServices(discoverer);
+ menu.setInProgress(discoverer.isRunning());
+ menu.setNoServices(services.isEmpty() && discoverer.isDone());
+ };
/* Set up intrinsic listeners for dynamically generated GUI bits. */
private void addServiceListeners()
{
JobDispatcherWSDiscoverer.getInstance().addServicesChangeListener(ebiServiceChangeListener);
}
+ if (Cache.getDefault("SHOW_JPRED4_SERVICES", true))
+ {
+ JPred4WSDiscoverer.getInstance().addServicesChangeListener(jpred4ServiceChangeListener);
+ }
if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
{
WSDiscovererI discoverer = Jws2Discoverer.getInstance();
public void internalFrameClosed(InternalFrameEvent e) {
System.out.println("deregistering discoverer listener");
SlivkaWSDiscoverer.getInstance().removeServicesChangeListener(slivkaServiceChangeListener);
+ JPred4WSDiscoverer.getInstance().removeServicesChangeListener(jpred4ServiceChangeListener);
Jws2Discoverer.getInstance().removeServiceChangeListener(AlignFrame.this);
Desktop.getInstance().removeJalviewPropertyChangeListener("services", legacyListener);
closeMenuItem_actionPerformed(true);
private WebServicesMenuManager slivkaMenu = new WebServicesMenuManager("slivka", this);
private WebServicesMenuManager ebiMenu = new WebServicesMenuManager("job dispatcher", this);
+ private WebServicesMenuManager jpred4Menu = new WebServicesMenuManager("jpred4", this);
/**
* Schedule the web services menu rebuild to the event dispatch thread.
ebiMenu.setNoServices(discoverer.isDone() && !discoverer.hasServices());
webService.add(ebiMenu.getMenu());
}
+ if (Cache.getDefault("SHOW_JPRED4_SERVICES", true))
+ {
+ Console.info("Building web services menu for jpred4");
+ JPred4WSDiscoverer discoverer = JPred4WSDiscoverer.getInstance();
+ jpred4Menu.setServices(discoverer);
+ jpred4Menu.setInProgress(discoverer.isRunning());
+ jpred4Menu.setNoServices(discoverer.isDone() && !discoverer.hasServices());
+ webService.add(jpred4Menu.getMenu());
+ }
if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
{
WSDiscovererI jws2servs = Jws2Discoverer.getInstance();
package jalview.ws2.actions;
import java.util.EnumSet;
+import java.util.List;
import java.util.Objects;
+import jalview.gui.AlignViewport;
+import jalview.viewmodel.AlignmentViewport;
+import jalview.ws.params.ArgumentI;
import jalview.ws2.actions.api.ActionI;
+import jalview.ws2.actions.api.TaskEventListener;
+import jalview.ws2.actions.api.TaskI;
import jalview.ws2.api.CredentialType;
+import jalview.ws2.api.Credentials;
import jalview.ws2.api.WebService;
/**
import jalview.ws.params.ArgumentI;
import jalview.ws.params.ParamDatastoreI;
import jalview.ws.params.WsParamSetI;
+import jalview.ws2.actions.BaseAction;
import jalview.ws2.actions.BaseTask;
import jalview.ws2.actions.PollingTaskExecutor;
import jalview.ws2.actions.alignment.AlignmentAction;
import jalview.ws2.actions.api.TaskEventListener;
import jalview.ws2.actions.api.TaskI;
import jalview.ws2.actions.hmmer.PhmmerAction;
+import jalview.ws2.actions.secstructpred.SecStructPredAction;
import jalview.ws2.api.Credentials;
import jalview.ws2.api.WebService;
import jalview.ws2.client.api.WebServiceProviderI;
calcManager.startWorker(worker);
return;
}
- if (action instanceof PhmmerAction)
+ if (action instanceof PhmmerAction || action instanceof SecStructPredAction)
{
- var _action = (PhmmerAction) action;
+ var _action = (BaseAction<AlignmentI>) action;
var handler = new SearchServiceGuiHandler(_action, frame);
- TaskI<AlignmentI> task = _action.createTask(viewport, args, credentials);
+ var task = (BaseTask<?, AlignmentI>) _action // FIXME: unsafe cast
+ .createTask(viewport, args, credentials);
var executor = PollingTaskExecutor.fromPool(viewport.getServiceExecutor());
task.addTaskEventListener(handler);
- _action.perform(viewport, args, credentials, handler);
+ var future = executor.submit(task);
+ task.setCancelAction(() -> {
+ future.cancel(true);
+ });
return;
}
Console.warn(String.format(