@Override public String getTitle() { return command.getName(); }
@Override public boolean isDirty() { if (editedCommand == null) { return false; } return !(commandNameInitial.equals(editedCommand.getName())); }
@Override public java.util.Optional<CommandImpl> getCommand(String name) { return commands.values().stream().filter(command -> name.equals(command.getName())).findFirst(); }
@Override public boolean hasInvalidData() { return !isValidCommandName(editedCommand.getName()); }
@Override public String getName() { return getData().getName(); }
@Override public String getName() { return getCommand().getName(); } }
@Override public String getDisplayName() { return getData().getName(); }
@Override public String getName() { return getData().getName() + "." + FILE_TYPE_EXT; }
/** * Creates action for executing the given command and adds created action to the appropriate * action group. */ private void addAction(CommandImpl command) { ExecuteCommandAction action = commandActionFactory.create(command); actionManager.registerAction(COMMAND_ACTION_ID_PREFIX + command.getName(), action); commandActions.put(command.getName(), action); getActionGroupForCommand(command).add(action); }
@Override public void onFilterChanged(String filterValue) { final List<CommandImpl> filteredCommands = commandManager.getCommands(); if (!filterValue.isEmpty()) { filteredCommands.removeIf(command -> !containsIgnoreCase(command.getName(), filterValue)); } view.setCommands(commandUtils.groupCommandsByGoal(filteredCommands)); }
@AssistedInject public MachineItem(@Assisted MachineItem item) { super(item.getCommand()); this.machine = item.machine; this.name = getCommand().getName() + " on " + machine.getName(); }
/** Creates copy of the given {@code command}. */ public CommandImpl(CommandImpl command) { this( command.getName(), command.getCommandLine(), command.getType(), new HashMap<>(command.getAttributes()), new ApplicableContext(command.getApplicableContext())); }
/** * Updates the command with the specified {@code name} by replacing it with the given {@code * command}. * * <p><b>Note</b> that name of the updated command may differ from the name provided by the given * {@code command} in order to prevent name duplication. */ Promise<Void> updateCommand(final CommandImpl command) { return workspaceServiceClient .updateCommand(appContext.getWorkspaceId(), command.getName(), command) .then(updateWorkspace()); }
@Override public Path getLocation() { return Path.valueOf("commands/" + getData().getType() + "/" + getData().getName()); }
@Inject ExecuteCommandAction( @Assisted CommandImpl command, CommandUtils commandUtils, CommandExecutor commandExecutor, CommandManager commandManager) { super(command.getName()); this.command = command; this.commandExecutor = commandExecutor; this.commandManager = commandManager; final SVGResource commandIcon = commandUtils.getCommandTypeIcon(command.getType()); if (commandIcon != null) { getTemplatePresentation().setImageElement(new SVGImage(commandIcon).getElement()); } }
@Override public void onCommandRemove(CommandImpl command) { dialogFactory .createConfirmDialog( messages.removeCommandConfirmationTitle(), messages.removeCommandConfirmationMessage(command.getName()), () -> commandManager .removeCommand(command.getName()) .catchError(showErrorNotification(messages.unableRemove())), null) .show(); }
/** Initialize editor's pages with the edited command. */ private void initializePages() { initialCommandName = editedCommand.getName(); pages.forEach( page -> { page.edit(editedCommand); page.setDirtyStateListener( () -> { updateDirtyState(isDirtyPage()); view.setSaveEnabled(isDirtyPage()); }); }); }
@Override protected void initialize() { initialValue = getCommandPropertyValue(); Document document = editor.getDocument(); if (document != null) { document.replace(0, document.getContentsCharCount(), initialValue); } else { VirtualFile file = new SyntheticFile(editedCommand.getName() + getType(), initialValue); editor.init( new EditorInputImpl(fileTypeRegistry.getFileTypeByFile(file), file), new OpenEditorCallbackImpl()); } }