本文整理匯總了Java中com.intellij.openapi.ui.Messages.OK屬性的典型用法代碼示例。如果您正苦於以下問題:Java Messages.OK屬性的具體用法?Java Messages.OK怎麽用?Java Messages.OK使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.intellij.openapi.ui.Messages
的用法示例。
在下文中一共展示了Messages.OK屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onAsk
private boolean onAsk(PsiDirectory psiDuplicate) {
int dialogAnswerCode = Messages.showYesNoDialog(project,
String.format(Localizer.get("warning.ArgDirectoryAlreadyExists"), psiDuplicate.getName()),
Localizer.get("title.WriteConflict"),
Localizer.get("action.Overwrite"),
Localizer.get("action.UseExisting"),
Messages.getQuestionIcon(),
new NeverShowAskCheckBox()
);
if (dialogAnswerCode == Messages.OK) {
if (!onOverwrite(psiDuplicate)) {
return false;
}
} else {
if (!onUseExisting(psiDuplicate)) {
return false;
}
}
return true;
}
示例2: doOKAction
@Override
protected void doOKAction() {
if (myCbFinal.isEnabled()) {
PropertiesComponent.getInstance().setValue(PROPERTY_NAME, myCbFinal.isSelected());
}
final PsiField[] fields = myTargetClass.getFields();
for (PsiField field : fields) {
if (field.getName().equals(getEnteredName())) {
int result = Messages.showOkCancelDialog(
getContentPane(),
CodeInsightBundle.message("dialog.create.field.from.parameter.already.exists.text", getEnteredName()),
CodeInsightBundle.message("dialog.create.field.from.parameter.already.exists.title"),
Messages.getQuestionIcon());
if (result == Messages.OK) {
close(OK_EXIT_CODE);
}
else {
return;
}
}
}
close(OK_EXIT_CODE);
}
示例3: actionPerformed
@Override
public void actionPerformed(AnActionEvent e) {
final List<String> names = getSelectedPatchNames();
if (names.isEmpty()) return;
if (Messages.showOkCancelDialog(myRepository.getProject(), String
.format("You are going to delete selected %s. Would you like to continue?",
StringUtil.pluralize("patch", names.size())),
"Delete Confirmation", Messages.getWarningIcon()) == Messages.OK) {
Runnable deleteTask = new Runnable() {
@Override
public void run() {
ProgressManager.getInstance().getProgressIndicator().setText("Deleting patches...");
new HgQDeleteCommand(myRepository).execute(names);
}
};
updatePatchSeriesInBackground(deleteTask);
}
}
示例4: moveDirectoriesLibrariesSafe
private static void moveDirectoriesLibrariesSafe(Project project,
PsiElement targetContainer,
MoveCallback callback,
PsiDirectory[] directories,
String prompt) {
final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(directories[0]);
LOG.assertTrue(aPackage != null);
final PsiDirectory[] projectDirectories = aPackage.getDirectories(GlobalSearchScope.projectScope(project));
if (projectDirectories.length > 1) {
int ret = Messages
.showYesNoCancelDialog(project, prompt + " or all directories in project?", RefactoringBundle.message("warning.title"),
RefactoringBundle.message("move.current.directory"),
RefactoringBundle.message("move.directories"),
CommonBundle.getCancelButtonText(), Messages.getWarningIcon());
if (ret == Messages.YES) {
moveAsDirectory(project, targetContainer, callback, directories);
}
else if (ret == Messages.NO) {
moveAsDirectory(project, targetContainer, callback, projectDirectories);
}
}
else if (Messages.showOkCancelDialog(project, prompt + "?", RefactoringBundle.message("warning.title"),
Messages.getWarningIcon()) == Messages.OK) {
moveAsDirectory(project, targetContainer, callback, directories);
}
}
示例5: processDragFinish
@Override
protected void processDragFinish(MouseEvent event, boolean willDragOutStart) {
super.processDragFinish(event, willDragOutStart);
endDrag(willDragOutStart);
final JBTabsPosition position = myTabs.getTabsPosition();
if (!willDragOutStart && myTabs.isAlphabeticalMode() && position != JBTabsPosition.top && position != JBTabsPosition.bottom) {
Point p = new Point(event.getPoint());
p = SwingUtilities.convertPoint(event.getComponent(), p, myTabs);
if (myTabs.getVisibleRect().contains(p) && myPressedOnScreenPoint.distance(new RelativePoint(event).getScreenPoint()) > 15) {
final int answer = Messages.showOkCancelDialog(myTabs,
IdeBundle.message("alphabetical.mode.is.on.warning"),
IdeBundle.message("title.warning"),
Messages.getQuestionIcon());
if (answer == Messages.OK) {
JBEditorTabs.setAlphabeticalMode(false);
myTabs.relayout(true, false);
myTabs.revalidate();
}
}
}
}
示例6: showResults
private ReturnResult showResults(final TodoCheckinHandlerWorker worker, CommitExecutor executor) {
String commitButtonText = executor != null ? executor.getActionText() : myCheckinProjectPanel.getCommitActionName();
if (commitButtonText.endsWith("...")) {
commitButtonText = commitButtonText.substring(0, commitButtonText.length()-3);
}
final String text = createMessage(worker);
final String[] buttons;
final boolean thereAreTodoFound = worker.getAddedOrEditedTodos().size() + worker.getInChangedTodos().size() > 0;
int commitOption;
if (thereAreTodoFound) {
buttons = new String[]{VcsBundle.message("todo.in.new.review.button"), commitButtonText, CommonBundle.getCancelButtonText()};
commitOption = 1;
}
else {
buttons = new String[]{commitButtonText, CommonBundle.getCancelButtonText()};
commitOption = 0;
}
final int answer = Messages.showDialog(myProject, text, "TODO", null, buttons, 0, 1, UIUtil.getWarningIcon());
if (thereAreTodoFound && answer == Messages.OK) {
showTodo(worker);
return ReturnResult.CLOSE_WINDOW;
}
if (answer == commitOption) {
return ReturnResult.COMMIT;
}
return ReturnResult.CANCEL;
}
示例7: recompileProjectAndRerunAction
@Override
public boolean recompileProjectAndRerunAction(@NotNull final Module module, @NotNull final CoverageSuitesBundle suite,
@NotNull final Runnable chooseSuiteAction) {
final VirtualFile outputpath = CompilerModuleExtension.getInstance(module).getCompilerOutputPath();
final VirtualFile testOutputpath = CompilerModuleExtension.getInstance(module).getCompilerOutputPathForTests();
if ((outputpath == null && isModuleOutputNeeded(module, JavaSourceRootType.SOURCE))
|| (suite.isTrackTestFolders() && testOutputpath == null && isModuleOutputNeeded(module, JavaSourceRootType.TEST_SOURCE))) {
final Project project = module.getProject();
if (suite.isModuleChecked(module)) return false;
suite.checkModule(module);
final Runnable runnable = new Runnable() {
public void run() {
if (Messages.showOkCancelDialog(
"Project class files are out of date. Would you like to recompile? The refusal to do it will result in incomplete coverage information",
"Project is out of date", Messages.getWarningIcon()) == Messages.OK) {
final CompilerManager compilerManager = CompilerManager.getInstance(project);
compilerManager.make(compilerManager.createProjectCompileScope(project), new CompileStatusNotification() {
public void finished(final boolean aborted, final int errors, final int warnings, final CompileContext compileContext) {
if (aborted || errors != 0) return;
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
if (project.isDisposed()) return;
CoverageDataManager.getInstance(project).chooseSuitesBundle(suite);
}
});
}
});
} else if (!project.isDisposed()) {
CoverageDataManager.getInstance(project).chooseSuitesBundle(null);
}
}
};
ApplicationManager.getApplication().invokeLater(runnable);
return true;
}
return false;
}
示例8: askWhetherShouldSearchForParameterInOverridingMethods
private static boolean askWhetherShouldSearchForParameterInOverridingMethods(@NotNull PsiElement psiElement, @NotNull PsiParameter parameter) {
return Messages.showOkCancelDialog(psiElement.getProject(),
FindBundle.message("find.parameter.usages.in.overriding.methods.prompt", parameter.getName()),
FindBundle.message("find.parameter.usages.in.overriding.methods.title"),
CommonBundle.getYesButtonText(), CommonBundle.getNoButtonText(),
Messages.getQuestionIcon()) == Messages.OK;
}
示例9: warn
/** Warns the user that sources may not resolve. Returns false if sync should be aborted. */
public static boolean warn(Project project) {
if (warningSuppressed()) {
return true;
}
String buildSystem = Blaze.buildSystemName(project);
String message =
String.format(
"Syncing without a %s build will result in unresolved symbols "
+ "in your source files.<p>This can be useful for quickly adding directories to "
+ "your project, but if you're seeing sources marked as '(unsynced)', run a normal "
+ "%<s sync to fix it.",
buildSystem);
String title = String.format("Syncing without a %s build", buildSystem);
DialogWrapper.DoNotAskOption dontAskAgain =
new DialogWrapper.DoNotAskOption.Adapter() {
@Override
public void rememberChoice(boolean isSelected, int exitCode) {
if (isSelected) {
suppressWarning();
}
}
@Override
public String getDoNotShowMessage() {
return "Don't warn again";
}
};
int result =
Messages.showOkCancelDialog(
project,
XmlStringUtil.wrapInHtml(message),
title,
"Run Sync",
"Cancel",
Messages.getWarningIcon(),
dontAskAgain);
return result == Messages.OK;
}
示例10: deleteElement
public void deleteElement(@NotNull DataContext dataContext) {
final VirtualFile[] files = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext);
if (files == null || files.length == 0) return;
Project project = CommonDataKeys.PROJECT.getData(dataContext);
String message = createConfirmationMessage(files);
int returnValue = Messages.showOkCancelDialog(message, UIBundle.message("delete.dialog.title"), ApplicationBundle.message("button.delete"),
CommonBundle.getCancelButtonText(), Messages.getQuestionIcon());
if (returnValue != Messages.OK) return;
Arrays.sort(files, FileComparator.getInstance());
final List<String> problems = ContainerUtil.newLinkedList();
new WriteCommandAction.Simple(project) {
@Override
protected void run() throws Throwable {
for (final VirtualFile file : files) {
try {
file.delete(this);
}
catch (IOException e) {
LOG.info(e);
problems.add(file.getName());
}
}
}
}.execute();
if (!problems.isEmpty()) {
reportDeletionProblem(problems);
}
}
示例11: deleteElement
public void deleteElement(@NotNull DataContext dataContext) {
//noinspection unchecked
final List<ShelvedChangeList> shelvedChangeLists = getLists(dataContext);
if (shelvedChangeLists.isEmpty()) return;
String message = (shelvedChangeLists.size() == 1)
? VcsBundle.message("shelve.changes.delete.confirm", shelvedChangeLists.get(0).DESCRIPTION)
: VcsBundle.message("shelve.changes.delete.multiple.confirm", shelvedChangeLists.size());
int rc = Messages.showOkCancelDialog(myProject, message, VcsBundle.message("shelvedChanges.delete.title"), CommonBundle.message("button.delete"), CommonBundle.getCancelButtonText(), Messages.getWarningIcon());
if (rc != Messages.OK) return;
for(ShelvedChangeList changeList: shelvedChangeLists) {
ShelveChangesManager.getInstance(myProject).deleteChangeList(changeList);
}
}
示例12: userApprovesStopForSameTypeConfigurations
private static boolean userApprovesStopForSameTypeConfigurations(Project project, String configName, int instancesCount) {
RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(project);
final RunManagerConfig config = runManager.getConfig();
if (!config.isRestartRequiresConfirmation()) return true;
DialogWrapper.DoNotAskOption option = new DialogWrapper.DoNotAskOption() {
@Override
public boolean isToBeShown() {
return config.isRestartRequiresConfirmation();
}
@Override
public void setToBeShown(boolean value, int exitCode) {
config.setRestartRequiresConfirmation(value);
}
@Override
public boolean canBeHidden() {
return true;
}
@Override
public boolean shouldSaveOptionsOnCancel() {
return false;
}
@NotNull
@Override
public String getDoNotShowMessage() {
return CommonBundle.message("dialog.options.do.not.show");
}
};
return Messages.showOkCancelDialog(
project,
ExecutionBundle.message("rerun.singleton.confirmation.message", configName, instancesCount),
ExecutionBundle.message("process.is.running.dialog.title", configName),
ExecutionBundle.message("rerun.confirmation.button.text"),
CommonBundle.message("button.cancel"),
Messages.getQuestionIcon(), option) == Messages.OK;
}
示例13: doOKAction
@Override
protected void doOKAction() {
final String targetClassName = getTargetClassName();
if (myDefaultTargetClass == null || !targetClassName.isEmpty() && !Comparing.strEqual(targetClassName, myDefaultTargetClass.getQualifiedName())) {
final Module module = ModuleUtilCore.findModuleForPsiElement(myContext.getPlace());
JavaPsiFacade facade = JavaPsiFacade.getInstance(myContext.getProject());
PsiClass newClass = facade.findClass(targetClassName, GlobalSearchScope.projectScope(myContext.getProject()));
if (newClass == null &&
Messages.showOkCancelDialog(myContext.getProject(), GroovyRefactoringBundle.message("class.does.not.exist.in.the.module"),
IntroduceConstantHandler.REFACTORING_NAME, Messages.getErrorIcon()) != Messages.OK) {
return;
}
myTargetClassInfo = new TargetClassInfo(targetClassName, myContext.getPlace().getContainingFile().getContainingDirectory(), module, myContext.getProject());
}
else {
myTargetClassInfo = new TargetClassInfo(myDefaultTargetClass);
}
JavaRefactoringSettings.getInstance().INTRODUCE_CONSTANT_VISIBILITY = getVisibilityModifier();
RecentsManager.getInstance(myContext.getProject()).registerRecentEntry(RECENTS_KEY, targetClassName);
super.doOKAction();
}
示例14: run
@Override
public void run() {
if (myWasInvoked) return;
if (!getWholePanel().isDisplayable()) return;
myWasInvoked = true;
ChangeCounter.getOrCreate(myMergePanel.getMergeList()).removeListener(this);
int doApply = Messages
.showOkCancelDialog(getWholePanel(), DiffBundle.message("merge.all.changes.have.processed.save.and.finish.confirmation.text"),
DiffBundle.message("all.changes.processed.dialog.title"),
DiffBundle.message("merge.save.and.finish.button"), DiffBundle.message("merge.continue.button"),
Messages.getQuestionIcon());
if (doApply != Messages.OK) return;
myDialogWrapper.close(DialogWrapper.OK_EXIT_CODE);
}
示例15: actionPerformed
@Override
public void actionPerformed(AnActionEvent e) {
VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
if (Registry.is("ide.hide.excluded.files")) {
String message = files.length == 1 ? FileUtil.toSystemDependentName(files[0].getPath()) : files.length + " selected files";
final int rc = Messages.showOkCancelDialog(e.getData(CommonDataKeys.PROJECT), getPromptText(message), "Mark as Excluded",
Messages.getQuestionIcon());
if (rc != Messages.OK) {
return;
}
}
super.actionPerformed(e);
}