private static void showAddingTaskErrorMessage(Project project, String message) { Messages.showErrorDialog(project, message, "Go Command Task"); } }
@Override public void doCancelAction() { exitCode = -1; super.doCancelAction(); }
@Nullable private Boolean getReplaceOSVars() { return (Boolean) replaceOSVarsComponent.getComponent().getSelectedItem(); }
@Messages.YesNoResult private void showRestartDialog() { String action = ApplicationManagerEx.getApplicationEx().isRestartCapable() ? "Restart" : "Shutdown"; String message = action + " is required to activate SDK changes. Do you wish to continue?"; if (Messages.showYesNoDialog(message, "Apply Changes", action, "Postpone", Messages.getQuestionIcon()) == 0) { ApplicationManagerEx.getApplicationEx().restart(true); } } }
private static void installWorkingDirectoryChooser(@NotNull Project project, @NotNull ComponentWithBrowseButton field) { FileChooserDescriptor chooseDirectoryDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); chooseDirectoryDescriptor.setShowFileSystemRoots(true); chooseDirectoryDescriptor.withShowHiddenFiles(false); if (field instanceof TextFieldWithBrowseButton) { ((TextFieldWithBrowseButton) field).addBrowseFolderListener( new TextBrowseFolderListener(chooseDirectoryDescriptor, project)); } else { //noinspection unchecked field.addBrowseFolderListener(project, new ComponentWithBrowseButton.BrowseFolderActionListener(null, null, field, project, chooseDirectoryDescriptor, TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT)); } }
@Override protected void resetEditorFrom(GoRunFileConfiguration configuration) { myFileField.setText(configuration.getFilePath()); myCommonSettingsPanel.resetEditorFrom(configuration); }
@Nullable @Override protected ValidationInfo doValidate() { String command = getCommand(); if (command.isEmpty()) { return new ValidationInfo("Empty Go command is not allowed", myCommandTextField); } if (command.startsWith("go ")) { return new ValidationInfo("Go command shouldn't started with `go`", myCommandTextField); } return super.doValidate(); }
@Override public void run(AnActionButton button) { String packageName = Messages.showInputDialog("Enter the import path to exclude from auto-import and completion:", "Exclude Import Path", Messages.getWarningIcon()); addExcludedPackage(packageName); }
private void setCodeLoadingMode(@Nullable CodeLoadingMode codeLoadingMode) { codeLoadingModeComponent.getComponent().setSelectedItem(codeLoadingMode); }
@Override protected void applyEditorTo(GoRunFileConfiguration configuration) throws ConfigurationException { configuration.setFilePath(myFileField.getText()); myCommonSettingsPanel.applyEditorTo(configuration); }
@Override protected void doOKAction() { exitCode = contentPanelWrapper.getComboBoxIndex(); super.doOKAction(); }
private void createUIComponents() { styleComboBox = new ComboBox<>(UiFormatterStyle.values()); }
@NotNull private String selectedCompiler() { Object item = myCompilerCombo.getSelectedItem(); return item instanceof String ? (String)item : GoBuildTargetSettings.ANY_COMPILER; }
public BallerinaTestSettingsEditor(Project project) { myProject = project; BallerinaRunUtil.installBallerinTestFileChooser(project, myFileField.getComponent()); BallerinaRunUtil.installBallerinaWithWorkingDirectoryChooser(project, myWorkingDirectoryField.getComponent()); }
@NotNull @Override public Dimension getMinimumSize() { return calcSize(super.getMinimumSize()); }
@Messages.YesNoResult private void showRestartDialog() { String action = ApplicationManagerEx.getApplicationEx().isRestartCapable() ? "Restart" : "Shutdown"; String message = action + " is required to activate SDK changes. Do you wish to continue?"; if (Messages.showYesNoDialog(message, "Apply Changes", action, "Postpone", Messages.getQuestionIcon()) == 0) { ApplicationManagerEx.getApplicationEx().restart(true); } } }
@Override public void reset() { mySdkPathField.setText(StringUtil.notNullize(GoSdkService.getInstance(myProject).getSdkHomePath(null))); }
@Nullable private CodeLoadingMode getCodeLoadingMode() { return (CodeLoadingMode) codeLoadingModeComponent.getComponent().getSelectedItem(); }
private void setReplaceOSVars(@Nullable Boolean replaceOSVars) { replaceOSVarsComponent.getComponent().setSelectedItem(replaceOSVars); }
@NotNull private static String selected(@NotNull ComboBox comboBox, @NotNull String defaultValue) { Object item = comboBox.getSelectedItem(); if (item instanceof String) { return defaultValue.equals(item) ? GoBuildTargetSettings.DEFAULT : (String)item; } return GoBuildTargetSettings.DEFAULT; }