本文整理了Java中com.intellij.openapi.ui.Messages.showOkCancelDialog()
方法的一些代码示例,展示了Messages.showOkCancelDialog()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Messages.showOkCancelDialog()
方法的具体详情如下:
包路径:com.intellij.openapi.ui.Messages
类名称:Messages
方法名:showOkCancelDialog
暂无
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
@NotNull
private static EditorNotificationPanel createPanel(@NotNull Project project, @NotNull Module module) {
EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText("'" + module.getName() + "' is not Go Module, some code insight might not work here");
panel.createActionLabel("Change module type to Go and reload project", () -> {
int message = Messages.showOkCancelDialog(project, "Updating module type requires project reload. Proceed?", "Update Module Type",
"Reload project", "Cancel", null);
if (message == Messages.YES) {
module.setOption(Module.ELEMENT_TYPE, GoModuleType.getInstance().getId());
project.save();
EditorNotifications.getInstance(project).updateAllNotifications();
ProjectManager.getInstance().reloadProject(project);
}
});
panel.createActionLabel("Don't show again for this module", () -> {
Set<String> ignoredModules = getIgnoredModules(project);
ignoredModules.add(module.getName());
PropertiesComponent.getInstance(project).setValue(DONT_ASK_TO_CHANGE_MODULE_TYPE_KEY, StringUtil.join(ignoredModules, ","));
EditorNotifications.getInstance(project).updateAllNotifications();
});
return panel;
}
代码示例来源:origin: Camelcade/Perl5-IDEA
@NotNull
private PsiElement suggestSuperMethod(@NotNull PerlSubElement subBase) {
PerlSubElement topLevelSuperMethod = subBase.getTopmostSuperMethod();
String canonicalName = topLevelSuperMethod.getCanonicalName();
if (topLevelSuperMethod == subBase || canonicalName == null) {
return subBase;
}
int dialogResult = Messages.showOkCancelDialog(
"This method overrides SUPER method: " + canonicalName + ".",
"Method Rename",
"Rename SUPER method",
"Rename this one",
PerlIcons.PERL_LANGUAGE_ICON);
return dialogResult == Messages.OK ? topLevelSuperMethod : subBase;
}
}
代码示例来源:origin: sonar-intellij-plugin/sonar-intellij-plugin
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();
}
}
);
}
代码示例来源:origin: sonar-intellij-plugin/sonar-intellij-plugin
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();
}
}
);
}
代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij
@Override
public void run() {
int doStop =
Messages.showOkCancelDialog(
AppEngineMessageBundle.message(
"appengine.stop.modules.version.confirmation.message",
STOP_CONFIRMATION_URI_OPEN_TAG,
STOP_CONFIRMATION_URI_CLOSE_TAG),
AppEngineMessageBundle.message(
"appengine.stop.modules.version.confirmation.title"),
General.Warning);
if (doStop == Messages.YES) {
stop(callback);
} else {
callback.errorOccurred(
AppEngineMessageBundle.message(
"appengine.stop.modules.version.canceled.message"));
}
}
});
代码示例来源:origin: zhengjunbase/codehelper.generator
.showOkCancelDialog(project, serverMsg.getContent(), serverMsg.getTitle(), "OK", serverMsg.getButtonStr(), null);
if(result == 2 && StringUtils.isNotBlank(serverMsg.getButtonUrl())){
BrowserLauncher.getInstance().browse(serverMsg.getButtonUrl(), WebBrowserManager.getInstance().getFirstActiveBrowser());
代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij
private void ensureSingleDebugSession(Project project) throws RunCanceledByUserException {
List<CloudDebugProcessState> backgroundSessions = getBackgroundDebugStates(project);
if (backgroundSessions.size() > 0) {
for (CloudDebugProcessState cdps : backgroundSessions) {
cdps.setListenInBackground(false);
}
}
List<CloudDebugProcess> activeDebugProcesses = getActiveDebugProcesses(project);
if (activeDebugProcesses.size() > 0) {
int result =
Messages.showOkCancelDialog(
project,
StackdriverDebuggerBundle.getString("clouddebug.stop.and.create.new.session"),
StackdriverDebuggerBundle.getString("clouddebug.message.title"),
StackdriverDebuggerIcons.STACKDRIVER_DEBUGGER);
if (result == Messages.OK) {
for (CloudDebugProcess cdb : activeDebugProcesses) {
cdb.getProcessHandler().detachProcess();
}
} else {
throw new RunCanceledByUserException();
}
}
}
代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij
@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());
}
}
}
代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij
@Override
public boolean ensureLoggedIn(String username) {
Optional<CredentialedUser> projectUser = getLoggedInUser(username);
while (!projectUser.isPresent()) {
int addUserResult =
Messages.showOkCancelDialog(
AccountMessageBundle.message("login.credentials.missing.message", username),
AccountMessageBundle.message("login.credentials.missing.dialog.title"),
AccountMessageBundle.message("login.credentials.missing.dialog.addaccount.button"),
AccountMessageBundle.message("login.credentials.missing.dialog.cancel.button"),
Messages.getWarningIcon());
if (addUserResult == Messages.OK) {
logIn();
projectUser = getLoggedInUser(username);
} else {
return false;
}
}
return true;
}
代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij
@Override
public void actionPerformed(AnActionEvent event) {
int result =
Messages.showOkCancelDialog(
event.getProject(),
StackdriverDebuggerBundle.getString("clouddebug.continue.listening"),
StackdriverDebuggerBundle.getString("clouddebug.message.title"),
StackdriverDebuggerBundle.getString("clouddebug.continue"),
StackdriverDebuggerBundle.getString("clouddebug.stop.listening"),
Messages.getQuestionIcon());
if (result == Messages.OK) { // continue
processState.setListenInBackground(true);
UsageTrackerService.getInstance()
.trackEvent(GctTracking.CLOUD_DEBUGGER_CLOSE_CONTINUE_LISTEN)
.ping();
} else {
processState.setListenInBackground(false);
UsageTrackerService.getInstance()
.trackEvent(GctTracking.CLOUD_DEBUGGER_CLOSE_STOP_LISTEN)
.ping();
}
ActionManager.getInstance().getAction(IdeActions.ACTION_STOP_PROGRAM).actionPerformed(event);
ActionManager.getInstance().getAction(IdeActions.ACTION_CLOSE).actionPerformed(event);
}
内容来源于网络,如有侵权,请联系作者删除!