@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); } } }
@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); } } }
IgnoreBundle.message("settings.userTemplates.dialogDescription"), IgnoreBundle.message("settings.userTemplates.dialogTitle"), Messages.getQuestionIcon(), initialValue.getName(), new InputValidatorEx() {
"(You can do it manually by running 'defaults write -g " + "ApplePressAndHoldEnabled 0' in the console).", IDEAVIM_NOTIFICATION_TITLE, Messages.getQuestionIcon()) == Messages.YES) { editor.setKeyRepeat(true); keyRepeat.setEnabled(true);
String[] options = choice == null ? new String[] {"Overwrite", "Skip"} : new String[] {"Overwrite", "Skip", "Overwrite for all", "Skip for all"}; selection = Messages.showDialog(message, title, options, 0, Messages.getQuestionIcon()); if (selection == 2 || selection == 3) { this.selection = selection;
@Messages.YesNoResult public static boolean showYesNoDialog(@Nullable Project project, @NotNull String title, @NotNull String message) { return Messages.YES == Messages.showYesNoDialog(project, message, title, Messages.getQuestionIcon()); }
protected List<String> askFieldsNames( Project project, String promptText, String promptTitle ) { Set<String> result = new THashSet<>(); String name = Messages.showInputDialog(project, promptText, promptTitle, Messages.getQuestionIcon(), "", null); if (!StringUtil.isEmpty(name)) { for (String nameChunk : name.split("[ ,]+")) { if (!nameChunk.isEmpty() && PerlParserUtil.IDENTIFIER_PATTERN.matcher(nameChunk).matches()) { result.add(nameChunk); } } } return new ArrayList<>(result); }
private void addActionListenersForRemoveLocalAnalysisScriptButton() { myRemoveLocalAnalysisScriptButton.addActionListener( actionEvent -> { final Object selected = myLocalAnalysisScriptComboBox.getSelectedItem(); int rc = Messages.showOkCancelDialog( "Are you sure you want to remove "+selected.toString()+" ?", "Remove Local Analysis Script", Messages.getQuestionIcon() ); if (rc == Messages.OK) { LocalAnalysisScripts.remove(selected.toString()); myLocalAnalysisScriptComboBox.removeItem(selected); disableEditAndRemoveButtonsIfPossible(); } } ); }
private void addActionListenerForRemoveSonarServerButton() { myRemoveSonarServerButton.addActionListener( actionEvent -> { final Object selectedSonarServer = mySonarServersComboBox.getSelectedItem(); int rc = Messages.showOkCancelDialog( "Are you sure you want to remove "+selectedSonarServer.toString()+" ?", "Remove SonarQube Server", Messages.getQuestionIcon() ); if (rc == Messages.OK) { SonarServers.remove(selectedSonarServer.toString()); mySonarServersComboBox.removeItem(selectedSonarServer); disableEditAndRemoveButtonsIfPossible(); } } ); }
private void resetStats() { if (Messages.showYesNoDialog("Do you really want to reset your Key Promoter statistics? This cannot be undone!", "Reset Statistics", Messages.getQuestionIcon()) == 0) { Map<String, Integer> stats = statsService.getStats(); stats.clear(); statsService.setStats(stats); updateTopTen(); } }
@NotNull protected final PsiElement[] invokeDialog(final Project project, final PsiDirectory directory) { final MyInputValidator validator = new MyInputValidator(project, directory); Messages.showInputDialog(project, getDialogPrompt(), getDialogTitle(), Messages.getQuestionIcon(), "", validator); return validator.getCreatedElements(); }
private void resetStats() { if (Messages.showYesNoDialog( KeyPromoterBundle.message("kp.dialog.reset.statistic.text"), KeyPromoterBundle.message("kp.dialog.reset.statistic.title"), Messages.getQuestionIcon()) == 0) { statService.resetStatistic(); } }
@Override public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException { ApplicationManager.getApplication().invokeLater(() -> { String markerText = Messages.showInputDialog( project, PerlBundle.message("perl.intention.heredoc.dialog.prompt"), PerlBundle.message("perl.intention.heredoc.dialog.title"), Messages.getQuestionIcon(), HEREDOC_MARKER, null); if (markerText != null) { if (markerText.isEmpty()) { Messages.showErrorDialog( project, PerlBundle.message("perl.intention.heredoc.error.message"), PerlBundle.message("perl.intention.heredoc.error.title") ); } else // converting { HEREDOC_MARKER = markerText; WriteCommandAction.runWriteCommandAction(project, () -> super.invoke(project, editor, element)); } } }); }
@Override public void actionPerformed(AnActionEvent event) { int result = Messages.showOkCancelDialog( StackdriverDebuggerBundle.getString("clouddebug.remove.all"), StackdriverDebuggerBundle.getString("clouddebug.delete.snapshots"), StackdriverDebuggerBundle.getString("clouddebug.buttondelete"), StackdriverDebuggerBundle.getString("clouddebug.cancelbutton"), Messages.getQuestionIcon()); if (result == Messages.OK) { // pressed remove all SnapshotsModel model = getModel(); fireDeleteBreakpoints(model.getBreakpoints()); } } }
protected void createAutobaseNamesComponent(FormBuilder builder) { autobaseModel = new CollectionListModel<>(); autobaseList = new JBList<>(autobaseModel); builder.addLabeledComponent( new JLabel("Autobase names (autobase_names option. Order is important, later components may be inherited from early):"), ToolbarDecorator .createDecorator(autobaseList) .setAddAction(anActionButton -> { String fileName = Messages.showInputDialog( myProject, "Type new Autobase filename:", "New Autobase Filename", Messages.getQuestionIcon(), "", null); if (StringUtil.isNotEmpty(fileName) && !autobaseModel.getItems().contains(fileName)) { autobaseModel.add(fileName); } }) .setPreferredSize(JBUI.size(0, PerlConfigurationUtil.WIDGET_HEIGHT)) .createPanel()); } }
@Test public void testUpdatePasswords_OK() { teamServicesSettingsModel.getTableSelectionModel().setSelectionInterval(0, 0); when(Messages.showYesNoDialog(mockProject, TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_UPDATE_MSG), TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_UPDATE_TITLE), Messages.getQuestionIcon())).thenReturn(Messages.YES); teamServicesSettingsModel.getTableModel().addServerContexts(new ArrayList<ServerContext>(ImmutableList.of(mockServerContext_GitRepo, mockServerContext_TfvcRepo))); teamServicesSettingsModel.updatePasswords(); assertEquals(0, teamServicesSettingsModel.getDeleteContexts().size()); assertEquals(2, teamServicesSettingsModel.getTableModel().getRowCount()); verifyStatic(times(1)); Messages.showYesNoDialog(eq(mockProject), eq(TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_UPDATE_MSG)), eq(TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_UPDATE_TITLE)), any(Icon.class)); }
@Test public void testDeletePasswords_OK() { teamServicesSettingsModel.getTableSelectionModel().setSelectionInterval(0, 0); when(Messages.showYesNoDialog(mockProject, TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_DELETE_MSG), TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_DELETE_TITLE), Messages.getQuestionIcon())).thenReturn(Messages.YES); teamServicesSettingsModel.getTableModel().addServerContexts(new ArrayList<ServerContext>(ImmutableList.of(mockServerContext_GitRepo, mockServerContext_TfvcRepo))); teamServicesSettingsModel.deletePasswords(); assertEquals(1, teamServicesSettingsModel.getDeleteContexts().size()); assertEquals(1, teamServicesSettingsModel.getTableModel().getRowCount()); assertEquals(mockServerContext_GitRepo, teamServicesSettingsModel.getTableModel().getServerContext(0)); verifyStatic(times(1)); Messages.showYesNoDialog(eq(mockProject), eq(TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_DELETE_MSG)), eq(TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_DELETE_TITLE)), any(Icon.class)); }
@Test public void testDeletePasswords_Cancel() { teamServicesSettingsModel.getTableSelectionModel().setSelectionInterval(0, 0); when(Messages.showYesNoDialog(mockProject, TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_DELETE_MSG), TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_DELETE_TITLE), Messages.getQuestionIcon())).thenReturn(Messages.CANCEL); teamServicesSettingsModel.getTableModel().addServerContexts(new ArrayList<ServerContext>(ImmutableList.of(mockServerContext_GitRepo, mockServerContext_TfvcRepo))); teamServicesSettingsModel.deletePasswords(); assertEquals(0, teamServicesSettingsModel.getDeleteContexts().size()); assertEquals(2, teamServicesSettingsModel.getTableModel().getRowCount()); assertEquals(mockServerContext_TfvcRepo, teamServicesSettingsModel.getTableModel().getServerContext(0)); assertEquals(mockServerContext_GitRepo, teamServicesSettingsModel.getTableModel().getServerContext(1)); verifyStatic(times(1)); Messages.showYesNoDialog(eq(mockProject), eq(TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_DELETE_MSG)), eq(TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_DELETE_TITLE)), any(Icon.class)); }
@Test public void testUpdatePasswords_Cancel() { teamServicesSettingsModel.getTableSelectionModel().setSelectionInterval(0, 0); when(Messages.showYesNoDialog(mockProject, TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_UPDATE_MSG), TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_UPDATE_TITLE), Messages.getQuestionIcon())).thenReturn(Messages.CANCEL); teamServicesSettingsModel.getTableModel().addServerContexts(new ArrayList<ServerContext>(ImmutableList.of(mockServerContext_GitRepo, mockServerContext_TfvcRepo))); teamServicesSettingsModel.updatePasswords(); assertEquals(0, teamServicesSettingsModel.getDeleteContexts().size()); assertEquals(2, teamServicesSettingsModel.getTableModel().getRowCount()); assertEquals(mockServerContext_TfvcRepo, teamServicesSettingsModel.getTableModel().getServerContext(0)); assertEquals(mockServerContext_GitRepo, teamServicesSettingsModel.getTableModel().getServerContext(1)); verifyStatic(times(1)); Messages.showYesNoDialog(eq(mockProject), eq(TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_UPDATE_MSG)), eq(TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_UPDATE_TITLE)), any(Icon.class)); }
@Test public void testReset() { createSettings(); // do delete when(Messages.showYesNoDialog(project, TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_DELETE_MSG), TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_DELETE_TITLE), Messages.getQuestionIcon())).thenReturn(Messages.OK); model.getTableSelectionModel().setSelectionInterval(0, 1); controller.actionPerformed(new ActionEvent(this, 0, TeamServicesSettingsForm.CMD_DELETE_PASSWORD)); assertTrue(controller.isModified()); assertEquals(0, model.getTableModel().getRowCount()); assertEquals(3, ServerContextManager.getInstance().getAllServerContexts().size()); // reset controller.actionPerformed(new ActionEvent(this, 0, TeamServicesConfigurable.CMD_RESET_CHANGES)); assertFalse(controller.isModified()); assertEquals(2, model.getTableModel().getRowCount()); assertEquals(3, ServerContextManager.getInstance().getAllServerContexts().size()); }