本文整理了Java中com.intellij.openapi.ui.Messages.showYesNoDialog()
方法的一些代码示例,展示了Messages.showYesNoDialog()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Messages.showYesNoDialog()
方法的具体详情如下:
包路径:com.intellij.openapi.ui.Messages
类名称:Messages
方法名:showYesNoDialog
暂无
代码示例来源:origin: ballerina-platform/ballerina-lang
@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);
}
}
}
代码示例来源:origin: ballerina-platform/ballerina-lang
@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);
}
}
}
代码示例来源:origin: JetBrains/ideavim
final Boolean isKeyRepeat = editor.isKeyRepeat();
if ((enabled == null || !enabled) && (isKeyRepeat == null || isKeyRepeat)) {
if (Messages.showYesNoDialog("Do you want to enable repeating keys in Mac OS X on press and hold?\n\n" +
"(You can do it manually by running 'defaults write -g " +
"ApplePressAndHoldEnabled 0' in the console).", IDEAVIM_NOTIFICATION_TITLE,
代码示例来源:origin: rholder/gradle-view
private int useCurrentProjectBuild() {
return Messages.showYesNoDialog(
"Would you like to view the current project's Gradle dependencies?",
"Gradle Dependency Viewer",
null);
}
}
代码示例来源:origin: PavlikPolivka/GitLabProjects
@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());
}
代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij
@Override
public boolean askYesOrNo(String title, String message) {
StringBuilder updatedMessageBuilder = new StringBuilder(message);
if (message.equals(AccountMessageBundle.message("login.service.are.you.sure.key.text"))) {
updatedMessageBuilder.append(
AccountMessageBundle.message("login.service.are.you.sure.append.text"));
for (GoogleLoginMessageExtender messageExtender : messageExtenders) {
String additionalLogoutMessage = messageExtender.additionalLogoutMessage();
if (!Strings.isNullOrEmpty(additionalLogoutMessage)) {
updatedMessageBuilder.append(" ").append(additionalLogoutMessage);
}
}
}
String updatedMessage =
WordUtils.wrap(
updatedMessageBuilder.toString(),
WRAP_LENGTH,
/* newLinestr */ null,
/* wrapLongWords */ false);
return (Messages.showYesNoDialog(updatedMessage, title, GoogleLoginIcons.GOOGLE_FAVICON)
== Messages.YES);
}
代码示例来源:origin: halirutan/IntelliJ-Key-Promoter
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();
}
}
代码示例来源:origin: halirutan/IntelliJ-Key-Promoter-X
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();
}
}
代码示例来源:origin: SonarSource/sonarlint-intellij
@Override
public void run(AnActionButton anActionButton) {
SonarQubeServer server = getSelectedServer();
int selectedIndex = serverList.getSelectedIndex();
if (server == null) {
return;
}
Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
List<String> projectsUsingNames = getOpenProjectNames(openProjects, server);
if (!projectsUsingNames.isEmpty()) {
String projects = projectsUsingNames.stream().collect(Collectors.joining("<br>"));
int response = Messages.showYesNoDialog(serversPanel,
"<html>The following opened projects are bound to this server configuration:<br><b>" +
projects + "</b><br>Delete the server?</html>", "Server Configuration In Use", Messages.getWarningIcon());
if (response == Messages.NO) {
return;
}
}
CollectionListModel model = (CollectionListModel) serverList.getModel();
// it's not removed from serverIds and editorList
model.remove(server);
servers.remove(server);
serverChangeListener.changed(servers);
if (model.getSize() > 0) {
int newIndex = Math.min(model.getSize() - 1, Math.max(selectedIndex - 1, 0));
serverList.setSelectedValue(model.getElementAt(newIndex), true);
}
}
代码示例来源:origin: SonarSource/sonarlint-intellij
static boolean showWarning() {
if (!ApplicationManager.getApplication().isUnitTestMode() && !PropertiesComponent.getInstance().getBoolean(HIDE_WARNING_PROPERTY, false)) {
int result = Messages.showYesNoDialog("Analysing all files may take a considerable amount of time to complete.\n"
+ "To get the best from SonarLint, you should preferably use the automatic analysis of the file you're working on.",
"SonarLint - Analyze All Files",
"Proceed", "Cancel", Messages.getWarningIcon(), new DoNotShowAgain());
return result == Messages.OK;
}
return true;
}
代码示例来源:origin: Camelcade/Perl5-IDEA
private void doCreateSdk(@NotNull PerlBrewAdapter perlBrewAdapter, @NotNull String distirbutionId) {
PerlBrewHandler.getInstance().createInterpreter(
distirbutionId, perlBrewAdapter, sdk -> ApplicationManager.getApplication().invokeLater(
() -> {
PerlBrewData perlBrewData = PerlBrewData.from(sdk);
if (perlBrewData != null && Messages.showYesNoDialog(
myProject,
PerlBundle.message("perl.vm.perlbrew.create.lib.select", perlBrewData.getDistributionId()),
PerlBundle.message("perl.vm.perlbrew.create.lib.title", perlBrewData.getPerlVersionString()), null) == Messages.YES) {
PerlProjectManager.getInstance(myProject).setProjectSdk(sdk);
}
}), myProject);
}
}.queue();
代码示例来源:origin: Microsoft/azure-devops-intellij
@Test
public void testDeleteWorkspaceWithProgress_UserCancel() throws Exception {
final MockObserver observer = new MockObserver(manageWorkspacesModel);
when(Messages.showYesNoDialog(mockProject, TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_CONFIRM_MSG, workspace1.getName()),
TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_CONFIRM_TITLE), Messages.getWarningIcon())).thenReturn(Messages.NO);
manageWorkspacesModel.deleteWorkspaceWithProgress(workspace1);
observer.assertUpdateNeverOccurred(ManageWorkspacesModel.REFRESH_WORKSPACE);
verifyStatic(never());
VcsUtil.runVcsProcessWithProgress(any(VcsRunnable.class), any(String.class), any(Boolean.class), any(Project.class));
Messages.showErrorDialog(any(Project.class), any(String.class), any(String.class));
}
代码示例来源:origin: Microsoft/azure-devops-intellij
@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));
}
代码示例来源:origin: Microsoft/azure-devops-intellij
@Test
public void testDeleteWorkspaceWithProgress_Happy() throws Exception {
final MockObserver observer = new MockObserver(manageWorkspacesModel);
when(Messages.showYesNoDialog(mockProject, TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_CONFIRM_MSG, workspace1.getName()),
TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_CONFIRM_TITLE), Messages.getWarningIcon())).thenReturn(Messages.YES);
manageWorkspacesModel.deleteWorkspaceWithProgress(workspace1);
observer.assertAndClearLastUpdate(manageWorkspacesModel, ManageWorkspacesModel.REFRESH_WORKSPACE);
verifyStatic(never());
Messages.showErrorDialog(any(Project.class), any(String.class), any(String.class));
}
代码示例来源:origin: Microsoft/azure-devops-intellij
@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));
}
代码示例来源:origin: Microsoft/azure-devops-intellij
@Test
public void testDeleteWorkspaceWithProgress_Exception() throws Exception {
final MockObserver observer = new MockObserver(manageWorkspacesModel);
when(Messages.showYesNoDialog(mockProject, TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_CONFIRM_MSG, workspace1.getName()),
TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_CONFIRM_TITLE), Messages.getWarningIcon())).thenReturn(Messages.YES);
when(VcsUtil.runVcsProcessWithProgress(any(VcsRunnable.class), eq(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_MSG, workspace1.getName())), eq(true), eq(mockProject)))
.thenThrow(new VcsException(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_ERROR_MSG, workspace1.getName())));
manageWorkspacesModel.deleteWorkspaceWithProgress(workspace1);
observer.assertAndClearLastUpdate(manageWorkspacesModel, ManageWorkspacesModel.REFRESH_WORKSPACE);
verifyStatic(times(1));
Messages.showErrorDialog(eq(mockProject), eq(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_ERROR_MSG, workspace1.getName())),
eq(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_ERROR_TITLE)));
}
代码示例来源:origin: Microsoft/azure-devops-intellij
@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));
}
代码示例来源:origin: Microsoft/azure-devops-intellij
@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));
}
代码示例来源:origin: Camelcade/Perl5-IDEA
@Override
public void run(@NotNull ProgressIndicator indicator) {
PerlBrewAdapter perlBrewAdapter = new PerlBrewAdapter(perlBrewData.getVersionManagerPath(), hostData);
ProcessOutput processOutput = perlBrewAdapter.createLibrary(perlVersionString, libraryName);
if (processOutput == null) {
return;
}
String distirbutionId = perlVersionString + "@" + libraryName;
if (processOutput.getExitCode() == 0) {
doCreateSdk(perlBrewAdapter, distirbutionId);
}
if (StringUtil.contains(processOutput.getStderr(), "is already there")) {
Ref<Integer> resultRef = Ref.create(-1);
ApplicationManager.getApplication().invokeAndWait(() -> resultRef.set(Messages.showYesNoDialog(
PerlBundle.message("perl.vm.perlbrew.library.exists", distirbutionId),
PerlBundle.message("perl.vm.perlbrew.title"),
PerlIcons.PERLBREW_ICON)));
if (Messages.YES == resultRef.get()) {
doCreateSdk(perlBrewAdapter, distirbutionId);
}
}
}
代码示例来源:origin: Microsoft/azure-devops-intellij
@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());
}
内容来源于网络,如有侵权,请联系作者删除!