Example usage for com.intellij.openapi.ui Messages showErrorDialog

List of usage examples for com.intellij.openapi.ui Messages showErrorDialog

Introduction

In this page you can find the example usage for com.intellij.openapi.ui Messages showErrorDialog.

Prototype

public static void showErrorDialog(@Nullable Component component, String message,
            @NotNull @Nls(capitalization = Nls.Capitalization.Title) String title) 

Source Link

Usage

From source file:manuylov.maxim.ocaml.module.OCamlSourcesPathStep.java

License:Open Source License

public boolean validate() throws ConfigurationException {
    if (!super.validate()) {
        return false;
    }/*from  w ww  .jav  a2 s .  c o  m*/

    if (myRbCreateSource.isSelected()) {
        final String sourceDirectoryPath = getSourceDirectoryPath();
        final String relativePath = myTfSourceDirectoryName.getText().trim();
        if (relativePath.length() == 0) {
            final String contentRoot = sourceDirectoryPath == null ? " "
                    : "\n\"" + FileUtil.toSystemDependentName(sourceDirectoryPath) + "\"\n";
            final String text = "Relative path to sources is empty.\nWould you like to mark the module content root"
                    + contentRoot + "as a source directory?";
            final int answer = Messages.showDialog(myTfSourceDirectoryName, text, "Mark source directory",
                    new String[] { "Mark", "Do Not Mark", CommonBundle.getCancelButtonText() }, 0,
                    Messages.getQuestionIcon());
            if (answer == 2) {
                return false; // cancel
            }
            if (answer == 1) { // don't mark
                myRbNoSource.doClick();
            }
        }
        if (sourceDirectoryPath != null) {
            final File rootDir = new File(getContentRootPath());
            final File srcDir = new File(sourceDirectoryPath);
            try {
                if (!FileUtil.isAncestor(rootDir, srcDir, false)) {
                    Messages.showErrorDialog(myTfSourceDirectoryName,
                            "Source directory should be under module content root directory",
                            CommonBundle.getErrorTitle());
                    return false;
                }
            } catch (IOException e) {
                Messages.showErrorDialog(myTfSourceDirectoryName, e.getMessage(), CommonBundle.getErrorTitle());
                return false;
            }
        }
    }
    return true;
}

From source file:org.codebrewer.idea.jetty.JettyDeploymentProvider.java

License:Apache License

public void doDeploy(final Project project, final J2EEServerInstance instance, final DeploymentModel model) {
    DeploymentStatus deploymentStatus = DeploymentStatus.NOT_DEPLOYED;

    final JettyModuleDeploymentModel moduleDeploymentModel = (JettyModuleDeploymentModel) model;
    final ArtifactPointer facet = model.getArtifactPointer();

    if (facet != null) {
        try {/*w w w .  j a v  a  2 s.  c  o  m*/
            final Document moduleDeploymentDocument = JettyUtil.getContextDeploymentDocument(project,
                    moduleDeploymentModel);
            final JettyModel jettyModel = (JettyModel) moduleDeploymentModel.getServerModel();
            final File destinationDirectory = JettyUtil
                    .getContextDeployerConfigurationDirectory(jettyModel.getScratchDirectory());
            final File facetConfigurationFile = new File(destinationDirectory,
                    facet.getArtifactName() + ".xml");
            final XMLOutputter xmlOutputter = JDOMUtil.createOutputter(System.getProperty("line.separator"));

            OutputStream out = null;

            try {
                out = new FileOutputStream(facetConfigurationFile);
                xmlOutputter.output(moduleDeploymentDocument, out);
                deploymentStatus = DeploymentStatus.DEPLOYED;
            } catch (IOException e) {
                deploymentStatus = DeploymentStatus.FAILED;
                Messages.showErrorDialog(project, e.getMessage(),
                        JettyBundle.message("message.text.error.deploying.facet", facet.getArtifactName()));
            } finally {
                if (out != null) {
                    facetConfigurationFile.deleteOnExit();

                    try {
                        out.close();
                    } catch (IOException e) {
                        // ignore
                    }
                }
            }
        } catch (JettyException e) {
            deploymentStatus = DeploymentStatus.FAILED;
            JOptionPane.showMessageDialog(null, e.getMessage(),
                    JettyBundle.message("message.text.error.deploying.facet", facet.getArtifactName()),
                    JOptionPane.ERROR_MESSAGE);
        }
    }

    setDeploymentStatus(instance, moduleDeploymentModel, deploymentStatus);
}

From source file:org.coding.git.util.CodingNetNotifications.java

License:Apache License

public static void showErrorDialog(@Nullable Project project, @NotNull String title, @NotNull String message) {
    LOG.info(title + "; " + message);
    Messages.showErrorDialog(project, message, title);
}

From source file:org.coding.git.util.CodingNetNotifications.java

License:Apache License

public static void showErrorDialog(@Nullable Project project, @NotNull String title, @NotNull Exception e) {
    LOG.warn(title, e);/*from   ww w  .java  2s .  c  o m*/
    if (isOperationCanceled(e))
        return;
    Messages.showErrorDialog(project, getErrorTextFromException(e), title);
}

