Java Code Examples for com.intellij.openapi.ui.Messages#showInfoMessage()

The following examples show how to use com.intellij.openapi.ui.Messages#showInfoMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PatchApplier.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static void showError(final Project project, final String message, final boolean error) {
  final Application application = ApplicationManager.getApplication();
  if (application.isUnitTestMode()) {
    return;
  }
  final String title = VcsBundle.message("patch.apply.dialog.title");
  final Runnable messageShower = new Runnable() {
    @Override
    public void run() {
      if (error) {
        Messages.showErrorDialog(project, message, title);
      }
      else {
        Messages.showInfoMessage(project, message, title);
      }
    }
  };
  WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() {
    @Override
    public void run() {
      messageShower.run();
    }
  }, null, project);
}
 
Example 2
Source File: DojoSettingsConfigurable.java    From needsmoredojo with Apache License 2.0 6 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e)
{
    autoDetectDojoSources.setEnabled(false);
    VirtualFile directory = SourcesLocator.getDojoSourcesDirectory(project, false);

    if(directory == null)
    {
        Messages.showInfoMessage("Could not find any dojo sources via auto-detection", "Auto-detect Dojo Sources");
        autoDetectDojoSources.setEnabled(true);
        return;
    }

    dojoSourcesText.setText(directory.getCanonicalPath());
    dojoSourceString = directory.getCanonicalPath();
    autoDetectDojoSources.setEnabled(true);

    updateModifiedState();
}
 
Example 3
Source File: PantsUtil.java    From intellij-pants-plugin with Apache License 2.0 6 votes vote down vote up
/**
 * Determine whether a project is trigger by Pants `idea-plugin` goal by
 * looking at the "pants_idea_plugin_version" property.
 */
public static boolean isSeedPantsProject(@NotNull Project project) {
  class SeedPantsProjectKeys {
    private static final String PANTS_IDEA_PLUGIN_VERSION = "pants_idea_plugin_version";
  }

  if (isPantsProject(project)) {
    return false;
  }
  String version = PropertiesComponent.getInstance(project).getValue(SeedPantsProjectKeys.PANTS_IDEA_PLUGIN_VERSION);
  if (version == null) {
    return false;
  }
  if (versionCompare(version, PANTS_IDEA_PLUGIN_VERESION_MIN) < 0 ||
      versionCompare(version, PANTS_IDEA_PLUGIN_VERESION_MAX) > 0
  ) {
    Messages.showInfoMessage(project, PantsBundle.message("pants.idea.plugin.goal.version.unsupported"), "Version Error");
    return false;
  }
  return true;
}
 
Example 4
Source File: FrameDiffTool.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static boolean askForceOpenDiff(DiffRequest data) {
  byte[] bytes1;
  byte[] bytes2;
  try {
    bytes1 = data.getContents()[0].getBytes();
    bytes2 = data.getContents()[1].getBytes();
  }
  catch (IOException e) {
    MessagesEx.error(data.getProject(), e.getMessage()).showNow();
    return false;
  }
  String message = Arrays.equals(bytes1, bytes2)
                   ? DiffBundle.message("diff.contents.are.identical.message.text")
                   : DiffBundle.message("diff.contents.have.differences.only.in.line.separators.message.text");
  Messages.showInfoMessage(data.getProject(), message, DiffBundle.message("no.differences.dialog.title"));
  return false;
  //return Messages.showDialog(data.getProject(), message + "\nShow diff anyway?", "No Differences", new String[]{"Yes", "No"}, 1,
  //                    Messages.getQuestionIcon()) == 0;
}
 
Example 5
Source File: NoSqlConfigurable.java    From nosql4idea with Apache License 2.0 6 votes vote down vote up
private void testPath(final DatabaseVendor databaseVendor) {
    ProcessOutput processOutput;
    try {
        processOutput = ProgressManager.getInstance().runProcessWithProgressSynchronously(new ThrowableComputable<ProcessOutput, Exception>() {
            @Override
            public ProcessOutput compute() throws Exception {
                return checkShellPath(databaseVendor, getShellPath());
            }
        }, "Testing " + databaseVendor.name + " CLI Executable...", true, NoSqlConfigurable.this.project);
    } catch (ProcessCanceledException pce) {
        return;
    } catch (Exception e) {
        Messages.showErrorDialog(mainPanel, e.getMessage(), "Something wrong happened");
        return;
    }
    if (processOutput != null && processOutput.getExitCode() == 0) {
        Messages.showInfoMessage(mainPanel, processOutput.getStdout(), databaseVendor.name + " CLI Path Checked");
    }
}
 
