package jalview.ws2.gui; import java.util.List; import java.util.concurrent.CompletionStage; import javax.swing.JMenu; import jalview.gui.AlignFrame; import jalview.gui.WsJobParameters; import jalview.util.MessageManager; import jalview.ws.params.ArgumentI; import jalview.ws.params.ParamDatastoreI; import jalview.ws.params.WsParamSetI; /** * Functional interface provided by {@link jalview.ws2.operations.Operation} * instances to construct the menu entry for the operations. The instances are * passed to the {@link jalview.gui.WebServicesMenuBuilder} and called during * menu construction. * * @author mmwarowny */ @FunctionalInterface public interface MenuEntryProviderI { /** * Build menu entries directly under the given menu. This method is called by * {@link jalview.gui.WebServicesMenuBuilder} during menu construction. * * @param parent * parent menu * @param frame * current alignFrame */ public void buildMenu(JMenu parent, AlignFrame frame); static CompletionStage> openEditParamsDialog( ParamDatastoreI paramStore, WsParamSetI preset, List arguments) { WsJobParameters jobParams; if (preset == null && arguments != null && arguments.size() > 0) jobParams = new WsJobParameters(paramStore, preset, arguments); else jobParams = new WsJobParameters(paramStore, preset, null); if (preset != null) { jobParams.setName(MessageManager.getString( "label.adjusting_parameters_for_calculation")); } var stage = jobParams.showRunDialog(); return stage.thenApply((startJob) -> { if (startJob) { if (jobParams.getPreset() == null) { return jobParams.getJobParams(); } else { return jobParams.getPreset().getArguments(); } } else { return null; } }); } }