com.intellij.openapi.ui.Messages类的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(12.1k)|赞(0)|评价(0)|浏览(254)

本文整理了Java中com.intellij.openapi.ui.Messages类的一些代码示例,展示了Messages类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Messages类的具体详情如下:
包路径:com.intellij.openapi.ui.Messages
类名称:Messages

Messages介绍

暂无

代码示例

代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin

private static void showAddingTaskErrorMessage(Project project, String message) {
  Messages.showErrorDialog(project, message, "Go Command Task");
 }
}

代码示例来源:origin: ballerina-platform/ballerina-lang

@Messages.YesNoResult
  private void showRestartDialog() {
    String action = ApplicationManagerEx.getApplicationEx().isRestartCapable() ? "Restart" : "Shutdown";
    String message = action + " is required to activate SDK changes. Do you wish to continue?";
    if (Messages.showYesNoDialog(message, "Apply Changes", action, "Postpone", Messages.getQuestionIcon()) == 0) {
      ApplicationManagerEx.getApplicationEx().restart(true);
    }
  }
}

代码示例来源:origin: hsz/idea-gitignore

String name = Messages.showInputDialog(this,
    IgnoreBundle.message("settings.userTemplates.dialogDescription"),
    IgnoreBundle.message("settings.userTemplates.dialogTitle"),
    Messages.getQuestionIcon(), initialValue.getName(), new InputValidatorEx() {

代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin

@Override
public void run(AnActionButton button) {
 String packageName =
  Messages.showInputDialog("Enter the import path to exclude from auto-import and completion:",
               "Exclude Import Path",
               Messages.getWarningIcon());
 addExcludedPackage(packageName);
}

代码示例来源:origin: Microsoft/azure-devops-intellij

@Test
public void testDeleteWorkspaceWithProgress_UserCancel() throws Exception {
  final MockObserver observer = new MockObserver(manageWorkspacesModel);
  when(Messages.showYesNoDialog(mockProject, TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_CONFIRM_MSG, workspace1.getName()),
      TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_CONFIRM_TITLE), Messages.getWarningIcon())).thenReturn(Messages.NO);
  manageWorkspacesModel.deleteWorkspaceWithProgress(workspace1);
  observer.assertUpdateNeverOccurred(ManageWorkspacesModel.REFRESH_WORKSPACE);
  verifyStatic(never());
  VcsUtil.runVcsProcessWithProgress(any(VcsRunnable.class), any(String.class), any(Boolean.class), any(Project.class));
  Messages.showErrorDialog(any(Project.class), any(String.class), any(String.class));
}

代码示例来源:origin: hsz/idea-gitignore

myListModel.addElement(template);
    Messages.showInfoMessage(templatesListPanel,
        IgnoreBundle.message("action.importTemplates.success", templates.size()),
        IgnoreBundle.message("action.exportTemplates.success.title"));
Messages.showErrorDialog(templatesListPanel, IgnoreBundle.message("action.importTemplates.error"));

代码示例来源:origin: Microsoft/azure-devops-intellij

assertEquals(2, model.getTableModel().getRowCount());
verifyStatic(times(1));
Messages.showWarningDialog(project, TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_NO_ROWS_SELECTED), TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_UPDATE_TITLE));
List<ServerContext> updatedContexts = new ArrayList<ServerContext>(ServerContextManager.getInstance().getAllServerContexts());
assertTrue(updatedContexts.size() == originalContexts.size());
when(Messages.showYesNoDialog(project, TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_UPDATE_MSG), TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_UPDATE_TITLE), Messages.getQuestionIcon())).thenReturn(Messages.CANCEL);
model.getTableSelectionModel().setSelectionInterval(0, 0);
controller.actionPerformed(new ActionEvent(this, 0, TeamServicesSettingsForm.CMD_UPDATE_PASSWORD));
when(Messages.showYesNoDialog(project, TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_UPDATE_MSG), TfPluginBundle.message(TfPluginBundle.KEY_SETTINGS_PASSWORD_MGT_DIALOG_UPDATE_TITLE), Messages.getQuestionIcon())).thenReturn(Messages.OK);
model.getTableSelectionModel().setSelectionInterval(0, 0);
controller.actionPerformed(new ActionEvent(this, 0, TeamServicesSettingsForm.CMD_UPDATE_PASSWORD));

代码示例来源:origin: Camelcade/Perl5-IDEA