Example 6
Source File: RunAnythingCommandProvider.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static void runCommand(@Nonnull VirtualFile workDirectory, @Nonnull String commandString, @Nonnull Executor executor, @Nonnull DataContext dataContext) {
  final Project project = dataContext.getData(CommonDataKeys.PROJECT);
  LOG.assertTrue(project != null);

  Collection<String> commands = RunAnythingCache.getInstance(project).getState().getCommands();
  commands.remove(commandString);
  commands.add(commandString);

  dataContext = RunAnythingCommandCustomizer.customizeContext(dataContext);

  GeneralCommandLine initialCommandLine = new GeneralCommandLine(ParametersListUtil.parse(commandString, false, true)).withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.CONSOLE).withWorkDirectory(workDirectory.getPath());

  GeneralCommandLine commandLine = RunAnythingCommandCustomizer.customizeCommandLine(dataContext, workDirectory, initialCommandLine);
  try {
    RunAnythingRunProfile runAnythingRunProfile = new RunAnythingRunProfile(Registry.is("run.anything.use.pty", false) ? new PtyCommandLine(commandLine) : commandLine, commandString);
    ExecutionEnvironmentBuilder.create(project, executor, runAnythingRunProfile).dataContext(dataContext).buildAndExecute();
  }
  catch (ExecutionException e) {
    LOG.warn(e);
    Messages.showInfoMessage(project, e.getMessage(), IdeBundle.message("run.anything.console.error.title"));
  }
}
 
Example 7
Source File: MuleSdkSelectionDialog.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
private void downloadVersionWithProgress(String version, String destinationDir) {

        Messages.showInfoMessage(contentPane, "Download Is Going to Take Some Time. Good time for a coffee.", "Mule Distribution Download");
        final Optional<MuleUrl> first = MuleUrl.getVERSIONS().stream().filter((url) -> url.getName().equals(version)).findFirst();
        final MuleUrl muleUrl = first.get();
        try {
            final ProgressManager instance = ProgressManager.getInstance();
            final File distro = instance.runProcessWithProgressSynchronously(() -> {
                final URL artifactUrl = new URL(muleUrl.getUrl());
                final File sourceFile = FileUtil.createTempFile("mule" + version, ".zip");
                if (download(instance.getProgressIndicator(), artifactUrl, sourceFile, version)) {
                    final File destDir = new File(destinationDir);
                    destDir.mkdirs();
                    ZipUtil.extract(sourceFile, destDir, null);
                    try (ZipFile zipFile = new ZipFile(sourceFile)) {
                        String rootName = zipFile.entries().nextElement().getName();
                        return new File(destDir, rootName);
                    }
                } else {
                    return null;
                }
            }, "Downloading Mule Distribution " + muleUrl.getName(), true, null);
            if (distro != null) {
                final MuleSdk muleSdk = new MuleSdk(distro.getAbsolutePath());
                MuleSdkManagerImpl.getInstance().addSdk(muleSdk);
                myTableModel.addRow(muleSdk);
                final int rowIndex = myTableModel.getRowCount() - 1;
                myInputsTable.getSelectionModel().setSelectionInterval(rowIndex, rowIndex);
                onOK();
            }
        } catch (Exception e) {
            Messages.showErrorDialog("An error occurred while trying to download " + version + ".\n" + e.getMessage(),
                    "Mule SDK Download Error");
        }

    }
 
Example 8
Source File: RollbarErrorReportSubmitter.java    From bamboo-soy with Apache License 2.0 5 votes vote down vote up
@Override
public boolean submit(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo,
    @NotNull Component parentComponent, @NotNull Consumer<SubmittedReportInfo> consumer) {
  log(events, additionalInfo);
  consumer.consume(new SubmittedReportInfo(null, null, NEW_ISSUE));
  Messages.showInfoMessage(parentComponent, DEFAULT_RESPONSE, DEFAULT_RESPONSE_TITLE);
  return true;
}
 
Example 9
Source File: PantsProjectRefreshAction.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
  Project project = e.getProject();
  if (project == null) {
    Messages.showInfoMessage("Project not found.", "Error");
    return;
  }
  PantsUtil.refreshAllProjects(project);
}
 
Example 10
Source File: PantsToBspProjectAction.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
  Project project = e.getProject();
  if (project == null) {
    Messages.showInfoMessage("Project not found.", "Error");
    return;
  }
  dependingOnBspProjectExistence(
    project,
    () -> createBspProject(project),
    linkedBspProject -> ProjectUtil.openOrImport(Paths.get(linkedBspProject), new OpenProjectTask())
  );
}
 
Example 11
Source File: PantsSdkRefreshAction.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
  Project project = e.getProject();
  if (project == null) {
    Messages.showInfoMessage("Project not found.", "Error");
    return;
  }

  ProgressManager.getInstance().run(new RefreshJdkTask(project));
}
 
Example 12
Source File: ProjectSdkAction.java    From intellij-sdk-docs with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(@NotNull final AnActionEvent event) {
  Project project = event.getProject();
  if (project != null) {
    String projectSDKName = ProjectRootManager.getInstance(project).getProjectSdkName();
    String newProjectSdkName = "New Sdk Name";
    ProjectRootManager.getInstance(project).setProjectSdkName(newProjectSdkName);
    Messages.showInfoMessage(projectSDKName + " has changed to " + newProjectSdkName, "Project Sdk Info");
  }
}
 
Example 13
Source File: CodeGenerateServiceImpl.java    From EasyCode with MIT License 5 votes vote down vote up
/**
 * 生成代码,并自动保存到对应位置,使用统一配置
 *
 * @param templates     模板
 * @param unifiedConfig 是否使用统一配置
 * @param title         是否显示提示
 */
