當前位置: 首頁>>代碼示例>>Java>>正文


Java Messages.showOkCancelDialog方法代碼示例

本文整理匯總了Java中com.intellij.openapi.ui.Messages.showOkCancelDialog方法的典型用法代碼示例。如果您正苦於以下問題:Java Messages.showOkCancelDialog方法的具體用法?Java Messages.showOkCancelDialog怎麽用?Java Messages.showOkCancelDialog使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.ui.Messages的用法示例。


在下文中一共展示了Messages.showOkCancelDialog方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ensureUsagesWritable

import com.intellij.openapi.ui.Messages; //導入方法依賴的package包/類
private boolean ensureUsagesWritable(ReplaceContext replaceContext, Collection<Usage> selectedUsages) {
  Set<VirtualFile> readOnlyFiles = null;
  for (final Usage usage : selectedUsages) {
    final VirtualFile file = ((UsageInFile)usage).getFile();

    if (file != null && !file.isWritable()) {
      if (readOnlyFiles == null) readOnlyFiles = new HashSet<VirtualFile>();
      readOnlyFiles.add(file);
    }
  }

  if (readOnlyFiles != null) {
    ReadonlyStatusHandler.getInstance(myProject).ensureFilesWritable(VfsUtilCore.toVirtualFileArray(readOnlyFiles));
  }

  if (hasReadOnlyUsages(selectedUsages)) {
    int result = Messages.showOkCancelDialog(replaceContext.getUsageView().getComponent(),
                                             FindBundle.message("find.replace.occurrences.in.read.only.files.prompt"),
                                             FindBundle.message("find.replace.occurrences.in.read.only.files.title"),
                                             Messages.getWarningIcon());
    if (result != Messages.OK) {
      return false;
    }
  }
  return true;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:ReplaceInProjectManager.java

示例2: actionPerformed

import com.intellij.openapi.ui.Messages; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e, DomModelTreeView treeView) {
  final SimpleNode selectedNode = treeView.getTree().getSelectedNode();

  if (selectedNode instanceof BaseDomElementNode) {

    if (selectedNode instanceof DomFileElementNode) {
      e.getPresentation().setVisible(false);
      return;
    }
    
    final DomElement domElement = ((BaseDomElementNode)selectedNode).getDomElement();

    final int ret = Messages.showOkCancelDialog(getPresentationText(selectedNode, "Remove") + "?", "Remove",
                                                Messages.getQuestionIcon());
    if (ret == Messages.OK) {
    new WriteCommandAction(domElement.getManager().getProject(), DomUtil.getFile(domElement)) {
      @Override
      protected void run(@NotNull final Result result) throws Throwable {
        domElement.undefine();
      }
    }.execute();
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:DeleteDomElement.java

示例3: contentRemoveQuery

import com.intellij.openapi.ui.Messages; //導入方法依賴的package包/類
@Override
public void contentRemoveQuery(ContentManagerEvent event) {
  if (event.getContent() == myContent) {
    if (!myIndicator.isCanceled() && shouldAskUser()) {
      int result = Messages.showOkCancelDialog(
        myProject,
        CompilerBundle.message("warning.compiler.running.on.toolwindow.close"),
        CompilerBundle.message("compiler.running.dialog.title"),
        Messages.getQuestionIcon()
      );
      if (result != Messages.OK) {
        event.consume(); // veto closing
      }
      myUserAcceptedCancel = true;
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:CompilerTask.java

示例4: processDragFinish

import com.intellij.openapi.ui.Messages; //導入方法依賴的package包/類
@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,代碼行數:25,代碼來源:DragHelper.java

示例5: checkAssociate

import com.intellij.openapi.ui.Messages; //導入方法依賴的package包/類
public static boolean checkAssociate(final Project project, String fileName, DiffChainContext context) {
  final String pattern = FileUtilRt.getExtension(fileName).toLowerCase();
  if (context.contains(pattern)) return false;
  int rc = Messages.showOkCancelDialog(project,
                               VcsBundle.message("diff.unknown.file.type.prompt", fileName),
                               VcsBundle.message("diff.unknown.file.type.title"),
                                 VcsBundle.message("diff.unknown.file.type.associate"),
                                 CommonBundle.getCancelButtonText(),
                               Messages.getQuestionIcon());
  if (rc == Messages.OK) {
    FileType fileType = FileTypeChooser.associateFileType(fileName);
    return fileType != null && !fileType.isBinary();
  } else {
    context.add(pattern);
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:ChangeDiffRequestPresentable.java

示例6: askUser

import com.intellij.openapi.ui.Messages; //導入方法依賴的package包/類
private boolean askUser() {
  String actionText = getActionName(myUndoableGroup.getCommandName());

  if (actionText.length() > 80) {
    actionText = actionText.substring(0, 80) + "... ";
  }

  return Messages.showOkCancelDialog(myManager.getProject(), actionText + "?", getActionName(),
                                     Messages.getQuestionIcon()) == Messages.OK;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:UndoRedo.java

示例7: actionPerformed

import com.intellij.openapi.ui.Messages; //導入方法依賴的package包/類
@Override
protected void actionPerformed(@NotNull final VcsContext context) {
  Collection<FilePath> filePaths = getFilePaths(context);
  final List<ChangeList> selectedChangeLists = new ArrayList<ChangeList>();
  final ChangeList[] selectionFromContext = context.getSelectedChangeLists();
  if (selectionFromContext != null) {
    Collections.addAll(selectedChangeLists, selectionFromContext);
  }
  final List<CommittedChangeList> incomingChanges = CommittedChangesCache.getInstance(context.getProject()).getCachedIncomingChanges();
  final List<CommittedChangeList> intersectingChanges = new ArrayList<CommittedChangeList>();
  if (incomingChanges != null) {
    for(CommittedChangeList changeList: incomingChanges) {
      if (!selectedChangeLists.contains(changeList)) {
        for(Change change: changeList.getChanges()) {
          if (filePaths.contains(ChangesUtil.getFilePath(change))) {
            intersectingChanges.add(changeList);
            break;
          }
        }
      }
    }
  }
  if (intersectingChanges.size() > 0) {
    int rc = Messages.showOkCancelDialog(
      context.getProject(), VcsBundle.message("get.committed.changes.intersecting.prompt", intersectingChanges.size(), selectedChangeLists.size()),
      VcsBundle.message("get.committed.changes.title"), Messages.getQuestionIcon());
    if (rc != Messages.OK) return;
  }
  super.actionPerformed(context);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:31,代碼來源:GetCommittedChangelistAction.java

示例8: createLeft

import com.intellij.openapi.ui.Messages; //導入方法依賴的package包/類
private ActionListener createLeft(final TreeConflictDescription description) {
  return new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      int ok = Messages.showOkCancelDialog(myVcs.getProject(), "Accept yours for " + filePath(myPath) + "?",
                                           TITLE, Messages.getQuestionIcon());
      if (Messages.OK != ok) return;
      FileDocumentManager.getInstance().saveAllDocuments();
      final Paths paths = getPaths(description);
      ProgressManager.getInstance().run(
        new VcsBackgroundTask<TreeConflictDescription>(myVcs.getProject(), "Accepting yours for: " + filePath(paths.myMainPath),
                                                          BackgroundFromStartOption.getInstance(), Collections.singletonList(description),
                                                          true) {
          @Override
          protected void process(TreeConflictDescription d) throws VcsException {
            new SvnTreeConflictResolver(myVcs, paths.myMainPath, paths.myAdditionalPath).resolveSelectMineFull();
          }

          @Override
          public void onSuccess() {
            super.onSuccess();
            if (executedOk()) {
              VcsBalloonProblemNotifier.showOverChangesView(myProject, "Yours accepted for " + filePath(paths.myMainPath), MessageType.INFO);
            }
          }
        });
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,代碼來源:TreeConflictRefreshablePanel.java

示例9: tryToSetUpGroovyFacetOnTheFly

import com.intellij.openapi.ui.Messages; //導入方法依賴的package包/類
public static boolean tryToSetUpGroovyFacetOnTheFly(final Module module) {
  final Project project = module.getProject();
  GroovyConfigUtils utils = GroovyConfigUtils.getInstance();
  final Library[] libraries = utils.getAllSDKLibraries(project);
  if (libraries.length > 0) {
    final Library library = libraries[0];
    int result = Messages
      .showOkCancelDialog(
        GroovyBundle.message("groovy.like.library.found.text", module.getName(), library.getName(), utils.getSDKLibVersion(library)),
        GroovyBundle.message("groovy.like.library.found"), JetgroovyIcons.Groovy.Groovy_32x32);
    if (result == Messages.OK) {
      AccessToken accessToken = WriteAction.start();

      try {
        ModifiableRootModel model = ModuleRootManager.getInstance(module).getModifiableModel();
        LibraryOrderEntry entry = model.addLibraryEntry(libraries[0]);
        LibrariesUtil.placeEntryToCorrectPlace(model, entry);
        model.commit();
        return true;
      }
      finally {
        accessToken.finish();
      }
    }
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:GroovyFacetUtil.java

示例10: actionPerformed

import com.intellij.openapi.ui.Messages; //導入方法依賴的package包/類
@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,代碼行數:15,代碼來源:MarkExcludeRootAction.java

示例11: createRight

import com.intellij.openapi.ui.Messages; //導入方法依賴的package包/類
private ActionListener createRight(final TreeConflictDescription description) {
  return new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      int ok = Messages.showOkCancelDialog(myVcs.getProject(), "Accept theirs for " + filePath(myPath) + "?",
                                           TITLE, Messages.getQuestionIcon());
      if (Messages.OK != ok) return;
      FileDocumentManager.getInstance().saveAllDocuments();
      final Paths paths = getPaths(description);
      ProgressManager.getInstance().run(
        new VcsBackgroundTask<TreeConflictDescription>(myVcs.getProject(), "Accepting theirs for: " + filePath(paths.myMainPath),
                                                          BackgroundFromStartOption.getInstance(), Collections.singletonList(description),
                                                          true) {
          @Override
          protected void process(TreeConflictDescription d) throws VcsException {
            new SvnTreeConflictResolver(myVcs, paths.myMainPath, paths.myAdditionalPath).resolveSelectTheirsFull();
          }

          @Override
          public void onSuccess() {
            super.onSuccess();
            if (executedOk()) {
              VcsBalloonProblemNotifier.showOverChangesView(myProject, "Theirs accepted for " + filePath(paths.myMainPath), MessageType.INFO);
            }
          }
        });
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,代碼來源:TreeConflictRefreshablePanel.java

示例12: getTargetDirectory

import com.intellij.openapi.ui.Messages; //導入方法依賴的package包/類
@Nullable
@Override
protected PsiDirectory getTargetDirectory(DataContext dataContext, IdeView view) {
  final PsiDirectory[] directories = view.getDirectories();
  for (PsiDirectory directory : directories) {
    final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(directory);
    if (aPackage == null) {
      continue;
    }
    if (directory.findFile(PsiPackage.PACKAGE_INFO_FILE) != null) {
      Messages.showErrorDialog(CommonDataKeys.PROJECT.getData(dataContext),
                               IdeBundle.message("error.package.already.contains.package-info", aPackage.getQualifiedName()),
                               IdeBundle.message("title.cannot.create.file"));
      return null;
    }
    else if (directory.findFile("package.html") != null) {
      if (Messages.showOkCancelDialog(CommonDataKeys.PROJECT.getData(dataContext),
                                  IdeBundle.message("error.package.already.contains.package.html", aPackage.getQualifiedName()),
                                  IdeBundle.message("error.package.html.found.title"),
                                  IdeBundle.message("button.create"), CommonBundle.message("button.cancel"),
                                  Messages.getQuestionIcon()) != Messages.OK) {
        return null;
      }
    }

  }
  return super.getTargetDirectory(dataContext, view);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:29,代碼來源:CreatePackageInfoAction.java

示例13: checkLookAndFeel

import com.intellij.openapi.ui.Messages; //導入方法依賴的package包/類
private boolean checkLookAndFeel(final UIManager.LookAndFeelInfo lafInfo, final boolean confirm) {
  String message = null;

  if (lafInfo.getName().contains("GTK") && SystemInfo.isXWindow && !SystemInfo.isJavaVersionAtLeast("1.6.0_12")) {
    message = IdeBundle.message("warning.problem.laf.1");
  }

  if (message != null) {
    if (confirm) {
      final String[] options = {IdeBundle.message("confirm.set.look.and.feel"), CommonBundle.getCancelButtonText()};
      final int result = Messages.showOkCancelDialog(message, CommonBundle.getWarningTitle(), options[0], options[1], Messages.getWarningIcon());
      if (result == Messages.OK) {
        myLastWarning = message;
        return true;
      }
      return false;
    }

    if (!message.equals(myLastWarning)) {
      Notifications.Bus.notify(new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID, "L&F Manager", message, NotificationType.WARNING,
                                                NotificationListener.URL_OPENING_LISTENER));
      myLastWarning = message;
    }
  }

  return true;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:LafManagerImpl.java

示例14: validate

import com.intellij.openapi.ui.Messages; //導入方法依賴的package包/類
public boolean validate() throws ConfigurationException {
  final Sdk jdk = myProjectJdksConfigurable.getSelectedJdk();
  if (jdk == null && !ApplicationManager.getApplication().isUnitTestMode()) {
    int result = Messages.showOkCancelDialog(IdeBundle.message("prompt.confirm.project.no.jdk"),
                                             IdeBundle.message("title.no.jdk.specified"), Messages.getWarningIcon());
    if (result != Messages.OK) {
      return false;
    }
  }
  myProjectJdksConfigurable.apply();
  return true;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:ProjectJdkStep.java

示例15: deleteElement

import com.intellij.openapi.ui.Messages; //導入方法依賴的package包/類
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,代碼行數:35,代碼來源:VirtualFileDeleteProvider.java


注:本文中的com.intellij.openapi.ui.Messages.showOkCancelDialog方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。