@Override
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException {
 ApplicationManager.getApplication().invokeLater(() -> {
  String markerText = Messages.showInputDialog(
   project,
   PerlBundle.message("perl.intention.heredoc.dialog.prompt"),
   PerlBundle.message("perl.intention.heredoc.dialog.title"),
   Messages.getQuestionIcon(),
   HEREDOC_MARKER,
   null);
  if (markerText != null) {
   if (markerText.isEmpty()) {
    Messages.showErrorDialog(
     project,
     PerlBundle.message("perl.intention.heredoc.error.message"),
     PerlBundle.message("perl.intention.heredoc.error.title")
    );
   }
   else    // converting
   {
    HEREDOC_MARKER = markerText;
    WriteCommandAction.runWriteCommandAction(project, () -> super.invoke(project, editor, element));
   }
  }
 });
}

代码示例来源:origin: sonar-intellij-plugin/sonar-intellij-plugin

private void addActionListenersForRemoveLocalAnalysisScriptButton() {
 myRemoveLocalAnalysisScriptButton.addActionListener(
   actionEvent -> {
    final Object selected = myLocalAnalysisScriptComboBox.getSelectedItem();
    int rc = Messages.showOkCancelDialog(
     "Are you sure you want to remove "+selected.toString()+" ?",
     "Remove Local Analysis Script",
     Messages.getQuestionIcon()
    );
    if (rc == Messages.OK) {
     LocalAnalysisScripts.remove(selected.toString());
     myLocalAnalysisScriptComboBox.removeItem(selected);
     disableEditAndRemoveButtonsIfPossible();
    }
   }
 );
}

代码示例来源:origin: uwolfer/gerrit-intellij-plugin

@SuppressWarnings("UnresolvedPropertyKey")
public boolean testGitExecutable(final Project project) {
  final GitVcsApplicationSettings settings = GitVcsApplicationSettings.getInstance();
  final String executable = settings.getPathToGit();
  final GitVersion version;
  try {
    version = GitVersion.identifyVersion(executable);
  } catch (Exception e) {
    Messages.showErrorDialog(project, e.getMessage(), GitBundle.getString("find.git.error.title"));
    return false;
  }
  if (!version.isSupported()) {
    Messages.showWarningDialog(project, GitBundle.message("find.git.unsupported.message", version.toString(), GitVersion.MIN),
        GitBundle.getString("find.git.success.title"));
    return false;
  }
  return true;
}

代码示例来源:origin: ballerina-platform/ballerina-lang

