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(@NotNull Component parent, String message,
            @NotNull @Nls(capitalization = Nls.Capitalization.Title) String title, @Nullable Icon icon) 

Source Link

Usage

From source file:ariba.ideplugin.idea.GotoComponent.java

License:Apache License

/**
 * Display an error into a popup window/*  ww  w  . j  a  v a2s .  c  om*/
 *
 * @param project, current project
 * @param error,   the message to display
 */
private void showError(String error, Project project) {
    Messages.showMessageDialog(project, error, "Goto Component", Messages.getInformationIcon());
    LOG.info(error);
}

From source file:ariba.ideplugin.idea.ToggleAction.java

License:Apache License

/**
 * Display an error into a popup window//from  w  w w.j a va  2 s  . c om
 * @param project, current project
 * @param msg, the message to display
 */
private void error(Project project, String msg) {
    Messages.showMessageDialog(project, msg, "Toggle AW Information", Messages.getInformationIcon());
    LOG.info("No file is currently selected");
}

From source file:co.uk.mikedamay.MikeActionClass.java

License:Apache License

public void actionPerformed(AnActionEvent event) {
    Project project = event.getData(PlatformDataKeys.PROJECT);
    String txt = Messages.showInputDialog(project, "What is your name?", "Input your name",
            Messages.getQuestionIcon());
    Messages.showMessageDialog(project, "Hello, " + txt + "!\n I am glad to see you.", "Information",
            Messages.getInformationIcon());
}

From source file:com.antoine.ideaplugin.greenrobot.ShowUsagesAction.java

License:Apache License

static void chooseAmbiguousTargetAndPerform(@NotNull final Project project, final Editor editor,
        @NotNull PsiElementProcessor<PsiElement> processor) {
    if (editor == null) {
        Messages.showMessageDialog(project, FindBundle.message("find.no.usages.at.cursor.error"),
                CommonBundle.getErrorTitle(), Messages.getErrorIcon());
    } else {//from  w  w w .j a  v  a2 s. co m
        int offset = editor.getCaretModel().getOffset();
        boolean chosen = GotoDeclarationAction.chooseAmbiguousTarget(editor, offset, processor,
                FindBundle.message("find.usages.ambiguous.title", "crap"), null);
        if (!chosen) {
            ApplicationManager.getApplication().invokeLater(new Runnable() {
                @Override
                public void run() {
                    if (editor.isDisposed() || !editor.getComponent().isShowing())
                        return;
                    HintManager.getInstance().showErrorHint(editor,
                            FindBundle.message("find.no.usages.at.cursor.error"));
                }
            }, project.getDisposed());
        }
    }
}

From source file:com.gideon.tools.debug.state.RemoteStateState.java

License:Open Source License

@Override
public ExecutionResult execute(final Executor executor, @NotNull final ProgramRunner runner)
        throws ExecutionException {

    String serverUrl = configuration.getServerUrl();
    String classPath = configuration.getClassPath();
    boolean isDebug = configuration.isDebug();
    JavaPsiFacade facade = JavaPsiFacade.getInstance(myProject);
    PsiClass aClass = facade.findClass(classPath, GlobalSearchScope.projectScope(myProject));
    if (aClass == null) {
        String msg = String.format("class: %s not found!", classPath);
        Messages.showMessageDialog(myProject, msg, "Error", Messages.getInformationIcon());
        return null;
    }//from w w w .  jav a2 s  .  c o m
    Module module = ModuleUtil.findModuleForPsiElement(aClass);

    String moduleOutputPath = CompilerPaths.getModuleOutputPath(module, configuration.isTest());
    String filePath = classPath.replace(".", "/");
    String classFilePath = String.format("%s/%s.class", moduleOutputPath, filePath);
    File file = FileUtils.getFile(classFilePath);
    if (!file.exists()) {
        String msg = String.format("class file path: {} not exists!", classFilePath);
        Messages.showMessageDialog(myProject, msg, "Error Message", Messages.getInformationIcon());
    }
    ConsoleView consoleView = toolWindowUtil.showConsoleToolWindow(myProject, configuration.getName());
    if (isDebug) {
        String debugMsg = String.format("server url:%s\nclass path: %s\nclass file path: %s\n", serverUrl,
                classPath, classFilePath);
        consoleView.print(debugMsg, ConsoleViewContentType.SYSTEM_OUTPUT);
    }
    consoleView.print("=========== remote output ===========\n", ConsoleViewContentType.SYSTEM_OUTPUT);

    InputStream is = null;
    try {
        is = new FileInputStream(classFilePath);
        byte[] b = new byte[is.available()];
        is.read(b);
        is.close();
        String classValue = new String(b, "iso-8859-1");
        String result = HttpUtils.postRequest(serverUrl, classValue);
        consoleView.print(result, ConsoleViewContentType.SYSTEM_OUTPUT);
        consoleView.print("\n", ConsoleViewContentType.SYSTEM_OUTPUT);
    } catch (Exception e) {
        consoleView.print(e.getMessage(), ConsoleViewContentType.SYSTEM_OUTPUT);
        consoleView.print("\n", ConsoleViewContentType.SYSTEM_OUTPUT);
    }

    return null;
}

From source file:com.google.errorprone.intellij.ErrorProneIdeaCompiler.java

License:Open Source License

