private static void showAddingTaskErrorMessage(Project project, String message) { Messages.showErrorDialog(project, message, "Go Command Task"); } }
@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; } }
@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")); } }
Messages.showErrorDialog(templatesListPanel, IgnoreBundle.message("action.importTemplates.error"));
@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") ); } } }
private void showError(final String formattedMessage) { Messages.showErrorDialog(this, formattedMessage, CheckStyleBundle.message("config.file.error.title")); commitButton.setEnabled(true); }
Messages.getInformationIcon()); if (alias == null || alias.isEmpty()) { Messages.showErrorDialog("Alias cannot be null or empty.", "Error"); return;
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..."); } }
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); } }
/** * 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) { } } } } }
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"); } }); }
@Override public void run() { Messages.showErrorDialog(message, title); } });
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()); }
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"); }
@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"); } } } }
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"); } }; }
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"); } } ); }
@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)); }
@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))); }
@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)); }