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

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

Introduction

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

Prototype

public static void showMessageDialog(String message,
        @NotNull @Nls(capitalization = Nls.Capitalization.Title) String title, @Nullable Icon icon) 

Source Link

Document

Use this method only if you do not know project or component

Usage

From source file:com.intellij.uiDesigner.propertyInspector.PropertyInspectorTable.java

License:Apache License

private static void showInvalidInput(final Exception exc) {
    final Throwable cause = exc.getCause();
    String message;//from  w w w  .  j  a  v  a2 s  .  c o m
    if (cause != null) {
        message = cause.getMessage();
    } else {
        message = exc.getMessage();
    }
    if (message == null || message.length() == 0) {
        message = UIDesignerBundle.message("error.no.message");
    }
    Messages.showMessageDialog(UIDesignerBundle.message("error.setting.value", message),
            UIDesignerBundle.message("title.invalid.input"), Messages.getErrorIcon());
}

From source file:com.intellij.uiDesigner.propertyInspector.PropertyInspectorTable.java

License:Apache License

private static boolean setPropValue(final Property property, final RadComponent c, final Object newValue) {
    try {//from  w w w. j a v  a  2  s. c o  m
        //noinspection unchecked
        property.setValue(c, newValue);
    } catch (Throwable e) {
        LOG.debug(e);
        if (e instanceof InvocationTargetException) { // special handling of warapped exceptions
            e = ((InvocationTargetException) e).getTargetException();
        }
        Messages.showMessageDialog(e.getMessage(), UIDesignerBundle.message("title.invalid.input"),
                Messages.getErrorIcon());
        return false;
    }
    return true;
}

From source file:com.intellij.uiDesigner.snapShooter.SnapShotTreeModel.java

License:Apache License

private static void reportDisconnection(final SnapShotClient client) {
    Messages.showMessageDialog("Disconnected from remote application", "Create Form Snapshot",
            Messages.getErrorIcon());/*  w ww . j a  v  a  2  s.  c  o m*/
    client.setDisconnected();
}

From source file:com.mediaworx.intellij.opencmsplugin.sync.OpenCmsSyncer.java

License:Open Source License

/**
 * Analyzes the given file list using the {@link SyncFileAnalyzer} and triggers the sync to/from OpenCms using
 * the {@link SyncJob}//w ww . jav  a2 s .c o  m
 * @param syncFiles list of local files (and folders) that are used as starting point for the sync
 */
public void syncFiles(List<File> syncFiles) {

    SyncFileAnalyzer analyzer;

    try {
        analyzer = new SyncFileAnalyzer(plugin, syncFiles, pullMetaDataOnly);
    } catch (CmsConnectionException e) {
        Messages.showDialog(e.getMessage(), "Error", new String[] { "Ok" }, 0, Messages.getErrorIcon());
        return;
    }

    ProgressManager.getInstance().runProcessWithProgressSynchronously(analyzer,
            "Analyzing local and VFS syncFiles and folders ...", true, plugin.getProject());

    if (!analyzer.isExecuteSync()) {
        return;
    }

    int numSyncEntities = analyzer.getSyncList().size();

    boolean proceed = numSyncEntities > 0;
    LOG.info("proceed? " + proceed);

    StringBuilder message = new StringBuilder();
    if (analyzer.hasWarnings()) {
        message.append("Infos/Warnings during file analysis:\n").append(analyzer.getWarnings().append("\n"));
    }
    if (proceed) {
        SyncJob syncJob = new SyncJob(plugin, analyzer.getSyncList());
        if (showConfirmDialog && !pullMetaDataOnly
                && ((numSyncEntities == 1 && message.length() > 0) || numSyncEntities > 1)) {
            assembleConfirmMessage(message, syncJob.getSyncList());
            int dlgStatus = Messages.showOkCancelDialog(plugin.getProject(), message.toString(),
                    "Start OpenCms VFS Sync?", Messages.getQuestionIcon());
            proceed = dlgStatus == 0;
        }
        if (proceed) {
            plugin.showConsole();
            new Thread(syncJob).start();
        }
    } else {
        message.append("Nothing to sync");
        Messages.showMessageDialog(message.toString(), "OpenCms VFS Sync", Messages.getInformationIcon());
    }
}

