当前位置: 首页>>代码示例>>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;未经允许,请勿转载。