import javax.swing.JMenu;
import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
import compbio.metadata.Argument;
import jalview.api.AlignCalcWorkerI;
import jalview.datamodel.AlignmentView;
import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.JalviewDialog;
import jalview.gui.JvSwingUtils;
import jalview.ws.jws2.jabaws2.Jws2Instance;
import jalview.ws.params.WsParamSetI;
AlignFrame alignFrame, WsParamSetI preset, boolean editParams)
{
super(alignFrame, preset, null);
- List<AlignCalcWorkerI> clnts = alignFrame.getViewport()
- .getCalcManager()
- .getRegisteredWorkersOfClass(AAConsClient.class);
- if (clnts == null || clnts.size() == 0)
+ if (sh.serviceType.toLowerCase().contains("aaconws"))
{
- if (!processParams(sh, editParams))
+ // Build an AACons client
+ if (alignFrame.getViewport().getAlignment().isNucleotide())
{
+ JOptionPane
+ .showMessageDialog(
+ Desktop.desktop,
+ "AACons can only be used\nfor amino acid alignments.\nSorry about that!",
+ "Wrong type of sequences!",
+ JOptionPane.WARNING_MESSAGE);
return;
+
}
- alignFrame
- .getViewport()
+ List<AlignCalcWorkerI> clnts = alignFrame.getViewport()
.getCalcManager()
- .registerWorker(
- new AAConsClient(sh, alignFrame, preset, paramset));
- }
- else
- {
- AAConsClient worker = (AAConsClient) clnts.get(0);
- if (editParams)
+ .getRegisteredWorkersOfClass(AAConsClient.class);
+ if (clnts == null || clnts.size() == 0)
{
- paramset = worker.getArguments();
- preset = worker.getPreset();
+ if (!processParams(sh, editParams))
+ {
+ return;
+ }
+ alignFrame
+ .getViewport()
+ .getCalcManager()
+ .registerWorker(
+ new AAConsClient(sh, alignFrame, preset, paramset));
}
+ else
+ {
+ AAConsClient worker = (AAConsClient) clnts.get(0);
+ if (editParams)
+ {
+ paramset = worker.getArguments();
+ preset = worker.getPreset();
+ }
- if (!processParams(sh, editParams, true))
- return;
- // reinstate worker if it was blacklisted (might have happened due to invalid parameters)
- alignFrame.getViewport().getCalcManager().workerMayRun(worker);
- worker.updateParameters(preset, paramset);
+ if (!processParams(sh, editParams, true))
+ return;
+ // reinstate worker if it was blacklisted (might have happened due to
+ // invalid parameters)
+ alignFrame.getViewport().getCalcManager().workerMayRun(worker);
+ worker.updateParameters(preset, paramset);
+ }
}
+
}
/*
{
boolean hasparams = service.hasParameters();
String calcName = "AACons";
- System.out.println("Making an aacons client!");
JMenuItem aacons = new JMenuItem("AACons Defaults");
aacons.addActionListener(new ActionListener()
{