当前位置: 首页>>代码示例>>Java>>正文


Java Messages.OK属性代码示例

本文整理汇总了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;
}
 
开发者ID:CeH9,项目名称:PackageTemplates,代码行数:20,代码来源:CreateDirectoryAction.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:CreateFieldFromParameterDialog.java

示例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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:HgMqUnAppliedPatchesPanel.java

示例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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:JavaMoveClassesOrPackagesHandler.java

示例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();
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:DragHelper.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:TodoCheckinHandler.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:JavaCoverageEngine.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:JavaFindUsagesHandler.java

示例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;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:39,代码来源:SyncDirectoriesWarning.java

示例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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:VirtualFileDeleteProvider.java

示例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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ShelvedChangesViewManager.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:ExecutionManagerImpl.java

示例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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:GrIntroduceConstantDialog.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:MergeRequestImpl.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:MarkExcludeRootAction.java


注:本文中的com.intellij.openapi.ui.Messages.OK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。