Java 类com.intellij.openapi.ui.Messages 实例源码

项目:Dependency-Injection-Graph    文件:SetPackageFilter.java   
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
    Project project = anActionEvent.getProject();

    if (project != null) {

        String packageName = Messages.showInputDialog(
                Strings.MESSAGE_ASK_PACKAGE_NAME_TO_FILTER,
                Strings.TITLE_ASK_PACKAGE_NAME_TO_FILTER,
                Messages.getQuestionIcon(),
                PropertiesManager.getData(project, PropertyKeys.PACKAGE_NAME),
                new NonEmptyInputValidator());

        if (!TextUtils.isEmpty(packageName)) {
            PropertiesManager.putData(project, PropertyKeys.PACKAGE_NAME, packageName);
        }
    }
}
项目:CodeGenerate    文件:TemplateEditPane.java   
public TemplateEditPane(CodeMakerSettings settings, String template,
                        CodeMakerConfiguration parentPane) {
    CodeTemplate codeTemplate = settings.getCodeTemplate(template);
    if (codeTemplate == null) {
        codeTemplate = CodeTemplate.EMPTY_TEMPLATE;
    }

    templateNameText.setText(codeTemplate.getName());
    classNumberText.setText(String.valueOf(codeTemplate.getClassNumber()));
    classNameText.setText(codeTemplate.getClassNameVm());
    addVmEditor(codeTemplate.getCodeTemplate());
    deleteTemplateButton.addActionListener(e -> {
        int result = Messages.showYesNoDialog("删除模板?", "删除", null);
        if (result == Messages.OK) {
            settings.removeCodeTemplate(template);
            parentPane.refresh(settings);
        }
    });
}
项目:idea-sourcetrail    文件:Ping.java   
public static void send()
{
    SourcetrailOptions options = SourcetrailOptions.getInstance();
    try
    {
        String text = "ping>>" + ApplicationNamesInfo.getInstance().getFullProductName() + "<EOM>";
        Socket socket = new Socket(options.getIp(), options.getSourcetrailPort());
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
        writer.write(text);
        writer.flush();
        socket.close();
    }
    catch(Exception e)
    {
        String errorMsg =
                "No connection to a Sourcetrail instance\n\n Make sure Sourcetrail is running and the right address is used("
                        + options.getIp() + ":" + options.getSourcetrailPort() + ")";
        Messages.showMessageDialog(errorMsg, "SourcetrailPluginError", Messages.getErrorIcon());
        e.printStackTrace();

    }

}
项目:idea-php-typo3-plugin    文件:NewExtensionFileAction.java   
@Override
public void actionPerformed(@NotNull AnActionEvent event) {

    final Project project = getEventProject(event);
    if (project == null) {
        this.setStatus(event, false);
        return;
    }

    PsiDirectory bundleDirContext = ExtensionUtility.getExtensionDirectory(event);
    if (bundleDirContext == null) {
        return;
    }

    String className = Messages.showInputDialog(project, "New class name:", "New File", TYPO3CMSIcons.TYPO3_ICON);
    if (StringUtils.isBlank(className)) {
        return;
    }

    if (!PhpNameUtil.isValidClassName(className)) {
        JOptionPane.showMessageDialog(null, "Invalid class name");
        return;
    }

    write(project, bundleDirContext, className);
}
项目:watchMe    文件:SlackSettings.java   
public void actionPerformed(AnActionEvent e) {
    this.project = e.getData(CommonDataKeys.PROJECT);

    String description = this.showInputDialog(SlackChannel.getIdDescription(), null);

    if (!isValidField(description)) {
        errorMessage();
        return;
    }

    String token = this.showInputDialog(SlackChannel.getTokenDescription(), null);

    if (!isValidField(token)) {
        errorMessage();
        return;
    }

    String channel = this.showInputDialog(SlackChannel.getChanneNameDescription(), "");

    SlackStorage.getInstance().registerChannel(new SlackChannel(token, description, channel));
    Messages.showMessageDialog(this.project, "Settings Saved.", "Information", Messages.getInformationIcon());
}
项目:watchMe    文件:SlackSettings.java   
@Override
public void actionPerformed(AnActionEvent e) {
    final Project project = e.getData(CommonDataKeys.PROJECT);

    List<String> channelsId = SlackStorage.getInstance().getChannelsId();

    if (channelsId.size() > 0) {
        String channelToRemove = Messages.showEditableChooseDialog(
                "Select the channel to remove",
                SlackChannel.getSettingsDescription(),
                SlackStorage.getSlackIcon(),
                channelsId.toArray(new String[channelsId.size()]),
                channelsId.get(0),
                null
        );

        if (channelsId.contains(channelToRemove)) {
            SlackStorage.getInstance().removeChannelByDescription(channelToRemove);
            Messages.showMessageDialog(project, "Channel \"" + channelToRemove + "\" removed.", "Information", Messages.getInformationIcon());
        }
    }
}
项目:AndroidSourceViewer    文件:CleanAction.java   
@Override
public void actionPerformed(AnActionEvent e) {
    cacheFile = new File(Constant.CACHE_PATH);
    if (!cacheFile.exists()) {
        cacheFile.mkdirs();
    }
    long size = FileUtils.sizeOfDirectory(cacheFile);
    DialogBuilder builder = new DialogBuilder();
    builder.setTitle(Constant.TITLE);
    builder.resizable(false);
    builder.setCenterPanel(new JLabel(String.format("Currently occupy storage %.2fM, "
            + "Clean Cache immediately?", size/1024.0/1024.0),
            Messages.getInformationIcon(), SwingConstants.CENTER));
    builder.addOkAction().setText("Clean Now");
    builder.addCancelAction().setText("Cancel");
    builder.setButtonsAlignment(SwingConstants.RIGHT);
    if (builder.show() == 0) {
        clean();
    }
}
项目:hybris-integration-intellij-idea-plugin    文件:DirectoriesScannerErrorsProcessor.java   
@Override
public boolean shouldContinue(final List<File> t) {
    if (!t.isEmpty()) {
        ApplicationManager.getApplication().invokeLater(new Runnable() {

            @Override
            public void run() {
                Messages.showErrorDialog(
                    HybrisI18NBundleUtils.message("hybris.project.import.scan.failed", t),
                    HybrisI18NBundleUtils.message("hybris.project.error")
                );
            }
        });
    }

    return false;
}
项目:hybris-integration-intellij-idea-plugin    文件:ProjectRefreshAction.java   
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
    final Project project = getEventProject(anActionEvent);

    if (project == null) {
        return;
    }
    removeOldProjectData(project);

    try {
        collectStatistics();
        final AddModuleWizard wizard = getWizard(project);
        final ProjectBuilder projectBuilder = wizard.getProjectBuilder();

        if (projectBuilder instanceof AbstractHybrisProjectImportBuilder) {
            ((AbstractHybrisProjectImportBuilder) projectBuilder).setRefresh(true);
        }
        projectBuilder.commit(project, null, ModulesProvider.EMPTY_MODULES_PROVIDER);
    } catch (ConfigurationException e) {
        Messages.showErrorDialog(
            anActionEvent.getProject(),
            e.getMessage(),
            HybrisI18NBundleUtils.message("hybris.project.import.error.unable.to.proceed")
        );
    }
}
项目:educational-plugin    文件:StudyProjectGenerator.java   
public void generateProject(@NotNull final Project project, @NotNull final VirtualFile baseDir) {
  final Course course = getCourse(project);
  if (course == null) {
    LOG.warn("Course is null");
    Messages.showWarningDialog("Some problems occurred while creating the course", "Error in Course Creation");
    return;
  }
  else if (course.isAdaptive() && !StudyUtils.isCourseValid(course)) {
    Messages.showWarningDialog("There is no recommended tasks for this adaptive course", "Error in Course Creation");
    return;
  }
  StudyTaskManager.getInstance(project).setCourse(course);
  ApplicationManager.getApplication().runWriteAction(() -> {
    StudyGenerator.createCourse(course, baseDir);
    StudyUtils.registerStudyToolWindow(course, project);
    StudyUtils.openFirstTask(course, project);
    EduUsagesCollector.projectTypeCreated(course.isAdaptive() ? EduNames.ADAPTIVE : EduNames.STUDY);
  });
}
项目:educational-plugin    文件:CCFromCourseArchive.java   
private static void unpackCourseArchive(final Project project) {
  FileChooserDescriptor descriptor =
    new FileChooserDescriptor(true, true, true, true, true, false);

  final VirtualFile virtualFile = FileChooser.chooseFile(descriptor, project, null);
  if (virtualFile == null) {
    return;
  }
  final String basePath = project.getBasePath();
  if (basePath == null) return;

  Course course = StudyProjectGenerator.getCourse(virtualFile.getPath());
  if (course == null) {
    Messages.showErrorDialog("This course is incompatible with current version", "Failed to Unpack Course");
    return;
  }
  generateFromStudentCourse(project, course);
}
项目:educational-plugin    文件:CCGetCourseFromStepic.java   
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
  final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
  final Project project = e.getData(CommonDataKeys.PROJECT);
  if (view == null || project == null) {
    return;
  }
  final String courseId = Messages.showInputDialog("Please, enter course id", "Get Course From Stepik", null);
  if (StringUtil.isNotEmpty(courseId)) {
    ProgressManager.getInstance().run(new Task.Modal(project, "Creating Course", true) {
      @Override
      public void run(@NotNull final ProgressIndicator indicator) {
        createCourse(project, courseId);
      }
    });
  }
}
项目:educational-plugin    文件:CCCreateCourseArchive.java   
private static void packCourse(@NotNull final VirtualFile baseDir, String locationDir, String zipName, boolean showMessage) {
  try {
    final File zipFile = new File(locationDir, zipName + ".zip");
    ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile)));
    VirtualFile[] courseFiles = baseDir.getChildren();
    for (VirtualFile file : courseFiles) {
      ZipUtil.addFileOrDirRecursively(zos, null, new File(file.getPath()), file.getName(), null, null);
    }
    zos.close();
    if (showMessage) {
      ApplicationManager.getApplication().invokeLater(
        () -> Messages.showInfoMessage("Course archive was saved to " + zipFile.getPath(),
                                       "Course Archive Was Created Successfully"));

    }
  }
  catch (IOException e1) {
    LOG.error(e1);
  }
}
项目:educational-plugin    文件:CCCreateCourseArchive.java   
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
private static void generateJson(VirtualFile parentDir, Course course) {
  final Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().
    registerTypeAdapter(Task.class, new StudySerializationUtils.Json.TaskAdapter()).create();
  final String json = gson.toJson(course);
  final File courseJson = new File(parentDir.getPath(), EduNames.COURSE_META_FILE);
  OutputStreamWriter outputStreamWriter = null;
  try {
    outputStreamWriter = new OutputStreamWriter(new FileOutputStream(courseJson), "UTF-8");
    outputStreamWriter.write(json);
  }
  catch (Exception e) {
    Messages.showErrorDialog(e.getMessage(), "Failed to Generate Json");
    LOG.info(e);
  }
  finally {
    try {
      if (outputStreamWriter != null) {
        outputStreamWriter.close();
      }
    }
    catch (IOException e1) {
      //close silently
    }
  }
}
项目:Gradle-External-Library-Helper    文件:SearchAction.java   
private void doSearch(String keyword, AnActionEvent actionEvent) {
    getRepositories(keyword)
            .thenAcceptAsync(mavenSearchResponse -> {
                        SwingUtilities.invokeLater(() -> {
                            if (!mavenSearchResponse.getBody().getNumFound().equals("0")) {
                                SelectFromListDialog dialog = initSelectFromListDialog(actionEvent.getProject(), Strings.TITLE_SELECT_REPOSITORY, ArrayHelper.docListToStringArray(mavenSearchResponse.getBody().getDocList()), toStringAspect);
                                boolean isOk = dialog.showAndGet();
                                if (isOk) {
                                    gradleManager.addDependency(String.valueOf(dialog.getSelection()[0]), actionEvent);
                                }
                            } else if (mavenSearchResponse.getSpellcheck().getSuggestion().size() > 0) {
                                Messages.showInfoMessage(Strings.MESSAGE_SUGGESTIONS + String.join(",", ArrayHelper.objectListToStringArray(mavenSearchResponse.getSpellcheck().getSuggestion())), Strings.TITLE_NOT_FOUND);
                            } else {
                                Messages.showInfoMessage("", Strings.TITLE_NOT_FOUND);
                            }
                        });
                    }
            ).exceptionally(throwable -> {
        SwingUtilities.invokeLater(() -> {
            Messages.showInfoMessage(throwable.getMessage(), Strings.ERROR_TITLE_MAVEN_SEARCH);
        });

        return null;
    });
}
项目:CodeGen    文件:PsiUtil.java   
public static PsiDirectory createDirectory(Project project, String title, String description) {
    final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    descriptor.setTitle(title);
    descriptor.setShowFileSystemRoots(false);
    descriptor.setDescription(description);
    descriptor.setHideIgnored(true);
    descriptor.setRoots(project.getBaseDir());
    descriptor.setForcedToUseIdeaFileChooser(true);
    VirtualFile file = FileChooser.chooseFile(descriptor, project, project.getBaseDir());
    if(Objects.isNull(file)){
        Messages.showInfoMessage("Cancel " + title, "Error");
        return null;
    }

    PsiDirectory psiDirectory = PsiDirectoryFactory.getInstance(project).createDirectory(file);
    if(PsiDirectoryFactory.getInstance(project).isPackage(psiDirectory)){
        return psiDirectory;
    }else {
        Messages.showInfoMessage("请选择正确的 package 路径。", "Error");
        return createDirectory(project, title, description);
    }
}
项目:Dependency-Injection-Graph    文件:SmaliAnalyzer.java   
public boolean run() {
    String filter = arguments.getFilter();
    if (filter == null) {
        System.err.println("Please check your filter!");
        return false;
    }

    String replacement = Matcher.quoteReplacement(File.separator);
    String searchString = Pattern.quote(".");
    filterAsPath = filter.replaceAll(searchString, replacement);
    File projectFolder = getProjectFolder();
    if (projectFolder.exists()) {
        traverseSmaliCode(projectFolder);
        return true;
    } else if (isInstantRunEnabled()) {
        System.err.println("Enabled Instant Run feature detected. We cannot decompile it. Please, disable Instant Run and rebuild your app.");
        Messages.showInfoMessage(Strings.ERROR_INSTANT_RUN_ENABLED, Strings.TITLE_ERROR_INSTANT_RUN_ENABLED);
    } else {
        System.err.println("Smali folder cannot be absent!");
    }
    return false;
}
项目:KotlinMvp    文件:AndroidMvpAction.java   
@Override
public void actionPerformed(AnActionEvent e) {
    project = e.getProject();
    selectGroup = DataKeys.VIRTUAL_FILE.getData(e.getDataContext());
    String className = Messages.showInputDialog(project, "请输入类名称", "NewMvpGroup", Messages.getQuestionIcon());
    if (className == null || className.equals("")) {
        System.out.print("没有输入类名");
        return;
    }
    if (className.equals("base") || className.equals("BASE") || className.equals("Base")) {
        createMvpBase();
    } else {
        createClassMvp(className);
    }
    project.getBaseDir().refresh(false, true);
}
项目:intellij-ce-playground    文件:ChangeBoundFieldTypeFix.java   
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
  CommandProcessor.getInstance().executeCommand(myField.getProject(), new Runnable() {
    public void run() {
      try {
        final PsiManager manager = myField.getManager();
        myField.getTypeElement().replace(JavaPsiFacade.getInstance(manager.getProject()).getElementFactory().createTypeElement(myTypeToSet));
      }
      catch (final IncorrectOperationException e) {
        ApplicationManager.getApplication().invokeLater(new Runnable(){
          public void run() {
            Messages.showErrorDialog(myField.getProject(),
                                     QuickFixBundle.message("cannot.change.field.exception", myField.getName(), e.getLocalizedMessage()),
                                     CommonBundle.getErrorTitle());
          }
        });
      }
    }
  }, getText(), null);
}
项目:intellij-ce-playground    文件:PydevConsoleRunner.java   
@Override
public void setSelected(AnActionEvent e, boolean state) {
  mySelected = state;

  if (mySelected) {
    try {
      mySession = connectToDebugger();
    }
    catch (Exception e1) {
      LOG.error(e1);
      Messages.showErrorDialog("Can't connect to debugger", "Error Connecting Debugger");
    }
  }
  else {
    //TODO: disable debugging
  }
}
项目:intellij-ce-playground    文件:InstallPluginAction.java   
private boolean userConfirm(IdeaPluginDescriptor[] selection) {
  String message;
  if (selection.length == 1) {
    if (selection[0] instanceof IdeaPluginDescriptorImpl) {
      message = IdeBundle.message("prompt.update.plugin", selection[0].getName());
    }
    else {
      message = IdeBundle.message("prompt.download.and.install.plugin", selection[0].getName());
    }
  }
  else {
    message = IdeBundle.message("prompt.install.several.plugins", selection.length);
  }

  return Messages.showYesNoDialog(myHost.getMainPanel(), message, IdeBundle.message("action.download.and.install.plugin"), Messages.getQuestionIcon()) == Messages.YES;
}
项目:intellij-ce-playground    文件:AndroidImportProjectAction.java   
private static void importAdtProject(@NotNull VirtualFile file) {
  AdtImportProvider adtImportProvider = new AdtImportProvider(true);
  AddModuleWizard wizard = new AddModuleWizard(null, ProjectImportProvider.getDefaultPath(file), adtImportProvider);
  if (wizard.showAndGet()) {
    try {
      doCreate(wizard);
    }
    catch (final IOException e) {
      invokeLaterIfNeeded(new Runnable() {
        @Override
        public void run() {
          Messages.showErrorDialog(e.getMessage(), "Project Initialization Failed");
        }
      });
    }
  }
}
项目:PackageTemplates    文件:CreateDirectoryAction.java   
private boolean onAsk(PsiDirectory psiDuplicate) {
    int dialogAnswerCode = Messages.showYesNoDialog(project,
            String.format(Localizer.get("warning.ArgDirectoryAlreadyExists"), psiDuplicate.getName()),
            Localizer.get("title.WriteConflict"),
            Localizer.get("action.Overwrite"),
            Localizer.get("action.UseExisting"),
            Messages.getQuestionIcon(),
            new NeverShowAskCheckBox()
    );
    if (dialogAnswerCode == Messages.OK) {
        if (!onOverwrite(psiDuplicate)) {
            return false;
        }
    } else {
        if (!onUseExisting(psiDuplicate)) {
            return false;
        }
    }
    return true;
}
项目:intellij-ce-playground    文件:ConfigureAvdOptionsStep.java   
@Override
public boolean commitStep() {
  if (!myState.containsKey(DISPLAY_USE_EXTERNAL_SD_KEY) || !myState.get(DISPLAY_USE_EXTERNAL_SD_KEY)) {
    Storage orig = myState.get(SD_CARD_STORAGE_KEY);
    Storage current = myState.get(DISPLAY_SD_SIZE_KEY);
    if (orig != null && !orig.equals(current)) {
      int result = Messages.showYesNoDialog((Project)null, "Changing the size of the built-in SD card will erase " +
                                                           "the current contents of the card. Continue?",
                                            "Confirm Data Wipe", AllIcons.General.QuestionDialog);
      if (result != Messages.YES) {
        return false;
      }
    }
  }
  File displayFile = myState.get(DISPLAY_SKIN_FILE_KEY);
  boolean hasFrame = myState.getNotNull(DEVICE_FRAME_KEY, false);
  myState.put(CUSTOM_SKIN_FILE_KEY,  hasFrame ? displayFile : NO_SKIN);
  myState.put(BACKUP_SKIN_FILE_KEY, hasFrame ? null : displayFile);

  return super.commitStep();
}
项目:intellij-ce-playground    文件:TextFieldWithLaunchBrowserButton.java   
public TextFieldWithLaunchBrowserButton(String url) {
  myUrl = url;
  addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      try {
        if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
          Desktop.getDesktop().browse(URI.create(myUrl));
        } else {
          Messages.showErrorDialog("Please visit \n" + myUrl + "\n to retrieve this value", "Could Not Open Web Browser");
        }
      }
      catch (IOException error) {
        LOG.error(error);
      }
    }
  });
}
项目:intellij-ce-playground    文件:RenameProjectAction.java   
@Override
public void actionPerformed(AnActionEvent e) {
  final DataContext dataContext = e.getDataContext();
  final Project project = CommonDataKeys.PROJECT.getData(dataContext);
  LOG.assertTrue(project instanceof ProjectEx);
  Module module;
  Module[] modules = ModuleManager.getInstance(project).getModules();
  if (modules.length == 1 && project.getName().equals(modules[0].getName())) {
    module = modules[0];
  }
  else {
    module = null;
  }
  Messages.showInputDialog(project, RefactoringBundle.message("enter.new.project.name"), RefactoringBundle.message("rename.project"),
                           Messages.getQuestionIcon(),
                           project.getName(),
                           new RenameProjectHandler.MyInputValidator((ProjectEx)project, module));
}
项目:intellij-ce-playground    文件:DeleteHandler.java   
private static boolean clearReadOnlyFlag(final VirtualFile virtualFile, final Project project) {
  final boolean[] success = new boolean[1];
  CommandProcessor.getInstance().executeCommand(project, new Runnable() {
    @Override
    public void run() {
      Runnable action = new Runnable() {
        @Override
        public void run() {
          try {
            ReadOnlyAttributeUtil.setReadOnlyAttribute(virtualFile, false);
            success[0] = true;
          }
          catch (IOException e1) {
            Messages.showMessageDialog(project, e1.getMessage(), CommonBundle.getErrorTitle(), Messages.getErrorIcon());
          }
        }
      };
      ApplicationManager.getApplication().runWriteAction(action);
    }
  }, "", null);
  return success[0];
}
项目:intellij-ce-playground    文件:GroupBrowser.java   
@Nullable
@Override
protected String showDialog() {
  TestClassFilter filter;
  Module module = editor.getModuleSelector().getModule();
  if (module == null) {
    filter = new TestClassFilter(GlobalSearchScope.projectScope(getProject()), getProject(), false);
  }
  else {
    filter = new TestClassFilter(GlobalSearchScope.moduleScope(module), getProject(), false);
  }
  PsiClass[] classes = TestNGUtil.getAllTestClasses(filter, true);
  if(classes == null || classes.length == 0) {
    Messages.showMessageDialog(getField(), "No tests found in project", "Cannot Browse Groups", Messages.getInformationIcon());
    return null;
  } else {
    return GroupList.showDialog(classes, getField());
  }
}
项目:intellij-ce-playground    文件:SvnUpdateEnvironment.java   
private boolean checkAncestry(final File sourceFile, final SVNURL targetUrl, final SVNRevision targetRevision) throws SvnBindException {
  final Info sourceSvnInfo = myVcs.getInfo(sourceFile);
  final Info targetSvnInfo = myVcs.getInfo(targetUrl, targetRevision);

  if (sourceSvnInfo == null || targetSvnInfo == null) {
    // cannot check
    return true;
  }

  final SVNURL copyFromTarget = targetSvnInfo.getCopyFromURL();
  final SVNURL copyFromSource = sourceSvnInfo.getCopyFromURL();

  if ((copyFromSource != null) || (copyFromTarget != null)) {
    if (sourceSvnInfo.getURL().equals(copyFromTarget) || targetUrl.equals(copyFromSource)) {
      return true;
    }
  }

  final int result = Messages.showYesNoDialog(myVcs.getProject(), SvnBundle.message("switch.target.not.copy.current"),
                                              SvnBundle.message("switch.target.problem.title"), Messages.getWarningIcon());
  return (Messages.YES == result);
}
项目:intellij-ce-playground    文件:MavenProjectImporter.java   
private boolean deleteObsoleteModules() {
  final List<Module> obsoleteModules = collectObsoleteModules();
  if (obsoleteModules.isEmpty()) return false;

  setMavenizedModules(obsoleteModules, false);

  final int[] result = new int[1];
  MavenUtil.invokeAndWait(myProject, myModelsProvider.getModalityStateForQuestionDialogs(), new Runnable() {
    public void run() {
      result[0] = Messages.showYesNoDialog(myProject,
                                           ProjectBundle.message("maven.import.message.delete.obsolete", formatModules(obsoleteModules)),
                                           ProjectBundle.message("maven.project.import.title"),
                                           Messages.getQuestionIcon());
    }
  });

  if (result[0] == Messages.NO) return false;// NO

  for (Module each : obsoleteModules) {
    if (!each.isDisposed()) {
      myModuleModel.disposeModule(each);
    }
  }

  return true;
}
项目:intellij-ce-playground    文件:AvdComboBox.java   
public AvdComboBox(@Nullable Project project, boolean addEmptyElement, boolean showNotLaunchedOnly) {
  myProject = project;
  myAddEmptyElement = addEmptyElement;
  myShowNotLaunchedOnly = showNotLaunchedOnly;

  addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      final AndroidPlatform platform = findAndroidPlatform();
      AvdComboBox avdComboBox = AvdComboBox.this;
      if (platform == null) {
        Messages.showErrorDialog(avdComboBox, "Cannot find any configured Android SDK");
        return;
      }
      RunAndroidAvdManagerAction action = new RunAndroidAvdManagerAction();
      action.openAvdManager(myProject);
      AvdInfo selected = action.getSelected();
      if (selected != null) {
        getComboBox().setSelectedItem(new IdDisplay(selected.getName(), ""));
      }
    }
  });

  setMinimumSize(new Dimension(100, getMinimumSize().height));
}
项目:intellij-ce-playground    文件:DvcsCommitAdditionalComponent.java   
private void loadMessagesInModalTask(@NotNull Project project) {
  try {
    myMessagesForRoots =
      ProgressManager.getInstance().runProcessWithProgressSynchronously(new ThrowableComputable<Map<VirtualFile,String>, VcsException>() {
        @Override
        public Map<VirtualFile, String> compute() throws VcsException {
          return getLastCommitMessages();
        }
      }, "Reading commit message...", false, project);
  }
  catch (VcsException e) {
    Messages.showErrorDialog(getComponent(), "Couldn't load commit message of the commit to amend.\n" + e.getMessage(),
                             "Commit Message not Loaded");
    log.info(e);
  }
}
项目:intellij-ce-playground    文件:ImportModuleFromImlFileAction.java   
@Override
public void actionPerformed(AnActionEvent e) {
  final VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
  final Project project = getEventProject(e);
  if (files == null || project == null) return;

  try {
    final ModifiableModuleModel model = ModuleManager.getInstance(project).getModifiableModel();
    for (VirtualFile file : files) {
      model.loadModule(file.getPath());
    }

    AccessToken token = WriteAction.start();
    try {
      model.commit();
    }
    finally {
      token.finish();
    }
  }
  catch (Exception ex) {
    LOG.info(ex);
    Messages.showErrorDialog(project, "Cannot import module: " + ex.getMessage(), CommonBundle.getErrorTitle());
  }
}
项目:intellij-ce-playground    文件:PluginModuleBuildConfEditor.java   
public void apply() throws ConfigurationException {
  if (myUseUserManifest.isSelected() && myManifest.getText() != null && !new File(myManifest.getText()).exists()){
    throw new ConfigurationException(DevKitBundle.message("error.file.not.found.message", myManifest.getText()));
  }
  final File plugin = new File(myBuildProperties.getPluginXmlPath());
  final String newPluginPath = myPluginXML.getText() + File.separator + META_INF + File.separator + PLUGIN_XML;
  if (plugin.exists() && !plugin.getPath().equals(newPluginPath) && 
      Messages.showYesNoDialog(myModule.getProject(), DevKitBundle.message("deployment.view.delete", plugin.getPath()),
                               DevKitBundle.message("deployment.cleanup", META_INF), null) == Messages.YES) {

    CommandProcessor.getInstance().executeCommand(myModule.getProject(),
                                                  new Runnable() {
                                                    public void run() {
                                                      FileUtil.delete(plugin.getParentFile());
                                                    }
                                                  },
                                                  DevKitBundle.message("deployment.cleanup", META_INF),
                                                  null);
  }
  myBuildProperties.setPluginXmlPathAndCreateDescriptorIfDoesntExist(newPluginPath);
  myBuildProperties.setManifestPath(myManifest.getText());
  myBuildProperties.setUseUserManifest(myUseUserManifest.isSelected());
}
项目:intellij-ce-playground    文件:PluginManagerConfigurable.java   
@Override
public void apply() throws ConfigurationException {
  final String applyMessage = myPluginManagerMain.apply();
  if (applyMessage != null) {
    throw new ConfigurationException(applyMessage);
  }

  if (myPluginManagerMain.isRequireShutdown()) {
    if (showRestartDialog() == Messages.YES) {
      ApplicationManagerEx.getApplicationEx().restart(true);
    }
    else {
      myPluginManagerMain.ignoreChanges();
    }
  }
}
项目:intellij-ce-playground    文件:HTMLExportUtil.java   
public static void writeFile(final String folder, @NonNls final String fileName, CharSequence buf, final Project project) {
  try {
    HTMLExporter.writeFileImpl(folder, fileName, buf);
  }
  catch (IOException e) {
    Runnable showError = new Runnable() {
      @Override
      public void run() {
        final String fullPath = folder + File.separator + fileName;
        Messages.showMessageDialog(
          project,
          InspectionsBundle.message("inspection.export.error.writing.to", fullPath),
          InspectionsBundle.message("inspection.export.results.error.title"),
          Messages.getErrorIcon()
        );
      }
    };
    ApplicationManager.getApplication().invokeLater(showError, ModalityState.NON_MODAL);
    throw new ProcessCanceledException();
  }
}
项目:intellij-ce-playground    文件:FontOptions.java   
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 {
    Messages.showMessageDialog(
      parent,
      ApplicationBundle.message("error.shared.scheme.cannot.be.modified"),
      ApplicationBundle.message("title.cannot.modify.readonly.scheme"),
      Messages.getInformationIcon()
    );
  }
}
项目:intellij-ce-playground    文件:BreakpointsDialog.java   
@Override
public void actionPerformed(AnActionEvent e) {
  String groupName = myGroup;
  if (myNewGroup) {
    groupName = Messages.showInputDialog("New group name", "New Group", AllIcons.Nodes.NewFolder);
    if (groupName == null) {
      return;
    }
  }
  for (BreakpointItem item : myTreeController.getSelectedBreakpoints(true)) {
    Object breakpoint = item.getBreakpoint();
    if (breakpoint instanceof XBreakpointBase) {
      ((XBreakpointBase)breakpoint).setGroup(groupName);
    }
  }
  myTreeController.rebuildTree(myBreakpointItems);
}
项目:intellij-ce-playground    文件:ProjectImporterCheckoutListener.java   
@Override
public boolean processCheckedOutDirectory(Project project, File directory) {
  final File[] files = directory.listFiles();
  if (files != null) {
    final LocalFileSystem localFileSystem = LocalFileSystem.getInstance();
    for (File file : files) {
      if (file.isDirectory()) continue;
      final VirtualFile virtualFile = localFileSystem.findFileByIoFile(file);
      if (virtualFile != null) {
        final ProjectOpenProcessor openProcessor = ProjectOpenProcessor.getImportProvider(virtualFile);
        if (openProcessor != null) {
          int rc = Messages
            .showYesNoDialog(project, VcsBundle.message("checkout.open.project.prompt", ProjectCheckoutListener.getProductNameWithArticle(), file.getPath()),
                             VcsBundle.message("checkout.title"), Messages.getQuestionIcon());
          if (rc == Messages.YES) {
            openProcessor.doOpenProject(virtualFile, project, false);
          }
          return true;
        }
      }
    }
  }
  return false;
}
项目:intellij-ce-playground    文件:CustomizableActionsPanel.java   
private void editToolbarIcon(String actionId, DefaultMutableTreeNode node) {
  final AnAction anAction = ActionManager.getInstance().getAction(actionId);
  if (isToolbarAction(node) && anAction.getTemplatePresentation().getIcon() == null) {
    final int exitCode = Messages.showOkCancelDialog(IdeBundle.message("error.adding.action.without.icon.to.toolbar"),
                                                     IdeBundle.message("title.unable.to.add.action.without.icon.to.toolbar"),
                                                     Messages.getInformationIcon());
    if (exitCode == Messages.OK) {
      mySelectedSchema.addIconCustomization(actionId, null);
      anAction.getTemplatePresentation().setIcon(AllIcons.Toolbar.Unknown);
      anAction.getTemplatePresentation().setDisabledIcon(IconLoader.getDisabledIcon(AllIcons.Toolbar.Unknown));
      anAction.setDefaultIcon(false);
      node.setUserObject(Pair.create(actionId, AllIcons.Toolbar.Unknown));
      myActionsTree.repaint();
      CustomActionsSchema.setCustomizationSchemaForCurrentProjects();
    }
  }
}