com.intellij.openapi.ui.Messages.showErrorDialog()方法的使用及代码示例

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

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

Messages.showErrorDialog介绍

暂无

代码示例

代码示例来源: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

@Nullable
public static BallerinaLSPState getInstance() {
  try {
    return ServiceManager.getService(BallerinaLSPState.class);
  } catch (final Exception e) {
    LOG.warn("Couldn't load BallerinaLSPState");
    LOG.warn(e);
    ApplicationUtils$.MODULE$.invokeLater(() -> Messages.showErrorDialog("Couldn't load LSP settings, you will need to reconfigure them.", "LSP plugin"));
    return null;
  }
}

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

@Override
public void loadState(@NotNull final BallerinaLSPState lspState) {
  try {
    XmlSerializerUtil.copyBean(lspState, this);
    LOG.info("LSP State loaded");
    if (extToServ != null && !extToServ.isEmpty()) {
      PluginMain.setExtToServerDefinition(UserConfigurableServerDefinition$.MODULE$.fromArrayMap(extToServ));
    }
    if (timeouts != null && !timeouts.isEmpty()) {
      Timeout.setTimeouts(timeouts);
    }
    if (forcedAssociations != null && !forcedAssociations.isEmpty()) {
      PluginMain.setForcedAssociations(forcedAssociations);
    }
  } catch (final Exception e) {
    LOG.warn("Couldn't load BallerinaLSPState");
    LOG.warn(e);
    ApplicationUtils$.MODULE$.invokeLater(() -> Messages.showErrorDialog("Couldn't load LSP settings, you will need to reconfigure them.", "LSP plugin"));
  }
}

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

Messages.showErrorDialog(templatesListPanel, IgnoreBundle.message("action.importTemplates.error"));

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

@Override
public void actionPerformed(@NotNull AnActionEvent event) {
  final VirtualFileWrapper wrapper = FileChooserFactory.getInstance().createSaveFileDialog(
      new FileSaverDescriptor(
          IgnoreBundle.message("action.exportTemplates.wrapper"),
          "",
          FILE_EXTENSION
      ),
      templatesListPanel
  ).save(null, null);
  if (wrapper != null) {
    final List<IgnoreSettings.UserTemplate> items = getCurrentItems();
    final org.jdom.Document document = new org.jdom.Document(
        IgnoreSettings.createTemplatesElement(items)
    );
    try {
      JDOMUtil.writeDocument(document, wrapper.getFile(), Constants.NEWLINE);
      Messages.showInfoMessage(templatesListPanel,
          IgnoreBundle.message("action.exportTemplates.success", items.size()),
          IgnoreBundle.message("action.exportTemplates.success.title"));
    } catch (IOException e) {
      Messages.showErrorDialog(
          templatesListPanel,
          IgnoreBundle.message("action.exportTemplates.error")
      );
    }
  }
}

代码示例来源:origin: jshiell/checkstyle-idea

private void showError(final String formattedMessage) {
  Messages.showErrorDialog(this, formattedMessage, CheckStyleBundle.message("config.file.error.title"));
  commitButton.setEnabled(true);
}

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

Messages.getInformationIcon());
if (alias == null || alias.isEmpty()) {
  Messages.showErrorDialog("Alias cannot be null or empty.", "Error");
  return;

代码示例来源:origin: dboissier/mongo4idea

private void testPath() {
  try {
    testMongoPathFeedbackLabel.setIcon(null);
    if (MongoUtils.checkMongoShellPath(getShellPath())) {
      testMongoPathFeedbackLabel.setIcon(ServerConfigurationPanel.SUCCESS);
    } else {
      testMongoPathFeedbackLabel.setIcon(ServerConfigurationPanel.FAIL);
    }
  } catch (ExecutionException e) {
    Messages.showErrorDialog(mainPanel, e.getMessage(), "Error During Mongo Shell Path Checking...");
  }
}

代码示例来源:origin: dboissier/mongo4idea

public ErrorPanel(final Exception ex) {
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    setBackground(JBColor.RED);
    add(new JBLabel("Error during query execution"));
    final HoverHyperlinkLabel hoverHyperlinkLabel = new HoverHyperlinkLabel("more detail...");
    hoverHyperlinkLabel.addHyperlinkListener(hyperlinkEvent -> {
      if (hyperlinkEvent.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        Messages.showErrorDialog(ex.toString(), "Error During Query Execution");
      }
    });
    add(Box.createRigidArea(new Dimension(10, 10)));
    add(hoverHyperlinkLabel);

  }
}

代码示例来源:origin: jshiell/checkstyle-idea

/**
   * Set the configuration location.
   *
   * @param configurationLocation the location.
   */
  public void setConfigurationLocation(final ConfigurationLocation configurationLocation) {
    this.configurationLocation = (ConfigurationLocation) configurationLocation.clone();

    // get latest properties from file
    InputStream configInputStream = null;
    try {
      configInputStream = configurationLocation.resolve(checkstyleProjectService.underlyingClassLoader());
      propertiesModel.setProperties(configurationLocation.getProperties());

    } catch (IOException e) {
      LOG.warn("Couldn't resolve properties file", e);

      Messages.showErrorDialog(project, CheckStyleBundle.message("config.file.resolve-failed", e.getMessage()),
          CheckStyleBundle.message("config.file.error.title"));

    } finally {
      if (configInputStream != null) {
        try {
          configInputStream.close();
        } catch (IOException ignored) {
        }
      }
    }
  }
}

