Example usage for com.intellij.openapi.ui MessageType ERROR

List of usage examples for com.intellij.openapi.ui MessageType ERROR

Introduction

In this page you can find the example usage for com.intellij.openapi.ui MessageType ERROR.

Prototype

MessageType ERROR

To view the source code for com.intellij.openapi.ui MessageType ERROR.

Click Source Link

Usage

From source file:SelectorChapekAction.java

License:Apache License

private void showErrorDialog(String text, AnActionEvent e) {
    StatusBar statusBar = WindowManager.getInstance()
            .getStatusBar(DataKeys.PROJECT.getData(e.getDataContext()));

    if (statusBar != null) {
        JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(text, MessageType.ERROR, null)
                .setFadeoutTime(10000).createBalloon()
                .show(RelativePoint.getCenterOf(statusBar.getComponent()), Balloon.Position.atRight);
    }/*from   w w w.  ja  v  a2  s.  c  om*/
}

From source file:ch.mjava.intellij.PluginHelper.java

License:Apache License

public static void showErrorBalloonWith(String message, DataContext dataContext) {
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(DataKeys.PROJECT.getData(dataContext));
    JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, MessageType.ERROR, null)
            .setFadeoutTime(5000).createBalloon()
            .show(RelativePoint.getCenterOf(statusBar.getComponent()), Balloon.Position.atRight);
}

From source file:com.android.tools.idea.npw.deprecated.WrapArchiveOptionsStep.java

License:Apache License

@Override
public boolean validate() {
    return !MessageType.ERROR.equals(myResult.getMessageType());
}

From source file:com.android.tools.idea.npw.importing.ModuleListModel.java

License:Apache License

@Nullable
public MessageType getStatusSeverity(ModuleToImport module) {
    ModuleValidationState state = getModuleState(module);
    switch (state) {
    case OK://from   w  w  w.j av  a  2  s  .c  o  m
    case NULL:
        return null;
    case NOT_FOUND:
    case DUPLICATE_MODULE_NAME:
    case INVALID_NAME:
        return MessageType.ERROR;
    case ALREADY_EXISTS:
        return getSelectedModules().contains(module) ? MessageType.ERROR : MessageType.WARNING;
    case REQUIRED:
        return MessageType.INFO;
    }
    throw new IllegalArgumentException(state.name());
}

From source file:com.android.tools.idea.npw.importing.ModulesTable.java

License:Apache License

public boolean canImport() {
    for (ModuleToImport moduleToImport : myListModel.getSelectedModules()) {
        if (Objects.equal(myListModel.getStatusSeverity(moduleToImport), MessageType.ERROR)) {
            return false;
        }//  ww w. j  a  v  a  2s. c  o  m
    }
    return true;
}

From source file:com.android.tools.idea.npw.ModulesListModelTest.java

License:Apache License

public void testModuleExistsSeverity() {
    ModuleToImport existing = new ModuleToImport(EXISTING_MODULE, myModule2.location, NO_DEPS);
    setModules(existing, myModule1);//from  w  w  w  . j ava 2  s .  com
    assertEquals(MessageType.WARNING, myModel.getStatusSeverity(existing));
    myModel.setSelected(existing, true);
    assertEquals(MessageType.ERROR, myModel.getStatusSeverity(existing));
}

From source file:com.android.tools.idea.wizard.ImportSourceLocationStep.java

License:Apache License

private void updateStepStatus(PathValidationResult result) {
    Object validationDetails = result.myDetails;
    PageStatus status = result.myStatus;
    Map<String, VirtualFile> selectedModules = Collections.emptyMap();
    if (!MessageType.ERROR.equals(status.severity)) {
        final Collection<ModuleToImport> modules = myModulesPanel.getSelectedModules();
        if (modules.isEmpty()) {
            status = PageStatus.NO_MODULES_SELECTED;
            validationDetails = null;/*  www  .  ja  va 2  s .  co m*/
        } else {
            selectedModules = Maps.newHashMap();
            for (ModuleToImport module : modules) {
                selectedModules.put(myModulesPanel.getModuleName(module), module.location);
            }
        }
    }
    myPageValidationResult = result;
    myState.setModulesToImport(selectedModules);
    updateStatusDisplay(status, validationDetails);
    myStatus = status;
    myUpdateListener.update();
}

From source file:com.arcbees.plugin.idea.moduletypes.CreateProjectBuilder.java

License:Apache License

@Override
public void moduleCreated(@NotNull Module module) {
    project = module.getProject();/*from  ww  w . j  ava2  s . c  om*/

    final File workingDir;
    try {
        workingDir = FileUtil.createTempDirectory("archetype", "tmp");
        workingDir.deleteOnExit();
    } catch (IOException e) {
        displayBalloon("Error generating project. 100", MessageType.ERROR);
        e.printStackTrace();
        return;
    }

    try {
        generateArchetype(project, workingDir);
    } catch (MavenInvocationException e) {
        displayBalloon("Error generating project. 101", MessageType.ERROR);
        e.printStackTrace();
    }

    importProject(project);

    displayBalloon("Finished generating project.", MessageType.INFO);
}

From source file:com.arcbees.plugin.idea.moduletypes.CreateProjectBuilder.java

License:Apache License

private void copyGeneratedFilesToProject(Project project, File workingDir) {
    ProjectConfigModel projectConfig = getProjectConfig();
    String baseDir = project.getBasePath();
    File baseDirFile = new File(baseDir);

    try {//w  w w.j  a  v a  2s  .c  om
        FileUtil.copyDir(new File(workingDir, projectConfig.getArtifactId()), baseDirFile);
    } catch (IOException e) {
        displayBalloon("Error generating project. 103", MessageType.ERROR);
        e.printStackTrace();
    }

    FileUtil.delete(workingDir);
    LocalFileSystem.getInstance().refreshWithoutFileWatcher(true);
}

From source file:com.demonwav.bukkitplugin.creator.BukkitProjectSettingsWizard.java

License:Open Source License

@Override
public boolean validate() throws ConfigurationException {
    try {/*ww  w . ja  va2s . c o m*/
        if (pluginNameField.getText().trim().isEmpty())
            throw new BukkitSetupException("empty", pluginNameField);

        if (pluginVersionField.getText().trim().isEmpty())
            throw new BukkitSetupException("empty", pluginVersionField);

        if (mainClassField.getText().trim().isEmpty())
            throw new BukkitSetupException("empty", mainClassField);

        if (!additionAuthorsField.getText().matches(pattern))
            throw new BukkitSetupException("bad", additionAuthorsField);

        if (!loadBeforeField.getText().matches(pattern))
            throw new BukkitSetupException("bad", loadBeforeField);

        if (!dependField.getText().matches(pattern))
            throw new BukkitSetupException("bad", dependField);

        if (!softDependField.getText().matches(pattern))
            throw new BukkitSetupException("bad", softDependField);
    } catch (BukkitSetupException e) {
        String message;
        switch (e.getMessage()) {
        case "empty":
            message = "<html>Please fill in all required fields</html>";
            break;
        case "bad":
            message = "<html>Please enter author and plugin names as a comma separated list</html>";
            break;
        default:
            message = "<html>Unknown Error</html>";
            break;
        }
        JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, MessageType.ERROR, null)
                .setFadeoutTime(4000).createBalloon()
                .show(RelativePoint.getSouthWestOf(e.getJ()), Balloon.Position.below);
        return false;
    }
    return true;
}