{
try
{
- Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl);
+ Jws2Discoverer.getInstance().setPreferredUrl(jabawsUrl);
System.out.println(
"CMD [-jabaws " + jabawsUrl + "] executed successfully!");
} catch (MalformedURLException e)
boolean new_sspred = false;
if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
{
- Jws2Discoverer jws2servs = Jws2Discoverer.getDiscoverer();
+ Jws2Discoverer jws2servs = Jws2Discoverer.getInstance();
if (jws2servs != null)
{
if (jws2servs.hasServices())
updateView();
}
};
- JalviewColourChooser.showColourChooser(Desktop.getDesktop(), ttl,
+ JalviewColourChooser.showColourChooser(Desktop.getDesktopPane(), ttl,
colourPanel.getBackground(), listener);
}
public static MyDesktopPane desktop;
- public static MyDesktopPane getDesktop()
+ public static MyDesktopPane getDesktopPane()
{
// BH 2018 could use currentThread() here as a reference to a
// Hashtable<Thread, MyDesktopPane> in JavaScript
return desktop;
}
+ public static StructureSelectionManager getStructureSelectionManager()
+ {
+ return StructureSelectionManager
+ .getStructureSelectionManager(getInstance());
+ }
+
static int openFrameCount = 0;
static final int xOffset = 30;
if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
{
- t2 = jalview.ws.jws2.Jws2Discoverer.getDiscoverer()
+ t2 = jalview.ws.jws2.Jws2Discoverer.getInstance()
.startDiscoverer(changeSupport);
}
Thread t3 = null;
{
if (evt.getNewValue() == null || evt.getNewValue() instanceof Vector)
{
- final String ermsg = jalview.ws.jws2.Jws2Discoverer.getDiscoverer()
+ final String ermsg = jalview.ws.jws2.Jws2Discoverer.getInstance()
.getErrorMessages();
if (ermsg != null)
{
updateColourButton(mainPanel, colour, featureColour);
};
};
- JalviewColourChooser.showColourChooser(Desktop.getDesktop(),
+ JalviewColourChooser.showColourChooser(Desktop.getDesktopPane(),
title, featureColour.getColour(), listener);
}
else
refresh();
}
};
- JalviewColourChooser.showColourChooser(Desktop.getDesktop(),
+ JalviewColourChooser.showColourChooser(Desktop.getDesktopPane(),
title, Color.BLUE, listener);
}
public static void main(String[] args)
{
jalview.ws.jws2.Jws2Discoverer disc = jalview.ws.jws2.Jws2Discoverer
- .getDiscoverer();
+ .getInstance();
int p = 0;
if (args.length > 0)
{
Vector<String> services = new Vector<>();
services.addElement(args[p++]);
- Jws2Discoverer.getDiscoverer().setServiceUrls(services);
+ Jws2Discoverer.getInstance().setServiceUrls(services);
}
try
{
private void initFromPreferences()
{
- wsUrls = Jws2Discoverer.getDiscoverer().getServiceUrls();
+ wsUrls = Jws2Discoverer.getInstance().getServiceUrls();
if (!wsUrls.isEmpty())
{
oldUrls = new Vector<String>(wsUrls);
int r = 0;
for (String url : wsUrls)
{
- int status = Jws2Discoverer.getDiscoverer().getServerStatusFor(url);
+ int status = Jws2Discoverer.getInstance().getServerStatusFor(url);
tdat[r][1] = Integer.valueOf(status);
tdat[r++][0] = url;
}
private void updateServiceList()
{
- Jws2Discoverer.getDiscoverer().setServiceUrls(wsUrls);
+ Jws2Discoverer.getInstance().setServiceUrls(wsUrls);
}
private void updateRsbsServiceList()
@Override
protected void resetWs_actionPerformed(ActionEvent e)
{
- Jws2Discoverer.getDiscoverer().setServiceUrls(null);
- List<String> nwsUrls = Jws2Discoverer.getDiscoverer().getServiceUrls();
+ Jws2Discoverer.getInstance().setServiceUrls(null);
+ List<String> nwsUrls = Jws2Discoverer.getInstance().getServiceUrls();
if (!wsUrls.equals(nwsUrls))
{
update++;
{
// check service is actually in the list of currently avaialable
// services
- if (!Jws2Discoverer.getDiscoverer().getServices().contains(service))
+ if (!Jws2Discoverer.getInstance().getServices().contains(service))
{
// it isn't ..
service = null;
if (service == null)
{
// get the default service for AACon
- service = Jws2Discoverer.getDiscoverer().getPreferredServiceFor(null,
+ service = Jws2Discoverer.getInstance().getPreferredServiceFor(null,
aaui.getServiceType());
}
if (service == null)
*/
private static Jws2Discoverer discoverer;
+ /**
+ * Returns the singleton instance of this class.
+ *
+ * @return
+ */
+ public static Jws2Discoverer getInstance()
+ {
+ if (discoverer == null)
+ {
+ discoverer = new Jws2Discoverer();
+ }
+ return discoverer;
+ }
+
/*
* Override for testing only
*/
testUrls.add(url);
}
}
- Thread runner = getDiscoverer()
+ Thread runner = getInstance()
.startDiscoverer(new PropertyChangeListener()
{
@Override
public void propertyChange(PropertyChangeEvent evt)
{
- if (getDiscoverer().services != null)
+ if (getInstance().services != null)
{
System.out.println("Changesupport: There are now "
- + getDiscoverer().services.size() + " services");
+ + getInstance().services.size() + " services");
int i = 1;
- for (Jws2Instance instance : getDiscoverer().services)
+ for (Jws2Instance instance : getInstance().services)
{
System.out.println("Service " + i++ + " "
+ instance.getClass() + "@" + instance.getHost()
}
}
- /**
- * Returns the singleton instance of this class.
- *
- * @return
- */
- public static Jws2Discoverer getDiscoverer()
- {
- if (discoverer == null)
- {
- discoverer = new Jws2Discoverer();
- }
- return discoverer;
- }
public boolean hasServices()
{