From: jprocter Date: Sun, 19 Sep 2010 16:36:25 +0000 (+0000) Subject: catch case when a service has no parameters (or the service's servicerunner does... X-Git-Tag: Release_2_6~28 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=26e4138d5fc2cab4f7a52bffbbb1ea802ba44ae4;p=jalview.git catch case when a service has no parameters (or the service's servicerunner does not init correctly) and only display a 'default' submission entry for it. --- diff --git a/src/jalview/ws/jws2/MsaWSClient.java b/src/jalview/ws/jws2/MsaWSClient.java index fce5178..2e5ef28 100644 --- a/src/jalview/ws/jws2/MsaWSClient.java +++ b/src/jalview/ws/jws2/MsaWSClient.java @@ -151,7 +151,8 @@ public class MsaWSClient extends Jws2Client { if (sh.paramStore == null) { - sh.paramStore = new JabaParamStore(sh, Desktop.getUserParameterStore()); + sh.paramStore = new JabaParamStore(sh, + Desktop.getUserParameterStore()); } WsJobParameters jobParams = new WsJobParameters(sh, preset); if (!jobParams.showRunDialog()) @@ -270,7 +271,14 @@ public class MsaWSClient extends Jws2Client rmsawsmenu.add(msawsmenu); calcName = ""; } + boolean hasparams = false; + try + { + hasparams = (service.getRunnerConfig().getArguments().size() > 0); + } catch (Exception e) + { + } do { if (submitGaps == true) @@ -279,6 +287,7 @@ public class MsaWSClient extends Jws2Client rmsawsmenu.add(msawsmenu); } final boolean withGaps = submitGaps; + JMenuItem method = new JMenuItem(calcName + "Defaults"); method.setToolTipText("Align with default settings"); @@ -294,48 +303,54 @@ public class MsaWSClient extends Jws2Client } }); msawsmenu.add(method); - method = new JMenuItem(calcName + "Edit and run ..."); - method.setToolTipText("View and change the parameters before alignment."); - - method.addActionListener(new ActionListener() + if (hasparams) { - public void actionPerformed(ActionEvent e) - { - AlignmentView msa = alignFrame.gatherSequencesForAlignment(); - new MsaWSClient(service, null, null, true, alignFrame.getTitle(), - msa, withGaps, true, alignFrame.getViewport() - .getAlignment().getDataset(), alignFrame); + // only add these menu options if the service has user-modifiable arguments + method = new JMenuItem(calcName + "Edit and run ..."); + method.setToolTipText("View and change the parameters before alignment."); - } - }); - msawsmenu.add(method); - List presets = service.getParamStore().getPresets(); - if (presets != null && presets.size() > 0) - { - JMenu presetlist = new JMenu(calcName + "Presets"); + method.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + AlignmentView msa = alignFrame.gatherSequencesForAlignment(); + new MsaWSClient(service, null, null, true, alignFrame + .getTitle(), msa, withGaps, true, alignFrame + .getViewport().getAlignment().getDataset(), alignFrame); - for (final WsParamSetI preset : presets) + } + }); + msawsmenu.add(method); + List presets = service.getParamStore().getPresets(); + if (presets != null && presets.size() > 0) { - final JMenuItem methodR = new JMenuItem(preset.getName()); - methodR.setToolTipText("

"+JvSwingUtils.wrapTooltip("" - + (preset.isModifiable() ? "User Preset" - : "Service Preset") + "
" - + preset.getDescription() + "

")+""); - methodR.addActionListener(new ActionListener() + JMenu presetlist = new JMenu(calcName + "Presets"); + + for (final WsParamSetI preset : presets) { - public void actionPerformed(ActionEvent e) + final JMenuItem methodR = new JMenuItem(preset.getName()); + methodR.setToolTipText("

" + + JvSwingUtils.wrapTooltip("" + + (preset.isModifiable() ? "User Preset" + : "Service Preset") + "
" + + preset.getDescription() + "

") + ""); + methodR.addActionListener(new ActionListener() { - AlignmentView msa = alignFrame.gatherSequencesForAlignment(); - new MsaWSClient(service, preset, alignFrame.getTitle(), msa, - false, true, alignFrame.getViewport().getAlignment() - .getDataset(), alignFrame); + public void actionPerformed(ActionEvent e) + { + AlignmentView msa = alignFrame + .gatherSequencesForAlignment(); + new MsaWSClient(service, preset, alignFrame.getTitle(), + msa, false, true, alignFrame.getViewport() + .getAlignment().getDataset(), alignFrame); - } + } - }); - presetlist.add(methodR); + }); + presetlist.add(methodR); + } + msawsmenu.add(presetlist); } - msawsmenu.add(presetlist); } if (!submitGaps && canSubmitGaps()) {