@Override
public void generateByUnifiedConfig(Collection<Template> templates, boolean unifiedConfig, boolean title) {
    // 获取选中表信息
    TableInfo selectedTableInfo = tableInfoService.getTableInfoAndConfig(cacheDataUtils.getSelectDbTable());
    // 获取所有选中的表信息
    List<TableInfo> tableInfoList = tableInfoService.getTableInfoAndConfig(cacheDataUtils.getDbTableList());
    // 校验选中表的保存路径是否正确
    if (StringUtils.isEmpty(selectedTableInfo.getSavePath())) {
        Messages.showInfoMessage(selectedTableInfo.getObj().getName() + "表配置信息不正确,请尝试重新配置", MsgValue.TITLE_INFO);
        return;
    }
    // 将未配置的表进行配置覆盖
    tableInfoList.forEach(tableInfo -> {
        if (StringUtils.isEmpty(tableInfo.getSavePath())) {
            tableInfo.setSaveModelName(selectedTableInfo.getSaveModelName());
            tableInfo.setSavePackageName(selectedTableInfo.getSavePackageName());
            tableInfo.setSavePath(selectedTableInfo.getSavePath());
            tableInfoService.save(tableInfo);
        }
    });
    // 如果使用统一配置,直接全部覆盖
    if (unifiedConfig) {
        tableInfoList.forEach(tableInfo -> {
            tableInfo.setSaveModelName(selectedTableInfo.getSaveModelName());
            tableInfo.setSavePackageName(selectedTableInfo.getSavePackageName());
            tableInfo.setSavePath(selectedTableInfo.getSavePath());
        });
    }

    // 生成代码
    generate(templates, tableInfoList, title);
}
 
Example 14
Source File: TYPO3CMSComposerLayoutDirectoryProjectGenerator.java    From idea-php-typo3-plugin with MIT License 4 votes vote down vote up
@Override
public void generateProject(@NotNull Project project, @NotNull VirtualFile baseDir, @NotNull GithubTagInfo tag, @NotNull Module module) {
    super.generateProject(project, baseDir, tag, module);

    Messages.showInfoMessage(project, "Please update the composer dependencies to create the initial structure", "TYPO3 Project Created");
}
 
Example 15
Source File: MultipleItemAction.java    From azure-devops-intellij with MIT License 4 votes vote down vote up
protected void showSuccess(final MultipleItemActionContext context, final String title, final String successMessage) {
    Messages.showInfoMessage(context.project, successMessage, title);
}
 
Example 16
Source File: LSPServerStatusWidget.java    From lsp4intellij with Apache License 2.0 4 votes vote down vote up
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
    StringBuilder connectedFiles = new StringBuilder("Connected files :");
    wrapper.getConnectedFiles().forEach(f -> connectedFiles.append(System.lineSeparator()).append(f));
    Messages.showInfoMessage(connectedFiles.toString(), "Connected Files");
}
 
Example 17
Source File: InfoMessage.java    From svgtoandroid with MIT License 4 votes vote down vote up
public static void show(Project project,String txt) {
    Messages.showInfoMessage(project,txt,"Information");
}
 
Example 18
Source File: ServiceActionUtil.java    From idea-php-shopware-plugin with MIT License 4 votes vote down vote up
public static void buildFile(AnActionEvent event, final Project project, String templatePath, String fileName) {
    DataContext dataContext = event.getDataContext();
    IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
    if (view == null) {
        return;
    }

    PsiDirectory[] directories = view.getDirectories();
    if(directories.length == 0) {
        return;
    }

    final PsiDirectory initialBaseDir = directories[0];
    if (initialBaseDir == null) {
        return;
    }

    if(initialBaseDir.findFile(fileName) != null) {
        Messages.showInfoMessage("File exists", "Error");
        return;
    }

    String content;
    try {
        content = StreamUtil.readText(ServiceActionUtil.class.getResourceAsStream(templatePath), "UTF-8");
    } catch (IOException e) {
        e.printStackTrace();
        return;
    }

    final PsiFileFactory factory = PsiFileFactory.getInstance(project);

    final PsiFile file = factory.createFileFromText(fileName, XmlFileType.INSTANCE, content);

    ApplicationManager.getApplication().runWriteAction(() -> {
        CodeStyleManager.getInstance(project).reformat(file);
        initialBaseDir.add(file);
    });

    PsiFile psiFile = initialBaseDir.findFile(fileName);
    if(psiFile != null) {
        view.selectElement(psiFile);
    }

}
 
Example 19
Source File: TemplateEditorConfigurable.java    From code-generator with Apache License 2.0 4 votes vote down vote up
private void exportTemplate(VirtualFile virtualFile) {
    ZipFileUtils
        .writeTemplateToFile(templateSettings.getTemplateGroupMap(), virtualFile.getPath());
    Messages.showInfoMessage("Export Successful", "Success");
}
 
Example 20
Source File: ValidationTest.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
protected void doOKAction() {
  super.doOKAction();
  Messages.showInfoMessage("on OK", "Info");
}