git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-4107 fix merge and avoid NPE
[jalview.git]
/
src
/
jalview
/
ws
/
jws2
/
Jws2ClientFactory.java
diff --git
a/src/jalview/ws/jws2/Jws2ClientFactory.java
b/src/jalview/ws/jws2/Jws2ClientFactory.java
index
2a38b85
..
8a4f9fb
100644
(file)
--- a/
src/jalview/ws/jws2/Jws2ClientFactory.java
+++ b/
src/jalview/ws/jws2/Jws2ClientFactory.java
@@
-1,12
+1,15
@@
package jalview.ws.jws2;
package jalview.ws.jws2;
+import jalview.api.AlignCalcManagerI2;
import jalview.api.AlignCalcWorkerI;
import jalview.bin.Cache;
import jalview.api.AlignCalcWorkerI;
import jalview.bin.Cache;
+import jalview.bin.Console;
import jalview.gui.AlignFrame;
import jalview.gui.JvSwingUtils;
import jalview.util.MessageManager;
import jalview.ws.api.ServiceWithParameters;
import jalview.ws.jws2.dm.AAConSettings;
import jalview.gui.AlignFrame;
import jalview.gui.JvSwingUtils;
import jalview.util.MessageManager;
import jalview.ws.api.ServiceWithParameters;
import jalview.ws.jws2.dm.AAConSettings;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
import jalview.ws.params.AutoCalcSetting;
import jalview.ws.uimodel.AlignAnalysisUIText;
import jalview.ws.params.AutoCalcSetting;
import jalview.ws.uimodel.AlignAnalysisUIText;
@@
-49,24
+52,28
@@
public class Jws2ClientFactory
// is there an aaCon worker already present - if so, set it to use the
// given service handle
{
// is there an aaCon worker already present - if so, set it to use the
// given service handle
{
- List<AlignCalcWorkerI> aaconClient = alignFrame.getViewport()
- .getCalcManager()
- .getRegisteredWorkersOfClass(aaui.getClient());
- if (aaconClient != null && aaconClient.size() > 0)
+ AlignCalcManagerI2 mger = alignFrame.getViewport()
+ .getCalcManager();
+ if (mger != null)
{
{
- SeqAnnotationServiceCalcWorker worker = (SeqAnnotationServiceCalcWorker) aaconClient
- .get(0);
- if (!worker.service.getHostURL().equals(service.getHostURL()))
+ List<AlignCalcWorkerI> aaconClient = mger
+ .getWorkersOfClass(aaui.getClient());
+ if (aaconClient != null && aaconClient.size() > 0)
{
{
- // javax.swing.SwingUtilities.invokeLater(new Runnable()
+ SeqAnnotationServiceCalcWorker worker = (SeqAnnotationServiceCalcWorker) aaconClient
+ .get(0);
+ if (!worker.service.getHostURL().equals(service.getHostURL()))
{
{
- // @Override
- // public void run()
+ // javax.swing.SwingUtilities.invokeLater(new Runnable()
{
{
- removeCurrentAAConWorkerFor(aaui, alignFrame);
- buildCurrentAAConWorkerFor(aaui, alignFrame, service);
- }
- } // );
+ // @Override
+ // public void run()
+ {
+ removeCurrentAAConWorkerFor(aaui, alignFrame);
+ buildCurrentAAConWorkerFor(aaui, alignFrame, service);
+ }
+ } // );
+ }
}
}
}
}
}
}
@@
-85,18
+92,23
@@
public class Jws2ClientFactory
@Override
public void actionPerformed(ActionEvent arg0)
{
@Override
public void actionPerformed(ActionEvent arg0)
{
+
List<AlignCalcWorkerI> aaconClient = alignFrame.getViewport()
.getCalcManager()
List<AlignCalcWorkerI> aaconClient = alignFrame.getViewport()
.getCalcManager()
- .getRegisteredWorkersOfClass(aaui.getClient());
- if (aaconClient != null && aaconClient.size() > 0)
- {
- removeCurrentAAConWorkerFor(aaui, alignFrame);
- }
- else
+ .getWorkersOfClass(SeqAnnotationServiceCalcWorker.class);
+ if (aaconClient != null)
{
{
- buildCurrentAAConWorkerFor(aaui, alignFrame);
-
+ for (AlignCalcWorkerI worker : aaconClient)
+ {
+ if (((SeqAnnotationServiceCalcWorker) worker).getService()
+ .getClass().equals(aaui.getClient()))
+ {
+ removeCurrentAAConWorkerFor(aaui, alignFrame);
+ return;
+ }
+ }
}
}
+ buildCurrentAAConWorkerFor(aaui, alignFrame);
}
});
}
});
@@
-136,12
+148,13
@@
public class Jws2ClientFactory
return;
}
List<AlignCalcWorkerI> aaconClient = alignFrame.getViewport()
return;
}
List<AlignCalcWorkerI> aaconClient = alignFrame.getViewport()
- .getCalcManager().getRegisteredWorkersOfClass(
- SeqAnnotationServiceCalcWorker.class);
+ .getCalcManager()
+ .getWorkersOfClass(SeqAnnotationServiceCalcWorker.class);
boolean serviceEnabled = false;
if (aaconClient != null)
{
boolean serviceEnabled = false;
if (aaconClient != null)
{
+ // NB code duplicatino again!
for (AlignCalcWorkerI _worker : aaconClient)
{
SeqAnnotationServiceCalcWorker worker = (SeqAnnotationServiceCalcWorker) _worker;
for (AlignCalcWorkerI _worker : aaconClient)
{
SeqAnnotationServiceCalcWorker worker = (SeqAnnotationServiceCalcWorker) _worker;
@@
-219,7
+232,7
@@
public class Jws2ClientFactory
if (service != null && !fave.getService().getHostURL()
.equals(service.getHostURL()))
{
if (service != null && !fave.getService().getHostURL()
.equals(service.getHostURL()))
{
- Cache.log.debug("Changing AACon service to " + service.getHostURL()
+ Console.debug("Changing AACon service to " + service.getHostURL()
+ " from " + fave.getService().getHostURL());
fave.setService(service);
}
+ " from " + fave.getService().getHostURL());
fave.setService(service);
}
@@
-238,19
+251,20
@@
public class Jws2ClientFactory
{
if (service != null)
{
{
if (service != null)
{
- if (!service.getServiceType()
- .equals(compbio.ws.client.Services.AAConWS.toString()))
- {
- Cache.log.warn(
- "Ignoring invalid preferred service for AACon calculations (service type was "
- + service.getServiceType() + ")");
- service = null;
- }
- else
+ // if (!service.getServiceType()
+ // .equals(compbio.ws.client.Services.AAConWS.toString()))
+ // {
+ // Console.warn(
+ // "Ignoring invalid preferred service for AACon calculations (service
+ // type was "
+ // + service.getServiceType() + ")");
+ // service = null;
+ // }
+ // else
{
// check service is actually in the list of currently avaialable
// services
{
// check service is actually in the list of currently avaialable
// services
- if (!Jws2Discoverer.getDiscoverer().getServices().contains(service))
+ if (!PreferredServiceRegistry.getRegistry().contains(service))
{
// it isn't ..
service = null;
{
// it isn't ..
service = null;
@@
-260,7
+274,7
@@
public class Jws2ClientFactory
if (service == null)
{
// get the default service for AACon
if (service == null)
{
// get the default service for AACon
- service = Jws2Discoverer.getDiscoverer().getPreferredServiceFor(null,
+ service = PreferredServiceRegistry.getRegistry().getPreferredServiceFor(null,
aaui.getServiceType());
}
if (service == null)
aaui.getServiceType());
}
if (service == null)
@@
-270,13
+284,15
@@
public class Jws2ClientFactory
throw new Error(
MessageManager.getString("error.no_aacon_service_found"));
}
throw new Error(
MessageManager.getString("error.no_aacon_service_found"));
}
- return new AAConSettings(true, service, null, null);
+ return service instanceof Jws2Instance
+ ? new AAConSettings(true, service, null, null)
+ : new AutoCalcSetting(service, null, null, true);
}
private static void removeCurrentAAConWorkerFor(AlignAnalysisUIText aaui,
AlignFrame alignFrame)
{
alignFrame.getViewport().getCalcManager()
}
private static void removeCurrentAAConWorkerFor(AlignAnalysisUIText aaui,
AlignFrame alignFrame)
{
alignFrame.getViewport().getCalcManager()
- .removeRegisteredWorkersOfClass(aaui.getClient());
+ .removeWorkersOfClass(aaui.getClient());
}
}
-}
\ No newline at end of file
+}