/** * fetches the ScriptDTO for a given path (e.g. ["Applications", "Development", "Notepad++", "Online"]) * @param path path in the JS namespace * @return ScriptDTO */ default ScriptDTO getScript(List<String> path) { final String wantedId = path.get(3); final ApplicationDTO applicationDTO = getApplication(path); if (applicationDTO != null) { for (ScriptDTO scriptDTO : applicationDTO.getScripts()) { if (wantedId.equals(scriptDTO.getId())) { return scriptDTO; } } } LOGGER.error(String.format("Could not find ScriptDTO with ID \"%s\"", wantedId)); return null; }
if (applicationDTO.getId().equals("settings")) { for (ScriptDTO scriptDTO : applicationDTO.getScripts()) { script.append("include([\"engines\", \"" + engineId + "\", \"settings\", \"" + scriptDTO.getId() + "\"]);\n"); script.append("if (!(\"" + engineId + "\" in settings))\n");
executeBuilder.append(String.format("CATEGORY_ID=\"%s\";\n", script.getCategoryId())); executeBuilder.append(String.format("APPLICATION_ID=\"%s\";\n", script.getApplicationId())); executeBuilder.append(String.format("SCRIPT_ID=\"%s\";\n", script.getId()));
this.lockAll(); this.verbsManager.installVerb(container.getEngine().toLowerCase(), container.getName(), verb.getId(), this::unlockAll, e -> Platform.runLater(() -> { final ErrorDialog errorDialog = ErrorDialog.builder()
public Builder(ScriptDTO scriptDTO) { this.withTypeId(scriptDTO.getTypeId()) .withCategoryId(scriptDTO.getCategoryId()) .withApplicationId(scriptDTO.getApplicationId()) .withId(scriptDTO.getId()) .withScriptName(scriptDTO.getScriptName()) .withScript(scriptDTO.getScript()) .withCompatibleOperatingSystems(scriptDTO.getCompatibleOperatingSystems()) .withTestingOperatingSystems(scriptDTO.getTestingOperatingSystems()) .withFree(scriptDTO.isFree()) .withRequiresPatch(scriptDTO.requiresPatch) .withIcon(scriptDTO.getIcon()); }
/** * Constructor * * @param control The control belonging to the skin */ public ContainerEngineToolsPanelSkin(ContainerEngineToolsPanel control) { super(control); // map the tool scripts to a tool button this.toolButtons = new MappedList<>(control.getEngineToolScripts(), tool -> { final Button toolButton = new Button(tool.getScriptName()); toolButton.getStyleClass().addAll("toolButton"); toolButton.setStyle("-fx-background-image: url('" + tool.getIcon() + "');"); toolButton.disableProperty().bind(getControl().lockToolsProperty()); toolButton.setOnMouseClicked(event -> { getControl().setLockTools(true); final ContainerDTO container = getControl().getContainer(); // TODO: find a better way to get the engine ID getControl().getEngineToolsManager().runTool(container.getEngine().toLowerCase(), container.getName(), tool.getId(), () -> getControl().setLockTools(false), e -> Platform.runLater(() -> { final ErrorDialog errorDialog = ErrorDialog.builder() .withMessage(tr("Error")) .withException(e) .build(); errorDialog.showAndWait(); })); }); return toolButton; }); }