代码示例来源:origin: dboissier/mongo4idea

private void initListeners() {
  testConnectionButton.addActionListener(actionEvent -> {
    ServerConfiguration configuration = createServerConfigurationForTesting();
    final Ref<Exception> excRef = new Ref<>();
    final ProgressManager progressManager = ProgressManager.getInstance();
    progressManager.runProcessWithProgressSynchronously(() -> {
      final ProgressIndicator progressIndicator = progressManager.getProgressIndicator();
      if (progressIndicator != null) {
        progressIndicator.setText("Connecting to Mongo server...");
      }
      try {
        mongoManager.connect(configuration);
      } catch (Exception ex) {
        excRef.set(ex);
      }
    }, "Testing Connection", true, ServerConfigurationPanel.this.project);
    if (!excRef.isNull()) {
      Messages.showErrorDialog(rootPanel, excRef.get().getMessage(), "Connection Test Failed");
    } else {
      Messages.showInfoMessage(rootPanel, "Connection test successful", "Connection Test Successful");
    }
  });
}

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

@Override
 public void run() {
  Messages.showErrorDialog(message, title);
 }
});

代码示例来源:origin: dboissier/mongo4idea

public void goToReferencedDocument() {
  DBRef selectedDBRef = resultPanel.getSelectedDBRef();
  Document referencedDocument = resultPanel.getReferencedDocument(selectedDBRef);
  if (referencedDocument == null) {
    Messages.showErrorDialog(this, "Referenced document was not found");
    return;
  }
  navigation.addNewWayPoint(
      new MongoCollection(
          selectedDBRef.getCollectionName(),
          selectedDBRef.getDatabaseName() != null
              ? new MongoDatabase(selectedDBRef.getDatabaseName(), new MongoServer(configuration))
              : navigation.getCurrentWayPoint().getCollection().getParentDatabase()
      ),
      new MongoQueryOptions().setFilter(
          new Document("_id", selectedDBRef.getId())
      ));
  executeQuery(false, navigation.getCurrentWayPoint());
}

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

private void handleError(Exception e, int numFiles) {
 String msg = "SonarLint - Error analysing " + numFiles + " changed file(s).";
 if (e.getMessage() != null) {
  msg = msg + ": " + e.getMessage();
 }
 LOGGER.info(msg, e);
 Messages.showErrorDialog(project, msg, "Error Analysing Files");
}

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

@Override
 public void setValue(VariableDescription variableDescription, String value) {
  if (StringUtil.isNotEmpty(value)) {
   if (PerlParserUtil.AMBIGUOUS_PACKAGE_PATTERN.matcher(value).matches()) {
    variableDescription.variableType = value;
   }
   else {
    Messages.showErrorDialog("Incorrect package name: " + value, "Incorrect Package Name");
   }
  }
 }
}

代码示例来源:origin: intellij-dlanguage/intellij-dlanguage

public static ActionListener createApplyPathAction(final TextAccessor textField, final String executable) {
  return e -> {
    final String path = ExecUtil.locateExecutableByGuessing(executable);
    if (path != null) {
      textField.setText(path);
    } else {
      Messages.showErrorDialog("Could not find '" + executable + "'.", "DLanguage");
    }
  };
}

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

public static void storePassword(final String key,final String value) {
 UIUtil.invokeAndWaitIfNeeded(
   (Runnable) () -> {
    try {
     PasswordSafe.getInstance().storePassword(null,PasswordManager.class,key,value);
    } catch (Exception e) {
     Messages.showErrorDialog("Cannot store password\n"+Throwables.getStackTraceAsString(e),"Error");
    }
   }
 );
}

代码示例来源: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: Microsoft/azure-devops-intellij

@Test
public void testEditWorkspaceWithProgress_Exception() throws Exception {
  when(VcsUtil.runVcsProcessWithProgress(any(VcsRunnable.class), eq(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_EDIT_MSG, workspace1.getName())), eq(true), eq(mockProject)))
      .thenThrow(new VcsException(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_EDIT_ERROR_MSG, workspace1.getName())));
  manageWorkspacesModel.editWorkspaceWithProgress(workspace1, mockRunnable);
  verifyStatic(times(1));
  Messages.showErrorDialog(eq(mockProject), eq(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_EDIT_ERROR_MSG, workspace1.getName())),
      eq(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_EDIT_ERROR_TITLE)));
}

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

@Test
public void testExecute_NullTeamProject() {
  when(mockServerContext.getTeamProjectReference()).thenReturn(null);
  when(mockActionContext.getServerContext()).thenReturn(mockServerContext);
  annotateAction.execute(mockActionContext);
  verifyStatic(times(1));
  Messages.showErrorDialog(mockProject, TfPluginBundle.message(TfPluginBundle.KEY_ACTIONS_ANNOTATE_ERROR_MSG),
      TfPluginBundle.message(TfPluginBundle.KEY_ACTIONS_ANNOTATE_ERROR_TITLE));
  verifyStatic(times(0));
  BrowserUtil.browse(any(URI.class));
}

相关文章