From source file:com.srmvision.tools.wicketdebug.idea.ApplicationComponent.WicketDebugEntryPoint.java

License:Apache License

void runWebServer() {
    final int port = PluginProperties.getPort();
    try {//  w w  w.  ja  va 2 s. c  o m
        InetSocketAddress addr = new InetSocketAddress(port);
        server = HttpServer.create(addr, 0);

        server.createContext("/", new IDEAHttpHandler());
        server.setExecutor(Executors.newCachedThreadPool());
        server.start();
    } catch (IOException e) {
        ApplicationManager.getApplication().invokeLater(new Runnable() {
            public void run() {
                Messages.showMessageDialog(
                        "Wicket Open In IDEA : unable to start webserver on port " + port
                                + ", please check plugin configuration.",
                        "Plugin Error", Messages.getErrorIcon());
            }
        });
    }
}

From source file:intellijeval.toolwindow.NewFileAction.java

License:Apache License

private static void createNewFile(FileSystemTree fileSystemTree, final FileType fileType,
        final String initialContent) {
    final VirtualFile file = fileSystemTree.getNewFileParent();
    if (file == null || !file.isDirectory())
        return;//  w w  w. j  a v  a 2 s  . c om

    String newFileName;
    while (true) {
        newFileName = Messages.showInputDialog(
                UIBundle.message("create.new.file.enter.new.file.name.prompt.text"),
                UIBundle.message("new.file.dialog.title"), Messages.getQuestionIcon());
        if (newFileName == null) {
            return;
        }
        if ("".equals(newFileName.trim())) {
            Messages.showMessageDialog(
                    UIBundle.message("create.new.file.file.name.cannot.be.empty.error.message"),
                    UIBundle.message("error.dialog.title"), Messages.getErrorIcon());
            continue;
        }
        Exception failReason = ((FileSystemTreeImpl) fileSystemTree).createNewFile(file, newFileName, fileType,
                initialContent);
        if (failReason != null) {
            Messages.showMessageDialog(
                    UIBundle.message("create.new.file.could.not.create.file.error.message", newFileName),
                    UIBundle.message("error.dialog.title"), Messages.getErrorIcon());
            continue;
        }
        return;
    }
}

From source file:io.ballerina.plugins.idea.webview.diagram.preview.HtmlPanelProvider.java

License:Open Source License

@NotNull
static HtmlPanelProvider createFromInfo(@NotNull ProviderInfo providerInfo) {
    try {/*ww w . j  av  a2  s .co m*/
        return ((HtmlPanelProvider) Class.forName(providerInfo.getClassName()).newInstance());
    } catch (Exception e) {
        Messages.showMessageDialog(
                "Cannot set preview panel provider (" + providerInfo.getName() + "):\n" + e.getMessage(),
                CommonBundle.getErrorTitle(), Messages.getErrorIcon());
        Logger.getInstance(HtmlPanelProvider.class).error(e);
        return getProviders()[0];
    }
}

From source file:jetbrains.communicator.idea.IDEAFacade.java

License:Apache License

@Override
public void showMessage(String title, String message) {
    Messages.showMessageDialog(message, title, Messages.getInformationIcon());
}

From source file:liveplugin.toolwindow.CreateRootFileAction.java

License:Apache License

@Override
protected void actionPerformed(FileSystemTree fileSystemTree, AnActionEvent e) {
    VirtualFile parentFile = fileSystemTree.getNewFileParent();

    //noinspection ThrowableResultOfMethodCallIgnored
    Exception failReason = ((FileSystemTreeImpl) fileSystemTree).createNewFile(parentFile, newFileName,
            fileType, fileContent);//w w w.j a  v  a 2  s. co  m
    if (failReason != null) {
        String message = UIBundle.message("create.new.file.could.not.create.file.error.message", newFileName);
        String title = UIBundle.message("error.dialog.title");
        Messages.showMessageDialog(message, title, Messages.getErrorIcon());
    }
}

From source file:myActions.HelloWorldAction.java

License:Apache License

public void actionPerformed(AnActionEvent event) {
    // Project project = event.getData(PlatformDataKeys.PROJECT);
    Messages.showMessageDialog("Hello World!", "Information", Messages.getInformationIcon());
}