List of usage examples for com.intellij.openapi.fileChooser FileChooser chooseFile
public static void chooseFile(@NotNull final FileChooserDescriptor descriptor, @Nullable final Project project, @Nullable final Component parent, @Nullable final VirtualFile toSelect, @NotNull final Consumer<? super VirtualFile> callback)
From source file:com.android.tools.idea.uibuilder.mockup.editor.FileChooserActionListener.java
License:Apache License
@Override public void actionPerformed(ActionEvent e) { if (myFilePathProperty == null) { return;/*from www . j a v a2s .co m*/ } final FileChooserDescriptor descriptor = MockupFileHelper.getFileChooserDescriptor(); VirtualFile selectedFile = myFilePathProperty.getValue() != null ? VfsUtil.findFileByIoFile( new File(FileUtil.toSystemIndependentName(myFilePathProperty.getValue())), false) : ourLastOpenedFile; FileChooser.chooseFile(descriptor, null, null, selectedFile, (virtualFile) -> { ourLastOpenedFile = virtualFile; if (myComponent != null && myComponent.isRoot()) { openDeviceChoiceDialog(virtualFile, myFilePathProperty, myCropProperty); } else { saveMockupFile(virtualFile, myFilePathProperty, myCropProperty); if (e == null) { return; } final TextAccessor textAccessor = e.getSource() instanceof TextAccessor ? ((TextAccessor) e.getSource()) : null; if (textAccessor != null) { textAccessor.setText(virtualFile.getPath()); } } }); }
From source file:com.intellij.ide.plugins.InstalledPluginsManagerMain.java
License:Apache License
public InstalledPluginsManagerMain(PluginManagerUISettings uiSettings) { super(uiSettings); init();/* ww w . j a v a2 s . c o m*/ myActionsPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); final JButton button = new JButton("Browse repositories..."); button.setMnemonic('b'); button.addActionListener(new BrowseRepoListener(null)); myActionsPanel.add(button); final JButton installPluginFromFileSystem = new JButton("Install plugin from disk..."); installPluginFromFileSystem.setMnemonic('d'); installPluginFromFileSystem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, false, true, true, false, false) { @Override public boolean isFileSelectable(VirtualFile file) { return file.getFileType() instanceof ArchiveFileType; } }; descriptor.setTitle("Choose Plugin File"); descriptor.setDescription("JAR and ZIP archives are accepted"); FileChooser.chooseFile(descriptor, null, myActionsPanel, null, new Consumer<VirtualFile>() { @Override public void consume(@NotNull VirtualFile virtualFile) { final File file = VfsUtilCore.virtualToIoFile(virtualFile); try { final IdeaPluginDescriptorImpl pluginDescriptor = PluginDownloader .loadDescriptionFromJar(file); if (pluginDescriptor == null) { Messages.showErrorDialog( "Fail to load plugin descriptor from file " + file.getName(), CommonBundle.getErrorTitle()); return; } if (PluginManagerCore.isIncompatible(pluginDescriptor)) { Messages.showErrorDialog( "Plugin " + pluginDescriptor.getName() + " is incompatible with current installation", CommonBundle.getErrorTitle()); return; } final IdeaPluginDescriptor alreadyInstalledPlugin = PluginManager .getPlugin(pluginDescriptor.getPluginId()); if (alreadyInstalledPlugin != null) { final File oldFile = alreadyInstalledPlugin.getPath(); if (oldFile != null) { StartupActionScriptManager.addActionCommand( new StartupActionScriptManager.DeleteCommand(oldFile)); } } if (((InstalledPluginsTableModel) pluginsModel) .appendOrUpdateDescriptor(pluginDescriptor)) { PluginDownloader.install(file, file.getName(), false); select(pluginDescriptor); checkInstalledPluginDependencies(pluginDescriptor); setRequireShutdown(true); } else { Messages.showInfoMessage(myActionsPanel, "Plugin " + pluginDescriptor.getName() + " was already installed", CommonBundle.getWarningTitle()); } } catch (IOException ex) { Messages.showErrorDialog(ex.getMessage(), CommonBundle.getErrorTitle()); } } }); } }); myActionsPanel.add(installPluginFromFileSystem); final StatusText emptyText = pluginTable.getEmptyText(); emptyText.setText("Nothing to show."); emptyText.appendText(" Click "); emptyText.appendText("Browse", SimpleTextAttributes.LINK_ATTRIBUTES, new BrowseRepoListener(null)); emptyText.appendText(" to search for non-bundled plugins."); }
From source file:com.intellij.profile.codeInspection.ui.header.InspectionToolsConfigurable.java
License:Apache License
public InspectionToolsConfigurable(@NotNull final InspectionProjectProfileManager projectProfileManager, InspectionProfileManager profileManager) { myWholePanel = new JPanel(new BorderLayout()); final JPanel toolbar = new JPanel(new GridBagLayout()); toolbar.setBorder(BorderFactory.createEmptyBorder(0, 0, 7, 0)); myPanel = new JPanel(); myWholePanel.add(toolbar, BorderLayout.PAGE_START); myWholePanel.add(myPanel, BorderLayout.CENTER); myProfiles = new ProfilesConfigurableComboBox(new ListCellRendererWrapper<Profile>() { @Override//from ww w .j a v a2s . com public void customize(final JList list, final Profile value, final int index, final boolean selected, final boolean hasFocus) { final SingleInspectionProfilePanel singleInspectionProfilePanel = myPanels.get(value); final boolean isShared = singleInspectionProfilePanel.isProfileShared(); setIcon(isShared ? AllIcons.General.ProjectSettings : AllIcons.General.Settings); setText(singleInspectionProfilePanel.getCurrentProfileName()); } }) { @Override public void onProfileChosen(InspectionProfileImpl inspectionProfile) { myLayout.show(myPanel, getCardName(inspectionProfile)); myAuxiliaryRightPanel.showDescription(inspectionProfile.getDescription()); } }; JPanel profilesHolder = new JPanel(); profilesHolder.setLayout(new CardLayout()); JComponent manageButton = new ManageButton(new ManageButtonBuilder() { @Override public boolean isSharedToTeamMembers() { SingleInspectionProfilePanel panel = getSelectedPanel(); return panel != null && panel.isProfileShared(); } @Override public void setShareToTeamMembers(boolean shared) { final SingleInspectionProfilePanel selectedPanel = getSelectedPanel(); LOG.assertTrue(selectedPanel != null, "No settings selectedPanel for: " + getSelectedObject()); final String name = getSelectedPanel().getCurrentProfileName(); for (SingleInspectionProfilePanel p : myPanels.values()) { if (p != selectedPanel && Comparing.equal(p.getCurrentProfileName(), name)) { final boolean curShared = p.isProfileShared(); if (curShared == shared) { Messages.showErrorDialog( (shared ? "Shared" : "Application level") + " profile with same name exists.", "Inspections Settings"); return; } } } selectedPanel.setProfileShared(shared); myProfiles.repaint(); } @Override public void copy() { final InspectionProfileImpl newProfile = copyToNewProfile(getSelectedObject(), getProject()); if (newProfile != null) { final InspectionProfileImpl modifiableModel = (InspectionProfileImpl) newProfile .getModifiableModel(); modifiableModel.setModified(true); modifiableModel.setProjectLevel(false); addProfile(modifiableModel); rename(modifiableModel); } } @Override public boolean canRename() { final InspectionProfileImpl profile = getSelectedObject(); return !profile.isProfileLocked(); } @Override public void rename() { rename(getSelectedObject()); } private void rename(@NotNull final InspectionProfileImpl inspectionProfile) { final String initialName = getSelectedPanel().getCurrentProfileName(); myProfiles.showEditCard(initialName, new SaveInputComponentValidator() { @Override public void doSave(@NotNull String text) { if (!text.equals(initialName)) { getProfilePanel(inspectionProfile).setCurrentProfileName(text); } myProfiles.showComboBoxCard(); } @Override public boolean checkValid(@NotNull String text) { final SingleInspectionProfilePanel singleInspectionProfilePanel = myPanels .get(inspectionProfile); if (singleInspectionProfilePanel == null) { return false; } final boolean isValid = text.equals(initialName) || !hasName(text, singleInspectionProfilePanel.isProfileShared()); if (isValid) { myAuxiliaryRightPanel.showDescription(getSelectedObject().getDescription()); } else { myAuxiliaryRightPanel .showError("Name is already in use. Please change name to unique."); } return isValid; } @Override public void cancel() { myProfiles.showComboBoxCard(); myAuxiliaryRightPanel.showDescription(getSelectedObject().getDescription()); } }); } @Override public boolean canDelete() { return isDeleteEnabled(myProfiles.getSelectedProfile()); } @Override public void delete() { final InspectionProfileImpl selectedProfile = myProfiles.getSelectedProfile(); myProfiles.getModel().removeElement(selectedProfile); myDeletedProfiles.add(selectedProfile); } @Override public boolean canEditDescription() { return true; } @Override public void editDescription() { myAuxiliaryRightPanel.editDescription(getSelectedObject().getDescription()); } @Override public boolean hasDescription() { return !StringUtil.isEmpty(getSelectedObject().getDescription()); } @Override public void export() { final FileChooserDescriptor descriptor = FileChooserDescriptorFactory .createSingleFolderDescriptor(); descriptor.setDescription("Choose directory to store profile file"); FileChooser.chooseFile(descriptor, getProject(), myWholePanel, null, new Consumer<VirtualFile>() { @Override public void consume(VirtualFile file) { final Element element = new Element("inspections"); try { final SingleInspectionProfilePanel panel = getSelectedPanel(); LOG.assertTrue(panel != null); final InspectionProfileImpl profile = getSelectedObject(); LOG.assertTrue(true); profile.writeExternal(element); final String filePath = FileUtil.toSystemDependentName(file.getPath()) + File.separator + FileUtil.sanitizeFileName(profile.getName()) + ".xml"; if (new File(filePath).isFile()) { if (Messages.showOkCancelDialog(myWholePanel, "File \'" + filePath + "\' already exist. Do you want to overwrite it?", "Warning", Messages.getQuestionIcon()) != Messages.OK) { return; } } JDOMUtil.writeDocument(new Document(element), filePath, SystemProperties.getLineSeparator()); } catch (WriteExternalException e1) { LOG.error(e1); } catch (IOException e1) { LOG.error(e1); } } }); } @Override public void doImport() { final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, false, false, false) { @Override public boolean isFileSelectable(VirtualFile file) { return file.getFileType().equals(InternalStdFileTypes.XML); } }; descriptor.setDescription("Choose profile file"); FileChooser.chooseFile(descriptor, getProject(), myWholePanel, null, new Consumer<VirtualFile>() { @Override public void consume(VirtualFile file) { if (file == null) return; InspectionProfileImpl profile = new InspectionProfileImpl("TempProfile", InspectionToolRegistrar.getInstance(), myProfileManager); try { Element rootElement = JDOMUtil.loadDocument(VfsUtilCore.virtualToIoFile(file)) .getRootElement(); if (Comparing.strEqual(rootElement.getName(), "component")) {//import right from .idea/inspectProfiles/xxx.xml rootElement = rootElement.getChildren().get(0); } final Set<String> levels = new HashSet<String>(); for (Object o : rootElement.getChildren("inspection_tool")) { final Element inspectElement = (Element) o; levels.add(inspectElement.getAttributeValue("level")); for (Object s : inspectElement.getChildren("scope")) { levels.add(((Element) s).getAttributeValue("level")); } } for (Iterator<String> iterator = levels.iterator(); iterator.hasNext();) { String level = iterator.next(); if (myProfileManager.getOwnSeverityRegistrar().getSeverity(level) != null) { iterator.remove(); } } if (!levels.isEmpty()) { if (Messages.showYesNoDialog(myWholePanel, "Undefined severities detected: " + StringUtil.join(levels, ", ") + ". Do you want to create them?", "Warning", Messages.getWarningIcon()) == Messages.YES) { for (String level : levels) { final TextAttributes textAttributes = CodeInsightColors.WARNINGS_ATTRIBUTES .getDefaultAttributes(); HighlightInfoType.HighlightInfoTypeImpl info = new HighlightInfoType.HighlightInfoTypeImpl( new HighlightSeverity(level, 50), TextAttributesKey.createTextAttributesKey(level)); myProfileManager.getOwnSeverityRegistrar().registerSeverity( new SeverityRegistrar.SeverityBasedTextAttributes( textAttributes.clone(), info), textAttributes.getErrorStripeColor()); } } } profile.readExternal(rootElement); profile.setProjectLevel(false); profile.initInspectionTools(getProject()); if (getProfilePanel(profile) != null) { if (Messages.showOkCancelDialog(myWholePanel, "Profile with name \'" + profile.getName() + "\' already exists. Do you want to overwrite it?", "Warning", Messages.getInformationIcon()) != Messages.OK) { return; } } final ModifiableModel model = profile.getModifiableModel(); model.setModified(true); addProfile((InspectionProfileImpl) model); //TODO myDeletedProfiles ? really need this myDeletedProfiles.remove(profile); } catch (InvalidDataException e1) { LOG.error(e1); } catch (JDOMException e1) { LOG.error(e1); } catch (IOException e1) { LOG.error(e1); } } }); } }).build(); myAuxiliaryRightPanel = new AuxiliaryRightPanel(new AuxiliaryRightPanel.DescriptionSaveListener() { @Override public void saveDescription(@NotNull String description) { final InspectionProfileImpl inspectionProfile = getSelectedObject(); if (!Comparing.strEqual(description, inspectionProfile.getDescription())) { inspectionProfile.setDescription(description); inspectionProfile.setModified(true); } myAuxiliaryRightPanel.showDescription(description); } @Override public void cancel() { myAuxiliaryRightPanel.showDescription(getSelectedObject().getDescription()); } }); toolbar.add(new JLabel(HEADER_TITLE), new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0)); toolbar.add(myProfiles.getHintLabel(), new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 6, 6, 0), 0, 0)); toolbar.add(myProfiles, new GridBagConstraints(1, 1, 1, 1, 0, 1.0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 6, 0, 0), 0, 0)); toolbar.add(manageButton, new GridBagConstraints(2, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 10, 0, 0), 0, 0)); toolbar.add(myAuxiliaryRightPanel.getHintLabel(), new GridBagConstraints(3, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 15, 6, 0), 0, 0)); toolbar.add(myAuxiliaryRightPanel, new GridBagConstraints(3, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 15, 0, 0), 0, 0)); ((InspectionManagerEx) InspectionManager.getInstance(projectProfileManager.getProject())) .buildInspectionSearchIndexIfNecessary(); myProjectProfileManager = projectProfileManager; myProfileManager = profileManager; }
From source file:com.intellij.profile.codeInspection.ui.InspectionToolsConfigurable.java
License:Apache License
public InspectionToolsConfigurable(@NotNull final InspectionProjectProfileManager projectProfileManager, InspectionProfileManager profileManager) { ((InspectionManagerEx) InspectionManager.getInstance(projectProfileManager.getProject())) .buildInspectionSearchIndexIfNecessary(); myAddButton.addActionListener(new ActionListener() { @Override// w ww . jav a2 s . c o m public void actionPerformed(ActionEvent e) { final Set<String> existingProfileNames = myPanels.keySet(); final ModifiableModel model = SingleInspectionProfilePanel.createNewProfile(-1, getSelectedObject(), myWholePanel, "", existingProfileNames, projectProfileManager.getProject()); if (model != null) { addProfile((InspectionProfileImpl) model); myDeletedProfiles.remove(getProfilePrefix(model) + model.getName()); myDeleteButton.setEnabled(true); } } }); myDeleteButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final InspectionProfileImpl selectedProfile = (InspectionProfileImpl) myProfiles.getSelectedItem(); ((DefaultComboBoxModel) myProfiles.getModel()).removeElement(selectedProfile); myDeletedProfiles.add(getProfilePrefix(selectedProfile) + selectedProfile.getName()); myDeleteButton.setEnabled(isDeleteEnabled(selectedProfile)); } }); final Project project = projectProfileManager.getProject(); myImportButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, false, false, false) { @Override public boolean isFileSelectable(VirtualFile file) { return file.getFileType().equals(StdFileTypes.XML); } }; descriptor.setDescription("Choose profile file"); FileChooser.chooseFile(descriptor, project, myWholePanel, null, new Consumer<VirtualFile>() { @Override public void consume(VirtualFile file) { if (file == null) return; InspectionProfileImpl profile = new InspectionProfileImpl("TempProfile", InspectionToolRegistrar.getInstance(), myProfileManager); try { Element rootElement = JDOMUtil.loadDocument(VfsUtilCore.virtualToIoFile(file)) .getRootElement(); if (Comparing.strEqual(rootElement.getName(), "component")) {//import right from .idea/inspectProfiles/xxx.xml rootElement = rootElement.getChildren().get(0); } final Set<String> levels = new HashSet<String>(); for (Object o : rootElement.getChildren("inspection_tool")) { final Element inspectElement = (Element) o; levels.add(inspectElement.getAttributeValue("level")); for (Object s : inspectElement.getChildren("scope")) { levels.add(((Element) s).getAttributeValue("level")); } } for (Iterator<String> iterator = levels.iterator(); iterator.hasNext();) { String level = iterator.next(); if (myProfileManager.getOwnSeverityRegistrar().getSeverity(level) != null) { iterator.remove(); } } if (!levels.isEmpty()) { if (Messages.showYesNoDialog(myWholePanel, "Undefined severities detected: " + StringUtil.join(levels, ", ") + ". Do you want to create them?", "Warning", Messages.getWarningIcon()) == Messages.YES) { for (String level : levels) { final TextAttributes textAttributes = CodeInsightColors.WARNINGS_ATTRIBUTES .getDefaultAttributes(); HighlightInfoType.HighlightInfoTypeImpl info = new HighlightInfoType.HighlightInfoTypeImpl( new HighlightSeverity(level, 50), com.intellij.openapi.editor.colors.TextAttributesKey .createTextAttributesKey(level)); myProfileManager.getOwnSeverityRegistrar().registerSeverity( new SeverityRegistrar.SeverityBasedTextAttributes( textAttributes.clone(), info), textAttributes.getErrorStripeColor()); } } } profile.readExternal(rootElement); profile.setLocal(true); profile.initInspectionTools(project); if (getProfilePanel(profile) != null) { if (Messages.showOkCancelDialog(myWholePanel, "Profile with name \'" + profile.getName() + "\' already exists. Do you want to overwrite it?", "Warning", Messages.getInformationIcon()) != Messages.OK) return; } final ModifiableModel model = profile.getModifiableModel(); model.setModified(true); addProfile((InspectionProfileImpl) model); myDeletedProfiles.remove(getProfilePrefix(profile) + profile.getName()); myDeleteButton.setEnabled(true); } catch (InvalidDataException e1) { LOG.error(e1); } catch (JDOMException e1) { LOG.error(e1); } catch (IOException e1) { LOG.error(e1); } } }); } }); myExportButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final FileChooserDescriptor descriptor = FileChooserDescriptorFactory .createSingleFolderDescriptor(); descriptor.setDescription("Choose directory to store profile file"); FileChooser.chooseFile(descriptor, project, myWholePanel, null, new Consumer<VirtualFile>() { @Override public void consume(VirtualFile file) { final Element element = new Element("inspections"); try { final SingleInspectionProfilePanel panel = getSelectedPanel(); LOG.assertTrue(panel != null); final InspectionProfileImpl profile = (InspectionProfileImpl) panel .getSelectedProfile(); profile.writeExternal(element); final String filePath = FileUtil.toSystemDependentName(file.getPath()) + File.separator + FileUtil.sanitizeFileName(profile.getName()) + ".xml"; if (new File(filePath).isFile()) { if (Messages.showOkCancelDialog(myWholePanel, "File \'" + filePath + "\' already exist. Do you want to overwrite it?", "Warning", Messages.getQuestionIcon()) != Messages.OK) return; } JDOMUtil.writeDocument(new Document(element), filePath, SystemProperties.getLineSeparator()); } catch (WriteExternalException e1) { LOG.error(e1); } catch (IOException e1) { LOG.error(e1); } } }); } }); myCopyButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final Set<String> existingProfileNames = myPanels.keySet(); final InspectionProfileImpl model = (InspectionProfileImpl) SingleInspectionProfilePanel .createNewProfile(0, getSelectedObject(), myWholePanel, "", existingProfileNames, project); if (model != null) { final InspectionProfileImpl modifiableModel = (InspectionProfileImpl) model .getModifiableModel(); modifiableModel.setModified(true); addProfile(modifiableModel); myDeletedProfiles.remove(getProfilePrefix(model) + model.getName()); myDeleteButton.setEnabled(true); } } }); myProjectProfileManager = projectProfileManager; myProfileManager = profileManager; myJBScrollPane.setBorder(null); }
From source file:com.intellij.util.ui.LocalPathCellEditor.java
License:Apache License
protected ActionListener createActionListener(final JTable table) { return new ActionListener() { @Override// w w w. j a v a2s.c om public void actionPerformed(ActionEvent e) { String initial = (String) getCellEditorValue(); VirtualFile initialFile = StringUtil.isNotEmpty(initial) ? LocalFileSystem.getInstance().findFileByPath(initial) : null; FileChooser.chooseFile(getFileChooserDescriptor(), myProject, table, initialFile, new Consumer<VirtualFile>() { @Override public void consume(VirtualFile file) { String path = file.getPresentableUrl(); if (SystemInfo.isWindows && path.length() == 2 && Character.isLetter(path.charAt(0)) && path.charAt(1) == ':') { path += "\\"; // make path absolute } myComponent.getChildComponent().setText(path); } }); } }; }
From source file:com.mbeddr.pluginmanager.com.intellij.ide.plugins.InstalledPluginsManagerMain.java
License:Apache License
private static void chooseAndInstall(@NotNull final InstalledPluginsTableModel model, @NotNull final Consumer<Pair<File, IdeaPluginDescriptor>> callback, @Nullable final Component parent) { final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, false, true, true, false, false) { @Override//from w ww.j a v a 2 s . c o m public boolean isFileSelectable(VirtualFile file) { final String extension = file.getExtension(); return Comparing.strEqual(extension, "jar") || Comparing.strEqual(extension, "zip"); } }; descriptor.setTitle("Choose Plugin File"); descriptor.setDescription("JAR and ZIP archives are accepted"); final String oldPath = PropertiesComponent.getInstance().getValue(PLUGINS_PRESELECTION_PATH); final VirtualFile toSelect = oldPath == null ? null : VfsUtil.findFileByIoFile(new File(FileUtil.toSystemDependentName(oldPath)), false); FileChooser.chooseFile(descriptor, null, parent, toSelect, new Consumer<VirtualFile>() { @Override public void consume(@NotNull VirtualFile virtualFile) { File file = VfsUtilCore.virtualToIoFile(virtualFile); PropertiesComponent.getInstance().setValue(PLUGINS_PRESELECTION_PATH, FileUtil.toSystemIndependentName(file.getParent())); try { IdeaPluginDescriptorImpl pluginDescriptor = PluginDownloader.loadDescriptionFromJar(file); if (pluginDescriptor == null) { MessagesEx.showErrorDialog(parent, "Fail to load plugin descriptor from file " + file.getName(), CommonBundle.getErrorTitle()); return; } if (ourState.wasInstalled(pluginDescriptor.getPluginId())) { String message = "Plugin '" + pluginDescriptor.getName() + "' was already installed"; MessagesEx.showWarningDialog(parent, message, CommonBundle.getWarningTitle()); return; } if (PluginManagerCore.isIncompatible(pluginDescriptor)) { String message = "Plugin '" + pluginDescriptor.getName() + "' is incompatible with this installation"; MessagesEx.showErrorDialog(parent, message, CommonBundle.getErrorTitle()); return; } IdeaPluginDescriptor installedPlugin = PluginManager.getPlugin(pluginDescriptor.getPluginId()); if (installedPlugin != null && !installedPlugin.isBundled()) { File oldFile = installedPlugin.getPath(); if (oldFile != null) { StartupActionScriptManager .addActionCommand(new StartupActionScriptManager.DeleteCommand(oldFile)); } } PluginInstaller.install(file, file.getName(), false); ourState.onPluginInstall(pluginDescriptor); checkInstalledPluginDependencies(model, pluginDescriptor, parent); callback.consume(pair(file, (IdeaPluginDescriptor) pluginDescriptor)); } catch (IOException ex) { MessagesEx.showErrorDialog(parent, ex.getMessage(), CommonBundle.getErrorTitle()); } } }); }