Project project = editor.getProject();
if (suggestAlias) {
  alias = Messages.showInputDialog(project, "Package '" + ((PsiDirectory) element).getName() +
          "' already imported. Please enter an alias:", "Enter Alias",
      Messages.getInformationIcon());
  if (alias == null || alias.isEmpty()) {
    Messages.showErrorDialog("Alias cannot be null or empty.", "Error");
    return;

代码示例来源:origin: makejavas/EasyCode

String value = Messages.showInputDialog("Group Name:", "Input Group Name:", Messages.getQuestionIcon(), currGroupName + " Copy", new InputValidator() {
  @Override
  public boolean checkInput(String inputString) {
if (MessageDialogBuilder.yesNo(MsgValue.TITLE_INFO, "Confirm Delete Group " + typeMapperComboBox.getSelectedItem() + "?").isYes()) {
  if (Settings.DEFAULT_NAME.equals(currGroupName)) {
    Messages.showWarningDialog("Can't Delete Default Group!", MsgValue.TITLE_INFO);
    return;

代码示例来源:origin: SonarSource/sonarlint-intellij

private void enterCustomOrganizationKey() {
 while (true) {
  String organizationKey = Messages.showInputDialog(panel, "Please enter the organization key", "Add Another Organization", null);
  if (StringUtil.isNotEmpty(organizationKey)) {
   boolean found = selectOrganizationIfExists(organizationKey);
   if (found) {
    break;
   }
   GetOrganizationTask task = new GetOrganizationTask(model.createServerWithoutOrganization(), organizationKey);
   ProgressManager.getInstance().run(task);
   if (task.organization().isPresent()) {
    listModel.add(0, task.organization().get());
    orgList.setSelectedIndex(0);
    orgList.ensureIndexIsVisible(0);
    break;
   } else if (task.getException() != null) {
    Messages.showErrorDialog("Failed to fetch organization from SonarQube server: " + task.getException().getMessage(), "Connection Failure");
   } else {
    Messages.showErrorDialog(String.format("Organization '%s' not found. Please enter the key of an existing organization.", organizationKey), "Organization Not Found");
   }
  } else {
   break;
  }
 }
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

@Override
public void actionPerformed(@NotNull AnActionEvent event) {
  final Project project = getEventProject(event);
  if(project == null) {
    this.setStatus(event, false);
    return;
  }
  PsiDirectory bundleDirContext = BundleClassGeneratorUtil.getBundleDirContext(event);
  if(bundleDirContext == null) {
    return;
  }
  final PhpClass phpClass = BundleClassGeneratorUtil.getBundleClassInDirectory(bundleDirContext);
  if(phpClass == null) {
    return;
  }
  String className = Messages.showInputDialog(project, "New class name:", "New File", Symfony2Icons.SYMFONY);
  if(StringUtils.isBlank(className)) {
    return;
  }
  if(!PhpNameUtil.isValidClassName(className)) {
    JOptionPane.showMessageDialog(null, "Invalid class name");
    return;
  }
  write(project, phpClass, className);
}

代码示例来源:origin: ballerina-platform/ballerina-lang

@Override
public void apply() {
  final List<String> extensions = rows.stream().map(row -> row.getText(EXT)).collect(Collectors.toList());
  final Set<String> distinct = new ArrayList<>(extensions).stream().distinct().collect(Collectors.toSet());
  distinct.forEach(extensions::remove);
  if (!extensions.isEmpty()) {
    Messages.showWarningDialog(extensions.stream().reduce((f, s) -> "Duplicate : " + f + Utils.lineSeparator() + s).orElse("Error while getting extensions") + Utils.lineSeparator() + "Unexpected behavior may occur", "Duplicate Extensions");
  }
  //TODO manage without restarting
  //Messages.showInfoMessage("The changes will be applied after restarting the IDE.", "LSP Settings");
  serverDefinitions.clear();
  for (final ServersGUIRow row : rows) {
    final String[] arr = row.toStringArray();
    final String ext = row.getText(EXT);
    final UserConfigurableServerDefinition serverDefinition = UserConfigurableServerDefinition$.MODULE$.fromArray(arr);
    if (serverDefinition != null) {
      serverDefinitions.put(ext, serverDefinition);
    }
  }
  BallerinaLSPState.getInstance().setExtToServ(serverDefinitions);
  PluginMain$.MODULE$.setExtToServerDefinition(serverDefinitions);
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

public static void buildFile(AnActionEvent event, final Project project, String templatePath) {
  String extension = (templatePath.endsWith(".yml") || templatePath.endsWith(".yaml")) ? "yml" : "xml" ;
  String fileName = Messages.showInputDialog(project, "File name (without extension)", String.format("Create %s Service", extension), Symfony2Icons.SYMFONY);
  if(fileName == null || StringUtils.isBlank(fileName)) {
    return;
    Messages.showInfoMessage("File exists", "Error");
    return;

代码示例来源:origin: pengwei1024/AndroidSourceViewer

@Override
  public void run() {
    Messages.showMessageDialog(message, "Error", Messages.getInformationIcon());
  }
});

代码示例来源:origin: rholder/gradle-view

private int useCurrentProjectBuild() {
    return Messages.showYesNoDialog(
        "Would you like to view the current project's Gradle dependencies?",
        "Gradle Dependency Viewer",
        null);
  }
}

代码示例来源:origin: groboclown/p4ic4idea

@Override
public void textUpdated(@NotNull DocumentEvent e, @Nullable String text) {
  if (getSelectedSyncType() == SyncOptions.SyncType.REV && getRevValue() < 0) {
    Messages.showMessageDialog(
        P4Bundle.message("sync.options.rev.error"),
        P4Bundle.message("sync.options.rev.error.title"),
        Messages.getErrorIcon());
  } else {
    updateValues(parent);
  }
}

代码示例来源:origin: Camelcade/Perl5-IDEA

int[] response = new int[]{-1};
 ApplicationManager.getApplication().invokeAndWait(() -> {
  response[0] = Messages.showYesNoDialog(PerlBundle.message("perl.vm.would.you.like.to.install"),
                      PerlBundle.message("perl.vm.empty.list.title"),
                      getIcon());
 () -> Messages.showInfoMessage(PerlBundle.message("perl.vm.empty.list.message"), PerlBundle.message("perl.vm.empty.list.title")));
return;
Ref<Integer> selectionRef = Ref.create(-1);
ApplicationManager.getApplication().invokeAndWait(
 () -> selectionRef.set(Messages.showChooseDialog(
  "",
  PerlBundle.message("perl.vm.perlbrew.choose.installation"),

相关文章