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


Java Messages.showDialog方法代码示例

本文整理汇总了Java中com.intellij.openapi.ui.Messages.showDialog方法的典型用法代码示例。如果您正苦于以下问题:Java Messages.showDialog方法的具体用法?Java Messages.showDialog怎么用?Java Messages.showDialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.ui.Messages的用法示例。


在下文中一共展示了Messages.showDialog方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validate

import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
@Override
public boolean validate() throws ConfigurationException {
  if (myJdkComboBox.getSelectedJdk() == null && !myJdkComboBox.isProjectJdkSelected()) {
    if (Messages.showDialog(getNoSdkMessage(),
                                     IdeBundle.message("title.no.jdk.specified"),
                                     new String[]{CommonBundle.getYesButtonText(), CommonBundle.getNoButtonText()}, 1, Messages.getWarningIcon()) != Messages.YES) {
      return false;
    }
  }
  try {
    myModel.apply(null, true);
  } catch (ConfigurationException e) {
    //IDEA-98382 We should allow Next step if user has wrong SDK
    if (Messages.showDialog(e.getMessage() + "/nDo you want to proceed?",
                                     e.getTitle(),
                                     new String[]{CommonBundle.getYesButtonText(), CommonBundle.getNoButtonText()}, 1, Messages.getWarningIcon()) != Messages.YES) {
      return false;
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:SdkSettingsStep.java

示例2: actionPerformed

import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final int modifiers = e.getModifiers();
  final boolean forceOpenInNewFrame = (modifiers & InputEvent.CTRL_MASK) != 0
                                      || (modifiers & InputEvent.SHIFT_MASK) != 0
                                      || e.getPlace() == ActionPlaces.WELCOME_SCREEN;

  Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
  if (!new File(myProjectPath).exists()) {
    if (Messages.showDialog(project, "The path " + FileUtil.toSystemDependentName(myProjectPath) + " does not exist.\n" +
                                     "If it is on a removable or network drive, please make sure that the drive is connected.",
                                     "Reopen Project", new String[]{"OK", "&Remove From List"}, 0, Messages.getErrorIcon()) == 1) {
      RecentProjectsManager.getInstance().removePath(myProjectPath);
    }
    return;
  }
  RecentProjectsManagerBase.getInstanceEx().doOpenProject(myProjectPath, project, forceOpenInNewFrame);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ReopenProjectAction.java

示例3: performFinishingActions

import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
@Override
public void performFinishingActions() {
  List<IPkgDesc> skipped = myState.get(SKIPPED_INSTALL_REQUESTS_KEY);
  if (skipped != null && !skipped.isEmpty()) {
    StringBuilder warningBuilder = new StringBuilder("The following packages were not installed.\n\n Would you like to exit ");
    warningBuilder.append(ApplicationNamesInfo.getInstance().getFullProductName());
    warningBuilder.append(" and install the following packages using the standalone SDK manager?");
    for (IPkgDesc problemPkg : skipped) {
      warningBuilder.append("\n");
      warningBuilder.append(problemPkg.getListDescription());
    }
    String restartOption = String.format("Exit %s and launch SDK Manager", ApplicationNamesInfo.getInstance().getProductName());
    int result = Messages.showDialog(getProject(), warningBuilder.toString(), "Warning", new String[]{restartOption, "Skip installation"},
                                     0, AllIcons.General.Warning);
    if (result == 0) {
      startSdkManagerAndExit();
    }
  }
  // We've already installed things, so clearly there's an SDK.
  AndroidSdkData data = AndroidSdkUtils.tryToChooseAndroidSdk();
  SdkState.getInstance(data).loadAsync(SdkState.DEFAULT_EXPIRATION_PERIOD_MS, false, null, null, null, true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:SdkQuickfixWizard.java

示例4: showMessageDialog

import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
protected int showMessageDialog(@NotNull Project project,
                                @NotNull String message,
                                @NotNull String title,
                                @NotNull String[] options,
                                int defaultButtonIndex,
                                @Nullable Icon icon) {
  return Messages.showDialog(project, message, title, options, defaultButtonIndex, icon);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DialogManager.java

示例5: startNewTask

import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
@Override
public TaskInfo startNewTask(@NotNull final String taskName) {
  List<R> repositories = myRepositoryManager.getRepositories();
  List<R> problems = ContainerUtil.filter(repositories, new Condition<R>() {
    @Override
    public boolean value(R repository) {
      return hasBranch(repository, taskName);
    }
  });
  List<R> map = new ArrayList<R>();
  if (!problems.isEmpty()) {
    if (ApplicationManager.getApplication().isUnitTestMode() ||
        Messages.showDialog(myProject,
                            "<html>The following repositories already have specified " + myBranchType + "<b>" + taskName + "</b>:<br>" +
                            StringUtil.join(problems, "<br>") + ".<br>" +
                            "Do you want to checkout existing " + myBranchType + "?", StringUtil.capitalize(myBranchType) + " Already Exists",
                            new String[]{Messages.YES_BUTTON, Messages.NO_BUTTON}, 0,
                            Messages.getWarningIcon(), new DialogWrapper.PropertyDoNotAskOption("git.checkout.existing.branch")) == 0) {
      checkout(taskName, problems, null);
      map.addAll(problems);
    }
  }
  repositories.removeAll(problems);
  if (!repositories.isEmpty()) {
    checkoutAsNewBranch(taskName, repositories);
  }

  map.addAll(repositories);
  return new TaskInfo(taskName, ContainerUtil.map(map, new Function<R, String>() {
    @Override
    public String fun(R r) {
      return r.getPresentableUrl();
    }
  }));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:DvcsTaskHandler.java

示例6: showResults

import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
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,代码行数:29,代码来源:TodoCheckinHandler.java

示例7: show

import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
public static int show(final Project project,
                       final String sessionName,
                       final TerminateOption option) {
  final String message = option.myAlwaysUseDefault && !option.myDetach ?
                         ExecutionBundle.message("terminate.process.confirmation.text", sessionName) :
                         ExecutionBundle.message("disconnect.process.confirmation.text", sessionName);
  final String okButtonText = option.myAlwaysUseDefault && !option.myDetach ?
                              ExecutionBundle.message("button.terminate") :
                              ExecutionBundle.message("button.disconnect");
  final String[] options = new String[] {okButtonText, CommonBundle.getCancelButtonText()};
  return Messages.showDialog(project, message, ExecutionBundle.message("process.is.running.dialog.title", sessionName),
                      options, 0, Messages.getWarningIcon(),
                      option);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:TerminateRemoteProcessDialog.java

示例8: checkFileExist

import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
public static boolean checkFileExist(@Nullable PsiDirectory targetDirectory, int[] choice, PsiFile file, String name, String title) {
  if (targetDirectory == null) return false;
  final PsiFile existing = targetDirectory.findFile(name);
  if (existing != null && !existing.equals(file)) {
    int selection;
    if (choice == null || choice[0] == -1) {
      String message = String.format("File '%s' already exists in directory '%s'", name, targetDirectory.getVirtualFile().getPath());
      String[] options = choice == null ? new String[]{"Overwrite", "Skip"}
                                        : new String[]{"Overwrite", "Skip", "Overwrite for all", "Skip for all"};
      selection = Messages.showDialog(message, title, options, 0, Messages.getQuestionIcon());
    }
    else {
      selection = choice[0];
    }

    if (choice != null && selection > 1) {
      choice[0] = selection % 2;
      selection = choice[0];
    }

    if (selection == 0 && file != existing) {
      existing.delete();
    }
    else {
      return true;
    }
  }

  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:CopyFilesOrDirectoriesHandler.java

示例9: prepareResourceFileRenaming

import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
private static void prepareResourceFileRenaming(PsiFile file, String newName, Map<PsiElement, String> allRenames, AndroidFacet facet) {
  Project project = file.getProject();
  ResourceManager manager = facet.getLocalResourceManager();
  String type = manager.getFileResourceType(file);
  if (type == null) return;
  String name = file.getName();

  if (AndroidCommonUtils.getResourceName(type, name).equals(AndroidCommonUtils.getResourceName(type, newName))) {
    return;
  }

  List<PsiFile> resourceFiles = manager.findResourceFiles(type, AndroidCommonUtils.getResourceName(type, name), true, false);
  List<PsiFile> alternativeResources = new ArrayList<PsiFile>();
  for (PsiFile resourceFile : resourceFiles) {
    if (!resourceFile.getManager().areElementsEquivalent(file, resourceFile) && resourceFile.getName().equals(name)) {
      alternativeResources.add(resourceFile);
    }
  }
  if (alternativeResources.size() > 0) {
    int r = 0;
    if (ASK) {
      r = Messages.showDialog(project, message("rename.alternate.resources.question"), message("rename.dialog.title"),
                              new String[]{Messages.YES_BUTTON, Messages.NO_BUTTON}, 1, Messages.getQuestionIcon());
    }
    if (r == 0) {
      for (PsiFile candidate : alternativeResources) {
        allRenames.put(candidate, newName);
      }
    }
    else {
      return;
    }
  }
  PsiField[] resFields = AndroidResourceUtil.findResourceFieldsForFileResource(file, false);
  for (PsiField resField : resFields) {
    String newFieldName = AndroidCommonUtils.getResourceName(type, newName);
    allRenames.put(resField, AndroidResourceUtil.getFieldNameByResourceName(newFieldName));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:AndroidResourceRenameResourceProcessor.java

示例10: checkInstallation

import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
private static void checkInstallation() {
  String studioHome = PathManager.getHomePath();
  if (isEmpty(studioHome)) {
    LOG.info("Unable to find Studio home directory");
    return;
  }
  File studioHomePath = new File(toSystemDependentName(studioHome));
  if (!studioHomePath.isDirectory()) {
    LOG.info(String.format("The path '%1$s' does not belong to an existing directory", studioHomePath.getPath()));
    return;
  }
  File androidPluginLibFolderPath = new File(studioHomePath, join("plugins", "android", "lib"));
  if (!androidPluginLibFolderPath.isDirectory()) {
    LOG.info(String.format("The path '%1$s' does not belong to an existing directory", androidPluginLibFolderPath.getPath()));
    return;
  }

  // Look for signs that the installation is corrupt due to improper updates (typically unzipping on top of previous install)
  // which doesn't delete files that have been removed or renamed
  String cause = null;
  File[] children = notNullize(androidPluginLibFolderPath.listFiles());
  if (hasMoreThanOneBuilderModelFile(children)) {
    cause = "(Found multiple versions of builder-model-*.jar in plugins/android/lib.)";
  } else if (new File(studioHomePath, join("plugins", "android-designer")).exists()) {
    cause = "(Found plugins/android-designer which should not be present.)";
  }
  if (cause != null) {
    String msg = "Your Android Studio installation is corrupt and will not work properly.\n" +
                 cause + "\n" +
                 "This usually happens if Android Studio is extracted into an existing older version.\n\n" +
                 "Please reinstall (and make sure the new installation directory is empty first.)";
    String title = "Corrupt Installation";
    int option = Messages.showDialog(msg, title, new String[]{"Quit", "Proceed Anyway"}, 0, Messages.getErrorIcon());
    if (option == 0) {
      ApplicationManagerEx.getApplicationEx().exit();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:AndroidStudioSpecificInitializer.java

示例11: showMessage

import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
private void showMessage(String message, String header) {
    Messages.showDialog(message, header, new String[]{"OK"}, -1, null);
}
 
开发者ID:robohorse,项目名称:RoboPOJOGenerator,代码行数:4,代码来源:MessageDelegate.java

示例12: showTestMessage

import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
private static void showTestMessage(Project p) {
  Messages.showDialog(p, "Test message", "Test Title", new String[]{"Option one", "Option two", "Option three"}, 0, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:MacMessagesTest.java

示例13: actionPerformed

import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
  AvdInfo info = getAvdInfo();
  if (info == null) {
    return;
  }

  HtmlBuilder htmlBuilder = new HtmlBuilder();
  htmlBuilder.openHtmlBody();
  htmlBuilder.addHtml("<br>Name: ").add(info.getName());
  htmlBuilder.addHtml("<br>CPU/ABI: ").add(AvdInfo.getPrettyAbiType(info));

  htmlBuilder.addHtml("<br>Path: ").add(info.getDataFolderPath());

  if (info.getStatus() != AvdInfo.AvdStatus.OK) {
    htmlBuilder.addHtml("<br>Error: ").add(info.getErrorMessage());
  } else {
    IAndroidTarget target = info.getTarget();
    AndroidVersion version = target.getVersion();
    htmlBuilder.addHtml("<br>Target: ").add(String.format("%1$s (API level %2$s)", target.getName(), version.getApiString()));

    // display some extra values.
    Map<String, String> properties = info.getProperties();
    String skin = properties.get(AvdManager.AVD_INI_SKIN_NAME);
    if (skin != null) {
      htmlBuilder.addHtml("<br>Skin: ").add(skin);
    }

    String sdcard = properties.get(AvdManager.AVD_INI_SDCARD_SIZE);
    if (sdcard == null) {
      sdcard = properties.get(AvdManager.AVD_INI_SDCARD_PATH);
    }
    if (sdcard != null) {
      htmlBuilder.addHtml("<br>SD Card: ").add(sdcard);
    }

    String snapshot = properties.get(AvdManager.AVD_INI_SNAPSHOT_PRESENT);
    if (snapshot != null) {
      htmlBuilder.addHtml("<br>Snapshot: ").add(snapshot);
    }

    // display other hardware
    HashMap<String, String> copy = new HashMap<String, String>(properties);
    // remove stuff we already displayed (or that we don't want to display)
    copy.remove(AvdManager.AVD_INI_ABI_TYPE);
    copy.remove(AvdManager.AVD_INI_CPU_ARCH);
    copy.remove(AvdManager.AVD_INI_SKIN_NAME);
    copy.remove(AvdManager.AVD_INI_SKIN_PATH);
    copy.remove(AvdManager.AVD_INI_SDCARD_SIZE);
    copy.remove(AvdManager.AVD_INI_SDCARD_PATH);
    copy.remove(AvdManager.AVD_INI_IMAGES_1);
    copy.remove(AvdManager.AVD_INI_IMAGES_2);

    if (copy.size() > 0) {
      for (Map.Entry<String, String> entry : copy.entrySet()) {
        htmlBuilder.addHtml("<br>").add(entry.getKey()).add(": ").add(entry.getValue());
      }
    }
  }
  htmlBuilder.closeHtmlBody();
  String[] options = {"Copy to Clipboard and Close", "Close"};
  int i = Messages.showDialog((Project)null, htmlBuilder.getHtml(), "Details for " + info.getName(),
                              options, 0, AllIcons.General.InformationDialog);
  if (i == 0) {
    CopyPasteManager.getInstance().setContents(new StringSelection(StringUtil.stripHtml(htmlBuilder.getHtml(), true)));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:68,代码来源:AvdSummaryAction.java

示例14: init

import com.intellij.openapi.ui.Messages; //导入方法依赖的package包/类
@Override
public void init() {
  ScopedStateStore state = getState();
  addPath(new SdkQuickfixPath(getDisposable()));

  Set<IPkgDesc> problems = findProblemPackages();
  int selectedOption = 1; // Install all, default when there are no problems.

  if (!problems.isEmpty()) {
    StringBuilder warningBuilder = new StringBuilder("Due to your system configuration and the packages to be installed, \n" +
                                                     "it is likely that the following packages cannot be successfully installed while ");
    warningBuilder.append(ApplicationNamesInfo.getInstance().getFullProductName());
    warningBuilder.append(" is running. \n\nPlease exit and install the following packages using the standalone SDK manager:");
    for (IPkgDesc problemPkg : problems) {
      warningBuilder.append("\n    -");
      warningBuilder.append(problemPkg.getListDescription());
    }
    if (problems.size() == myRequestedPackages.size()) {
      selectedOption = Messages.showDialog(getProject(), warningBuilder.toString(), "Warning", new String[]{
        String.format("Exit %s and launch SDK Manager", ApplicationNamesInfo.getInstance().getProductName()),
        "Attempt to install packages"}, 0, AllIcons.General.Warning);
    }
    else {
      String[] options = new String[] {
        String.format("Exit %s and launch SDK Manager", ApplicationNamesInfo.getInstance().getProductName()),
        "Attempt to install all packages",
        "Install safe packages"
      };

      selectedOption = Messages.showDialog(
        getProject(), warningBuilder.toString(), "Warning",
        options,
        2, AllIcons.General.Warning);
    }
  }
  if (selectedOption == 0) {
    startSdkManagerAndExit();
  }
  else {
    for (IPkgDesc desc : myRequestedPackages) {
      if (selectedOption == 2 && problems.contains(desc)) {
        state.listPush(SKIPPED_INSTALL_REQUESTS_KEY, desc);
      }
      else {
        state.listPush(INSTALL_REQUESTS_KEY, desc);
      }
    }
  }
  super.init();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:51,代码来源:SdkQuickfixWizard.java


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