From source file:org.coding.git.util.CodingNetNotifications.java

License:Apache License

public static void showErrorDialog(@NotNull Component component, @NotNull String title, @NotNull Exception e) {
    LOG.info(title, e);/*  ww w.  j  a v  a 2 s. co  m*/
    if (isOperationCanceled(e))
        return;
    Messages.showErrorDialog(component, getErrorTextFromException(e), title);
}

From source file:org.coding.git.util.CodingNetNotifications.java

License:Apache License

public static void showErrorDialog(@NotNull Component component, @NotNull String title, @NotNull String prefix,
        @NotNull Exception e) {/*  w ww.  j  a  v a 2s . c  o m*/
    LOG.info(title, e);
    if (isOperationCanceled(e))
        return;
    Messages.showErrorDialog(component, prefix + getErrorTextFromException(e), title);
}

From source file:org.codinjutsu.tools.mongo.view.MongoConfigurable.java

License:Apache License

private void testPath() {
    try {/*  ww  w.  j a  va 2s  .c om*/
        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...");
    }
}

From source file:org.codinjutsu.tools.nosql.commons.view.ServerConfigurationPanel.java

License:Apache License

private void initListeners() {
    testConnectionButton.addActionListener(new ActionListener() {
        @Override// w ww.ja va 2 s .c o  m
        public void actionPerformed(ActionEvent actionEvent) {

            final Ref<Exception> excRef = new Ref<>();
            final ProgressManager progressManager = ProgressManager.getInstance();
            progressManager.runProcessWithProgressSynchronously(new Runnable() {
                @Override
                public void run() {
                    ServerConfiguration configuration = createServerConfigurationForTesting();

                    final ProgressIndicator progressIndicator = progressManager.getProgressIndicator();
                    if (progressIndicator != null) {
                        progressIndicator.setText("Connecting to " + configuration.getServerUrl());
                    }
                    try {
                        databaseClient.connect(configuration);
                    } catch (Exception ex) {
                        excRef.set(ex);
                    }
                }

            }, "Testing connection for " + databaseVendor.name, true, ServerConfigurationPanel.this.project);

            if (!excRef.isNull()) {
                Messages.showErrorDialog(rootPanel, excRef.get().getMessage(), "Connection test failed");
            } else {
                Messages.showInfoMessage(rootPanel, "Connection test successful for " + databaseVendor.name,
                        "Connection test successful");
            }
        }
    });
}

From source file:org.community.intellij.plugins.communitycase.actions.AbstractRebaseResumeAction.java

License:Apache License

/**
 * {@inheritDoc}//w  w w . j  a  va  2 s  .c o m
 */
protected LineHandler createHandler(Project project, List<VirtualFile> Roots, VirtualFile defaultRoot) {
    for (Iterator<VirtualFile> i = Roots.iterator(); i.hasNext();) {
        if (!RebaseUtils.isRebaseInTheProgress(i.next())) {
            i.remove();
        }
    }
    if (Roots.size() == 0) {
        Messages.showErrorDialog(project, Bundle.getString("rebase.action.no.root"),
                Bundle.getString("rebase.action.error"));
        return null;
    }
    final VirtualFile root;
    if (Roots.size() == 1) {
        root = Roots.get(0);
    } else {
        if (!Roots.contains(defaultRoot)) {
            defaultRoot = Roots.get(0);
        }
        RebaseActionDialog d = new RebaseActionDialog(project, getActionTitle(), Roots, defaultRoot);
        root = d.selectRoot();
        if (root == null) {
            return null;
        }
    }
    LineHandler h = new LineHandler(project, root, Command.REBASE);
    h.addParameters(getOptionName());
    return h;
}

From source file:org.community.intellij.plugins.communitycase.actions.RebaseAbort.java

License:Apache License

/**
 * {@inheritDoc}/*from www.ja va2  s .  co  m*/
 */
protected void perform(@NotNull Project project, @NotNull List<VirtualFile> Roots,
        @NotNull VirtualFile defaultRoot, Set<VirtualFile> affectedRoots, List<VcsException> exceptions)
        throws VcsException {
    // remote all roots where there are no rebase in progress
    for (Iterator<VirtualFile> i = Roots.iterator(); i.hasNext();) {
        if (!RebaseUtils.isRebaseInTheProgress(i.next())) {
            i.remove();
        }
    }
    if (Roots.size() == 0) {
        Messages.showErrorDialog(project, Bundle.getString("rebase.action.no.root"),
                Bundle.getString("rebase.action.error"));
        return;
    }
    final VirtualFile root;
    if (Roots.size() == 1) {
        root = Roots.get(0);
    } else {
        if (!Roots.contains(defaultRoot)) {
            defaultRoot = Roots.get(0);
        }
        RebaseActionDialog d = new RebaseActionDialog(project, getActionName(), Roots, defaultRoot);
        root = d.selectRoot();
        if (root == null) {
            return;
        }
    }
    affectedRoots.add(root);
    SimpleHandler h = new SimpleHandler(project, root, Command.REBASE);
    h.addParameters("--abort");
    HandlerUtil.doSynchronously(h, getActionName(), h.printableCommandLine());
}