public boolean checkCompiler(final CompileScope scope) {
    final Module[] modules = scope.getAffectedModules();
    final Set<Sdk> checkedJdks = new HashSet<Sdk>();
    for (final Module module : modules) {
        final Sdk jdk = ModuleRootManager.getInstance(module).getSdk();
        if (jdk == null || checkedJdks.contains(jdk)) {
            continue;
        }/*from  w w  w .j  a  v a2 s  . c o m*/
        checkedJdks.add(jdk);
        final SdkTypeId sdkType = jdk.getSdkType();
        if (!(sdkType instanceof JavaSdkType)) {
            continue;
        }
        final VirtualFile homeDirectory = jdk.getHomeDirectory();
        if (homeDirectory == null) {
            //noinspection DialogTitleCapitalization
            Messages.showMessageDialog(myProject, ErrorProneIdeaBundle.jdkHomeNotFoundMessage(jdk),
                    ErrorProneIdeaBundle.compilerName(), Messages.getErrorIcon());
            return false;
        }
        final String vmExecutablePath = ((JavaSdkType) sdkType).getVMExecutablePath(jdk);
        if (vmExecutablePath == null) {
            Messages.showMessageDialog(myProject,
                    ErrorProneIdeaBundle.message("error-prone.error.vm.executable.missing", jdk.getName()),
                    ErrorProneIdeaBundle.compilerName(), Messages.getErrorIcon());
            return false;
        }
        final String toolsJarPath = ((JavaSdkType) sdkType).getToolsPath(jdk);
        if (toolsJarPath == null) {
            Messages.showMessageDialog(myProject,
                    ErrorProneIdeaBundle.message("error-prone.error.tools.jar.missing", jdk.getName()),
                    ErrorProneIdeaBundle.compilerName(), Messages.getErrorIcon());
            return false;
        }
        final String versionString = jdk.getVersionString();
        if (versionString == null) {
            Messages.showMessageDialog(myProject,
                    ErrorProneIdeaBundle.message("error-prone.error.unknown.jdk.version", jdk.getName()),
                    ErrorProneIdeaBundle.compilerName(), Messages.getErrorIcon());
            return false;
        }

        if (CompilerUtil.isOfVersion(versionString, "1.0")) {
            Messages.showMessageDialog(myProject,
                    ErrorProneIdeaBundle.message("error-prone.error.1_0_compilation.not.supported"),
                    ErrorProneIdeaBundle.compilerName(), Messages.getErrorIcon());
            return false;
        }
    }

    return true;
}

From source file:com.google.idea.blaze.base.ide.NewBlazePackageDialog.java

License:Open Source License

private void showErrorDialog(@NotNull String message) {
    String title = CommonBundle.getErrorTitle();
    Icon icon = Messages.getErrorIcon();
    Messages.showMessageDialog(component, message, title, icon);
}

From source file:com.google.idea.blaze.base.scope.scopes.ProjectCloseScope.java

License:Open Source License

private void askUserToWait() {
    String buildSystem = Blaze.buildSystemName(project);
    Messages.showMessageDialog(project,
            String.format("Please wait until %s command execution finishes", buildSystem),
            buildSystem + " Running", null);
}

From source file:com.idi.intellij.plugin.query.sqlref.action.AnnoRefCreateClassDialog.java

License:Apache License

@Override
protected void doOKAction() {
    RecentsManager.getInstance(myProject).registerRecentEntry(RECENTS_KEY, myPackageComponent.getText());
    final String packageName = getPackageName();

    final String[] errorString = new String[1];
    CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
        @Override/*  w  w w .ja  v  a  2  s  .co  m*/
        public void run() {
            try {
                final PackageWrapper targetPackage = new PackageWrapper(PsiManager.getInstance(myProject),
                        packageName);
                final MoveDestination destination = myDestinationCB.selectDirectory(targetPackage, false);
                if (destination == null)
                    return;
                myTargetDirectory = ApplicationManager.getApplication()
                        .runWriteAction(new Computable<PsiDirectory>() {
                            @Override
                            public PsiDirectory compute() {
                                return destination.getTargetDirectory(getBaseDir(packageName));
                            }
                        });
                if (myTargetDirectory == null) {
                    errorString[0] = ""; // message already reported by PackageUtil
                    return;
                }
                errorString[0] = RefactoringMessageUtil.checkCanCreateClass(myTargetDirectory, getClassName());
            } catch (IncorrectOperationException e) {
                errorString[0] = e.getMessage();
            }
        }
    }, CodeInsightBundle.message("create.directory.command"), null);

    if (errorString[0] != null) {
        if (errorString[0].length() > 0) {
            Messages.showMessageDialog(myProject, errorString[0], CommonBundle.getErrorTitle(),
                    Messages.getErrorIcon());
        }
        return;
    }
    super.doOKAction();
}

From source file:com.intellij.application.options.colors.FontOptions.java

License:Apache License

public static void showReadOnlyMessage(JComponent parent, final boolean sharedScheme) {
    if (!sharedScheme) {
        Messages.showMessageDialog(parent,
                ApplicationBundle.message("error.readonly.scheme.cannot.be.modified"),
                ApplicationBundle.message("title.cannot.modify.readonly.scheme"),
                Messages.getInformationIcon());
    } else {/*from   w  ww  .j a va  2  s  .  co  m*/
        Messages.showMessageDialog(parent, ApplicationBundle.message("error.shared.scheme.cannot.be.modified"),
                ApplicationBundle.message("title.cannot.modify.readonly.scheme"),
                Messages.getInformationIcon());
    }
}