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


Java Messages.YES屬性代碼示例

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


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

示例1: checkMovePackage

private static boolean checkMovePackage(Project project, PsiPackage aPackage) {
  final PsiDirectory[] directories = aPackage.getDirectories();
  final VirtualFile[] virtualFiles = aPackage.occursInPackagePrefixes();
  if (directories.length > 1 || virtualFiles.length > 0) {
    final StringBuffer message = new StringBuffer();
    RenameUtil.buildPackagePrefixChangedMessage(virtualFiles, message, aPackage.getQualifiedName());
    if (directories.length > 1) {
      DirectoryAsPackageRenameHandlerBase.buildMultipleDirectoriesInPackageMessage(message, aPackage.getQualifiedName(), directories);
      message.append("\n\n");
      String report = RefactoringBundle
        .message("all.these.directories.will.be.moved.and.all.references.to.0.will.be.changed", aPackage.getQualifiedName());
      message.append(report);
    }
    message.append("\n");
    message.append(RefactoringBundle.message("do.you.wish.to.continue"));
    int ret =
      Messages.showYesNoDialog(project, message.toString(), RefactoringBundle.message("warning.title"), Messages.getWarningIcon());
    if (ret != Messages.YES) {
      return false;
    }
  }
  return true;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:MoveClassesOrPackagesImpl.java

示例2: apply

public void apply() throws ConfigurationException {
  if (myUseUserManifest.isSelected() && myManifest.getText() != null && !new File(myManifest.getText()).exists()){
    throw new ConfigurationException(DevKitBundle.message("error.file.not.found.message", myManifest.getText()));
  }
  final File plugin = new File(myBuildProperties.getPluginXmlPath());
  final String newPluginPath = myPluginXML.getText() + File.separator + META_INF + File.separator + PLUGIN_XML;
  if (plugin.exists() && !plugin.getPath().equals(newPluginPath) && 
      Messages.showYesNoDialog(myModule.getProject(), DevKitBundle.message("deployment.view.delete", plugin.getPath()),
                               DevKitBundle.message("deployment.cleanup", META_INF), null) == Messages.YES) {

    CommandProcessor.getInstance().executeCommand(myModule.getProject(),
                                                  new Runnable() {
                                                    public void run() {
                                                      FileUtil.delete(plugin.getParentFile());
                                                    }
                                                  },
                                                  DevKitBundle.message("deployment.cleanup", META_INF),
                                                  null);
  }
  myBuildProperties.setPluginXmlPathAndCreateDescriptorIfDoesntExist(newPluginPath);
  myBuildProperties.setManifestPath(myManifest.getText());
  myBuildProperties.setUseUserManifest(myUseUserManifest.isSelected());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:PluginModuleBuildConfEditor.java

示例3: showYesNoDialog

@Override
public int showYesNoDialog(@NotNull String title,
                           String message,
                           @NotNull String yesButton,
                           @NotNull String noButton,
                           @Nullable Window window,
                           @Nullable DialogWrapper.DoNotAskOption doNotAskDialogOption) {
  if (window == null) {
    window = getForemostWindow(null);
  }
  SheetMessage sheetMessage = new SheetMessage(window, title, message, UIUtil.getQuestionIcon(),
                                               new String [] {yesButton, noButton}, doNotAskDialogOption, yesButton, noButton);
  int result = sheetMessage.getResult().equals(yesButton) ? Messages.YES : Messages.NO;
  if (doNotAskDialogOption != null && (result == Messages.YES || doNotAskDialogOption.shouldSaveOptionsOnCancel())) {
    doNotAskDialogOption.setToBeShown(sheetMessage.toBeShown(), result);
  }
  return result;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:JBMacMessages.java

示例4: actionPerformed

@Override
public void actionPerformed(ActionEvent e) {
  AvdManagerConnection connection = AvdManagerConnection.getDefaultAvdManagerConnection();
  AvdInfo avdInfo = getAvdInfo();
  if (avdInfo == null) {
    return;
  }
  if (connection.isAvdRunning(avdInfo)) {
    Messages.showErrorDialog((Project)null, "The selected AVD is currently running in the Emulator. " +
                                            "Please exit the emulator instance and try wiping again.", "Cannot Wipe A Running AVD");
    return;
  }
  int result = Messages.showYesNoDialog((Project)null, "Do you really want to wipe user files from AVD " + avdInfo.getName() + "?",
                                        "Confirm Data Wipe", AllIcons.General.QuestionDialog);
  if (result == Messages.YES) {
    connection.wipeUserData(avdInfo);
    refreshAvds();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:WipeAvdDataAction.java

示例5: checkAddModuleDependency

private boolean checkAddModuleDependency(final ComponentItem item, final ModuleSourceOrderEntry moduleSourceOrderEntry) {
  final Module ownerModule = moduleSourceOrderEntry.getOwnerModule();
  int rc = Messages.showYesNoCancelDialog(
    myEditor,
    UIDesignerBundle.message("add.module.dependency.prompt", item.getClassName(), ownerModule.getName(), myEditor.getModule().getName()),
    UIDesignerBundle.message("add.module.dependency.title"),
    Messages.getQuestionIcon());
  if (rc == Messages.CANCEL) return false;
  if (rc == Messages.YES) {
    ModuleRootModificationUtil.addDependency(myEditor.getModule(), ownerModule);
  }
  return true;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:InsertComponentProcessor.java

示例6: showExitWithoutApplyingChangesDialog

public static boolean showExitWithoutApplyingChangesDialog(@NotNull JComponent component,
                                                           @NotNull MergeRequest request,
                                                           @NotNull MergeContext context) {
  String message = DiffBundle.message("merge.dialog.exit.without.applying.changes.confirmation.message");
  String title = DiffBundle.message("cancel.visual.merge.dialog.title");
  Couple<String> customMessage = DiffUtil.getUserData(request, context, DiffUserDataKeysEx.MERGE_CANCEL_MESSAGE);
  if (customMessage != null) {
    title = customMessage.first;
    message = customMessage.second;
  }

  return Messages.showYesNoDialog(component.getRootPane(), message, title, Messages.getQuestionIcon()) == Messages.YES;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:MergeUtil.java

示例7: contentRemoveQuery

@Override
public void contentRemoveQuery(ContentManagerEvent event) {
  if (event.getContent() == myContent) {
    if (!myErrorsView.isProcessStopped()) {
      int result = Messages.showYesNoDialog(
        XmlBundle.message("xml.validate.validation.is.running.terminate.confirmation.text"),
        XmlBundle.message("xml.validate.validation.is.running.terminate.confirmation.title"),
        Messages.getQuestionIcon()
      );
      if (result != Messages.YES) {
        event.consume();
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:StdErrorReporter.java

示例8: doOKAction

@Override
protected void doOKAction() {
  final PsiClass clazz = (PsiClass)myContext.getScope();
  final String name = getName();
  String message = RefactoringBundle.message("field.exists", name, clazz.getQualifiedName());
  if (clazz.findFieldByName(name, true) != null &&
      Messages.showYesNoDialog(myContext.getProject(), message, IntroduceFieldHandler.REFACTORING_NAME, Messages.getWarningIcon()) != Messages.YES) {
    return;
  }
  super.doOKAction();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:GrIntroduceFieldDialog.java

示例9: actionPerformed

@Override
public void actionPerformed(ActionEvent e) {
  Device device = myProvider.getDevice();
  int result = Messages.showYesNoDialog((Project)null, "Do you really want to delete Device " + device.getDisplayName() + "?",
                                        "Confirm Deletion", AllIcons.General.QuestionDialog);
  if (result == Messages.YES) {
    DeviceManagerConnection.getDefaultDeviceManagerConnection().deleteDevice(device);
    myProvider.refreshDevices();
    myProvider.selectDefaultDevice();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:DeleteDeviceAction.java

示例10: mergeIfNeeded

private static void mergeIfNeeded(@NotNull final File sourceSdk, @NotNull final File destSdk) {
  if (SdkMerger.hasMergeableContent(sourceSdk, destSdk)) {
    String msg = String.format("The Android SDK at\n\n%1$s\n\nhas packages not in your project's SDK at\n\n%2$s\n\n" +
                               "Would you like to copy into the project SDK?", sourceSdk.getPath(), destSdk.getPath());
    int result = MessageDialogBuilder.yesNo("Merge SDKs", msg).yesText("Copy").noText("Do not copy").show();
    if (result == Messages.YES) {
      new Task.Backgroundable(null, "Merging Android SDKs", false) {
        @Override
        public void run(@NotNull ProgressIndicator indicator) {
          SdkMerger.mergeSdks(sourceSdk, destSdk, indicator);
        }
      }.queue();
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:SdkSync.java

示例11: executeConfiguration

public static void executeConfiguration(@NotNull ExecutionEnvironment environment, boolean showSettings, boolean assignNewId) {
  if (ExecutorRegistry.getInstance().isStarting(environment)) {
    return;
  }

  RunnerAndConfigurationSettings runnerAndConfigurationSettings = environment.getRunnerAndConfigurationSettings();
  if (runnerAndConfigurationSettings != null) {
    if (!ExecutionTargetManager.canRun(environment)) {
      ExecutionUtil.handleExecutionError(environment, new ExecutionException(
        StringUtil.escapeXml("Cannot run '" + environment.getRunProfile().getName() + "' on '" + environment.getExecutionTarget().getDisplayName() + "'")));
      return;
    }

    if (!RunManagerImpl.canRunConfiguration(environment) || (showSettings && runnerAndConfigurationSettings.isEditBeforeRun())) {
      if (!RunDialog.editConfiguration(environment, "Edit configuration")) {
        return;
      }

      while (!RunManagerImpl.canRunConfiguration(environment)) {
        if (Messages.YES == Messages
          .showYesNoDialog(environment.getProject(), "Configuration is still incorrect. Do you want to edit it again?", "Change Configuration Settings",
                           "Edit", "Continue Anyway", Messages.getErrorIcon())) {
          if (!RunDialog.editConfiguration(environment, "Edit configuration")) {
            return;
          }
        }
        else {
          break;
        }
      }
    }

    ConfigurationType configurationType = runnerAndConfigurationSettings.getType();
    if (configurationType != null) {
      UsageTrigger.trigger("execute." + ConvertUsagesUtil.ensureProperKey(configurationType.getId()) + "." + environment.getExecutor().getId());
    }
  }

  try {
    if (assignNewId) {
      environment.assignNewExecutionId();
    }
    environment.getRunner().execute(environment);
  }
  catch (ExecutionException e) {
    String name = runnerAndConfigurationSettings != null ? runnerAndConfigurationSettings.getName() : null;
    if (name == null) {
      name = environment.getRunProfile().getName();
    }
    if (name == null && environment.getContentToReuse() != null) {
      name = environment.getContentToReuse().getDisplayName();
    }
    if (name == null) {
      name = "<Unknown>";
    }
    ExecutionUtil.handleExecutionError(environment.getProject(), environment.getExecutor().getToolWindowId(), name, e);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:58,代碼來源:ProgramRunnerUtil.java

示例12: chooseOriginalMembers

@Nullable
@Override
protected ClassMember[] chooseOriginalMembers(PsiClass aClass, Project project) {
  final PsiMethod[] missings = aClass.findMethodsByName("methodMissing", true);

  PsiMethod method = null;

  for (PsiMethod missing : missings) {
    final PsiParameter[] parameters = missing.getParameterList().getParameters();
    if (parameters.length == 2) {
      if (isNameParam(parameters[0])) {
        method = missing;
      }
    }
  }
  if (method != null) {
    String text = GroovyCodeInsightBundle.message("generate.method.missing.already.defined.warning");

    if (Messages.showYesNoDialog(project, text,
                                 GroovyCodeInsightBundle.message("generate.method.missing.already.defined.title"),
                                 Messages.getQuestionIcon()) == Messages.YES) {
      final PsiMethod finalMethod = method;
      if (!ApplicationManager.getApplication().runWriteAction(new Computable<Boolean>() {
        @Override
        public Boolean compute() {
          try {
            finalMethod.delete();
            return Boolean.TRUE;
          }
          catch (IncorrectOperationException e) {
            LOG.error(e);
            return Boolean.FALSE;
          }
        }
      }).booleanValue()) {
        return null;
      }
    }
    else {
      return null;
    }
  }

  return new ClassMember[1];
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:45,代碼來源:GroovyGenerateMethodMissingHandler.java

示例13: confirmExitIfNeeded

private static boolean confirmExitIfNeeded(boolean exitConfirmed) {
  final boolean hasUnsafeBgTasks = ProgressManager.getInstance().hasUnsafeProgressIndicator();
  if (exitConfirmed && !hasUnsafeBgTasks) {
    return true;
  }

  DialogWrapper.DoNotAskOption option = new DialogWrapper.DoNotAskOption() {
    @Override
    public boolean isToBeShown() {
      return GeneralSettings.getInstance().isConfirmExit() && ProjectManager.getInstance().getOpenProjects().length > 0;
    }

    @Override
    public void setToBeShown(boolean value, int exitCode) {
      GeneralSettings.getInstance().setConfirmExit(value);
    }

    @Override
    public boolean canBeHidden() {
      return !hasUnsafeBgTasks;
    }

    @Override
    public boolean shouldSaveOptionsOnCancel() {
      return false;
    }

    @NotNull
    @Override
    public String getDoNotShowMessage() {
      return "Do not ask me again";
    }
  };

  if (hasUnsafeBgTasks || option.isToBeShown()) {
    String message = ApplicationBundle
      .message(hasUnsafeBgTasks ? "exit.confirm.prompt.tasks" : "exit.confirm.prompt",
               ApplicationNamesInfo.getInstance().getFullProductName());

    if (MessageDialogBuilder.yesNo(ApplicationBundle.message("exit.confirm.title"), message).yesText(ApplicationBundle.message("command.exit")).noText(CommonBundle.message("button.cancel"))
          .doNotAsk(option).show() != Messages.YES) {
      return false;
    }
  }
  return true;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:46,代碼來源:ApplicationImpl.java

示例14: askUserToCancelGradleExecution

private boolean askUserToCancelGradleExecution() {
  String msg = "Gradle is running. Proceed with Project closing?";
  int result = Messages.showYesNoDialog(myProject, msg, GRADLE_RUNNING_MSG_TITLE, Messages.getQuestionIcon());
  return result == Messages.YES;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:GradleTasksExecutor.java

示例15: show

@Override
public void show(@NotNull final DiffRequest request) {
  saveContents(request);

  int result = DialogWrapper.CANCEL_EXIT_CODE;

  GeneralCommandLine commandLine = new GeneralCommandLine();
  commandLine.setExePath(getToolPath());
  try {
    commandLine.addParameters(getParameters(request));
    commandLine.createProcess();

    ProgressManager.getInstance().run(new Task.Modal(request.getProject(), "Launching external tool", false) {
      @Override
      public void run(@NotNull ProgressIndicator indicator) {
        indicator.setIndeterminate(true);
        TimeoutUtil.sleep(1000);
      }
    });

    if (Messages.YES == Messages.showYesNoDialog(request.getProject(),
                                                 "Press \"Mark as Resolved\" when you finish resolving conflicts in the external tool",
                                                 "Merge In External Tool", "Mark as Resolved", "Revert", null)) {
      result = DialogWrapper.OK_EXIT_CODE;
    }
    DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
      @Override
      public void run() {
        ((MergeRequestImpl)request).getResultContent().getFile().refresh(false, false);
      }
    });
    // We can actually check exit code of external tool, but some of them could work with tabs -> do not close at all
  }
  catch (Exception e) {
    ExecutionErrorDialog
      .show(new ExecutionException(e.getMessage()), DiffBundle.message("cant.launch.diff.tool.error.message"), request.getProject());
  }
  finally {
    ((MergeRequestImpl)request).setResult(result);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:41,代碼來源:ExtMergeFiles.java


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