Merge branch 'master' of git.labs.intellij.net:idea/community

This commit is contained in:
Kirill Likhodedov
2010-09-28 12:01:41 +04:00
14 changed files with 203 additions and 253 deletions
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.facet.impl.ui.libraries.LibraryCompositionOptionsPanel">
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="565" height="331"/>
@@ -38,7 +38,7 @@
<grid id="d8a5d" binding="myNewLibraryPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -179,32 +179,9 @@
</grid>
</children>
</grid>
<grid id="2340d" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="8c46a" class="javax.swing.JButton" binding="myAddLibraryButton" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ProjectBundle" key="composing.library.use.library.button"/>
</properties>
</component>
<hspacer id="b750">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
<vspacer id="c39ad">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
</children>
@@ -23,8 +23,6 @@ import com.intellij.openapi.fileChooser.FileChooser;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.ui.VerticalFlowLayout;
@@ -53,7 +51,6 @@ import java.util.Set;
public class LibraryCompositionOptionsPanel {
private final MutualMap<LibrariesContainer.LibraryLevel, String> myLibraryLevels = new MutualMap<LibrariesContainer.LibraryLevel, String>(true);
private JPanel myMainPanel;
private JButton myAddLibraryButton;
private JButton myAddJarsButton;
private JCheckBox myDownloadMissingJarsCheckBox;
private TextFieldWithBrowseButton myDirectoryField;
@@ -66,10 +63,7 @@ public class LibraryCompositionOptionsPanel {
private JLabel myMissingLibrariesLabel;
private JLabel myHiddenLabel;
private final List<VirtualFile> myAddedJars = new ArrayList<VirtualFile>();
private final List<Library> myUsedLibraries = new ArrayList<Library>();
private final LibrariesContainer myLibrariesContainer;
private final LibraryCompositionSettings myLibraryCompositionSettings;
private final List<Library> mySuitableLibraries;
private final LibraryDownloadingMirrorsMap myMirrorsMap;
private List<RemoteRepositoryMirrorPanel> myMirrorPanelsList;
@@ -77,7 +71,6 @@ public class LibraryCompositionOptionsPanel {
final @NotNull LibraryCompositionSettings libraryCompositionSettings,
final @NotNull LibraryDownloadingMirrorsMap mirrorsMap) {
myLibrariesContainer = librariesContainer;
myLibraryCompositionSettings = libraryCompositionSettings;
myMirrorsMap = mirrorsMap;
addMirrorsPanels();
@@ -85,17 +78,11 @@ public class LibraryCompositionOptionsPanel {
myDirectoryField.addBrowseFolderListener(ProjectBundle.message("file.chooser.directory.for.downloaded.libraries.title"),
ProjectBundle.message("file.chooser.directory.for.downloaded.libraries.description"), null,
FileChooserDescriptorFactory.createSingleFolderDescriptor());
myUsedLibraries.addAll(myLibraryCompositionSettings.getUsedLibraries());
myAddJarsButton.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
showFileChooser();
}
});
myAddLibraryButton.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
showLibrariesChooser();
}
});
myDownloadMissingJarsCheckBox.setSelected(myLibraryCompositionSettings.isDownloadLibraries());
myDownloadMissingJarsCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
@@ -103,9 +90,6 @@ public class LibraryCompositionOptionsPanel {
}
});
mySuitableLibraries = calculateSuitableLibraries();
myAddLibraryButton.setEnabled(!mySuitableLibraries.isEmpty());
myLibraryLevels.put(LibrariesContainer.LibraryLevel.GLOBAL, ProjectBundle.message("combobox.item.global.library"));
myLibraryLevels.put(LibrariesContainer.LibraryLevel.PROJECT, ProjectBundle.message("combobox.item.project.library"));
myLibraryLevels.put(LibrariesContainer.LibraryLevel.MODULE, ProjectBundle.message("combobox.item.module.library"));
@@ -147,32 +131,6 @@ public class LibraryCompositionOptionsPanel {
}
}
private List<Library> calculateSuitableLibraries() {
LibraryInfo[] libraryInfos = myLibraryCompositionSettings.getLibraryInfos();
RequiredLibrariesInfo requiredLibraries = new RequiredLibrariesInfo(libraryInfos);
List<Library> suitableLibraries = new ArrayList<Library>();
Library[] libraries = myLibrariesContainer.getAllLibraries();
for (Library library : libraries) {
RequiredLibrariesInfo.RequiredClassesNotFoundInfo info =
requiredLibraries.checkLibraries(myLibrariesContainer.getLibraryFiles(library, OrderRootType.CLASSES), false);
if (info == null || info.getLibraryInfos().length < libraryInfos.length) {
suitableLibraries.add(library);
}
}
return suitableLibraries;
}
private void showLibrariesChooser() {
ChooseLibrariesDialog dialog = new ChooseLibrariesDialog(myMainPanel, mySuitableLibraries);
dialog.markElements(myUsedLibraries);
dialog.show();
if (dialog.isOK()) {
myUsedLibraries.clear();
myUsedLibraries.addAll(dialog.getMarkedLibraries());
updateAll();
}
}
private void showFileChooser() {
final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, false, true, false, false, true);
descriptor.setTitle(IdeBundle.message("file.chooser.select.paths.title"));
@@ -197,9 +155,6 @@ public class LibraryCompositionOptionsPanel {
String missingJarsText;
List<VirtualFile> roots = new ArrayList<VirtualFile>();
roots.addAll(myAddedJars);
for (Library library : myUsedLibraries) {
ContainerUtil.addAll(roots, myLibrariesContainer.getLibraryFiles(library, OrderRootType.CLASSES));
}
RequiredLibrariesInfo.RequiredClassesNotFoundInfo info = new RequiredLibrariesInfo(myLibraryCompositionSettings.getLibraryInfos()).checkLibraries(
VfsUtil.toVirtualFileArray(roots), false);
if (info != null) {
@@ -222,12 +177,6 @@ public class LibraryCompositionOptionsPanel {
UIUtil.setEnabled(myMirrorsPanel, myDownloadMissingJarsCheckBox.isSelected(), true);
}
public void updateRepositoriesMirrors(final LibraryDownloadingMirrorsMap mirrorsMap) {
for (RemoteRepositoryMirrorPanel mirrorPanel : myMirrorPanelsList) {
mirrorPanel.updateComboBox(mirrorsMap);
}
}
public void saveSelectedRepositoriesMirrors(final LibraryDownloadingMirrorsMap mirrorsMap) {
for (RemoteRepositoryMirrorPanel mirrorPanel : myMirrorPanelsList) {
mirrorsMap.setMirror(mirrorPanel.getRemoteRepository(), mirrorPanel.getSelectedMirror());
@@ -243,7 +192,6 @@ public class LibraryCompositionOptionsPanel {
else {
myLibraryCompositionSettings.setDownloadLibraries(false);
}
myLibraryCompositionSettings.setUsedLibraries(myUsedLibraries);
myLibraryCompositionSettings.setLibraryLevel(myLibraryLevels.getKey((String)myLibraryLevelComboBox.getSelectedItem()));
myLibraryCompositionSettings.setLibraryName(myLibraryNameField.getText());
}
@@ -26,13 +26,13 @@ import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContaine
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainerFactory;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
/**
* @author nik
@@ -45,13 +45,13 @@ public class LibraryCompositionSettings implements Disposable {
private final String myTitle;
private String myDirectoryForDownloadedLibrariesPath;
private boolean myDownloadLibraries = true;
private final Set<Library> myUsedLibraries = new LinkedHashSet<Library>();
private LibrariesContainer.LibraryLevel myLibraryLevel = LibrariesContainer.LibraryLevel.PROJECT;
private String myLibraryName;
private final Icon myIcon;
private boolean myDownloadSources = true;
private boolean myDownloadJavadocs = true;
private NewLibraryEditor myLibraryEditor;
private Library mySelectedLibrary;
public LibraryCompositionSettings(final @NotNull LibraryInfo[] libraryInfos,
final @NotNull String defaultLibraryName,
@@ -93,9 +93,8 @@ public class LibraryCompositionSettings implements Disposable {
myDownloadLibraries = downloadLibraries;
}
public void setUsedLibraries(Collection<Library> addedLibraries) {
myUsedLibraries.clear();
myUsedLibraries.addAll(addedLibraries);
public void setSelectedExistingLibrary(Library library) {
mySelectedLibrary = library;
}
public void setLibraryLevel(final LibrariesContainer.LibraryLevel libraryLevel) {
@@ -124,9 +123,6 @@ public class LibraryCompositionSettings implements Disposable {
RequiredLibrariesInfo requiredLibraries = new RequiredLibrariesInfo(getLibraryInfos());
List<VirtualFile> roots = new ArrayList<VirtualFile>();
for (Library library : myUsedLibraries) {
ContainerUtil.addAll(roots, librariesContainer.getLibraryFiles(library, OrderRootType.CLASSES));
}
VirtualFile[] jars = VfsUtil.toVirtualFileArray(roots);
RequiredLibrariesInfo.RequiredClassesNotFoundInfo info = requiredLibraries.checkLibraries(jars, all);
if (info != null) {
@@ -165,10 +161,6 @@ public class LibraryCompositionSettings implements Disposable {
return myLibraryName;
}
public Collection<Library> getUsedLibraries() {
return Collections.unmodifiableCollection(myUsedLibraries);
}
public Icon getIcon() {
return myIcon;
}
@@ -185,9 +177,9 @@ public class LibraryCompositionSettings implements Disposable {
rootModel.addLibraryEntry(library);
}
}
for (Library usedLibrary : getUsedLibraries()) {
addedLibraries.add(usedLibrary);
rootModel.addLibraryEntry(usedLibrary);
if (mySelectedLibrary != null) {
addedLibraries.add(mySelectedLibrary);
rootModel.addLibraryEntry(mySelectedLibrary);
}
return library;
}
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.facet.impl.ui.libraries.LibraryOptionsPanel">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="6" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="584" height="261"/>
@@ -12,20 +12,18 @@
<children>
<component id="a5b73" class="javax.swing.JRadioButton">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="207" height="22"/>
</grid>
</constraints>
<properties>
<selected value="true"/>
<selected value="false"/>
<text value="Download from &amp;Maven repository"/>
</properties>
</component>
<component id="f63e3" class="javax.swing.JRadioButton">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="207" height="22"/>
</grid>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Do &amp;not create new library"/>
@@ -33,7 +31,7 @@
</component>
<component id="46359" class="javax.swing.JRadioButton">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Pick up files from &amp;disk"/>
@@ -47,7 +45,7 @@
<properties/>
<border type="none"/>
<children>
<component id="37d09" class="javax.swing.JLabel" binding="myMessage">
<component id="37d09" class="javax.swing.JLabel" binding="myMessageLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
@@ -71,36 +69,46 @@
</component>
</children>
</grid>
<grid id="20f07" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="5" left="0" bottom="0" right="0"/>
<vspacer id="79970">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<grid id="71da4" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="6efe3" class="javax.swing.JLabel" binding="myExistingLibrariesLabel">
<component id="4dbad" class="javax.swing.JRadioButton" binding="myUseExistingLibraryRadioButton">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Use suitable e&amp;xisting libraries:"/>
<selected value="true"/>
<text value="&amp;Use existing library"/>
</properties>
</component>
<grid id="d793e" binding="myExistingLibrariesPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<component id="6d530" class="javax.swing.JComboBox" binding="myExistingLibraryComboBox">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</grid>
</component>
<hspacer id="a5d26">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</children>
</grid>
<buttonGroups>
<group name="myButtonGroup" bound="true">
<member id="4dbad"/>
<member id="a5b73"/>
<member id="46359"/>
<member id="f63e3"/>
@@ -17,17 +17,20 @@ package com.intellij.facet.impl.ui.libraries;
import com.intellij.facet.ui.libraries.LibraryInfo;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.util.ElementsChooser;
import com.intellij.openapi.fileChooser.FileChooser;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.ui.configuration.LibrariesAlphaComparator;
import com.intellij.openapi.roots.ui.configuration.ProjectStructureDialogCellAppearanceUtils;
import com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor;
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.ColoredListCellRenderer;
import com.intellij.ui.SortedComboBoxModel;
import com.intellij.util.PathUtil;
import com.intellij.util.ui.RadioButtonEnumModel;
import org.jetbrains.annotations.Nullable;
@@ -35,6 +38,7 @@ import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
@@ -43,20 +47,19 @@ import java.util.List;
* @author Dmitry Avdeev
*/
public class LibraryOptionsPanel {
private JLabel myMessage;
private JLabel myMessageLabel;
private JPanel myPanel;
private JButton myConfigureButton;
private JPanel myExistingLibrariesPanel;
private JLabel myExistingLibrariesLabel;
private JComboBox myExistingLibraryComboBox;
private JRadioButton myUseExistingLibraryRadioButton;
private ButtonGroup myButtonGroup;
private ElementsChooser<Library> myLibrariesChooser;
private LibraryCompositionSettings mySettings;
private LibrariesContainer myLibrariesContainer;
private List<Library> myLibraries;
private enum Choice {
USE_EXISTING,
DOWNLOAD,
PICK_FILES,
DO_NOT_CREATE
@@ -65,19 +68,9 @@ public class LibraryOptionsPanel {
private RadioButtonEnumModel<Choice> myButtonEnumModel;
public LibraryOptionsPanel(LibraryCompositionSettings settings, LibrariesContainer librariesContainer) {
mySettings = settings;
myLibrariesContainer = librariesContainer;
List<Library> suitableLibraries = calculateSuitableLibraries();
if (!suitableLibraries.isEmpty()) {
mySettings.setUsedLibraries(suitableLibraries);
}
myLibrariesChooser = new ChooseLibrariesDialog.LibraryElementChooser(suitableLibraries);
myLibrariesChooser.getComponents()[0].setPreferredSize(new Dimension(10, 10)); // this makes scrollbars to work
myExistingLibrariesPanel.add(myLibrariesChooser);
myExistingLibrariesLabel.setLabelFor(myLibrariesChooser.getComponent());
myLibraries = calculateSuitableLibraries();
myButtonEnumModel = RadioButtonEnumModel.bindEnum(Choice.class, myButtonGroup);
myButtonEnumModel.addActionListener(new ActionListener() {
@@ -87,11 +80,30 @@ public class LibraryOptionsPanel {
}
});
final boolean librariesFound = !myLibraries.isEmpty();
myUseExistingLibraryRadioButton.setVisible(librariesFound);
myExistingLibraryComboBox.setVisible(librariesFound);
if (librariesFound) {
final SortedComboBoxModel<Library> model = new SortedComboBoxModel<Library>(LibrariesAlphaComparator.INSTANCE);
model.addAll(myLibraries);
myExistingLibraryComboBox.setModel(model);
myExistingLibraryComboBox.setSelectedIndex(0);
myExistingLibraryComboBox.setRenderer(new ColoredListCellRenderer() {
@Override
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof Library) {
ProjectStructureDialogCellAppearanceUtils.forLibrary((Library)value, null).customize(this);
}
}
});
}
myButtonEnumModel.setSelected(librariesFound ? Choice.USE_EXISTING : Choice.DOWNLOAD);
myConfigureButton.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
switch (myButtonEnumModel.getSelected()) {
case DOWNLOAD:
showDialog(new DownloadingOptionsDialog(myConfigureButton, mySettings));
new DownloadingOptionsDialog(myConfigureButton, mySettings).show();
break;
case PICK_FILES:
if (mySettings.getLibraryEditor() == null) {
@@ -99,9 +111,9 @@ public class LibraryOptionsPanel {
mySettings.addFilesToLibrary(files, OrderRootType.CLASSES);
}
EditLibraryDialog dialog = new EditLibraryDialog(myConfigureButton, mySettings);
showDialog(dialog);
dialog.show();
break;
case DO_NOT_CREATE:
default:
break;
}
updateState();
@@ -111,18 +123,6 @@ public class LibraryOptionsPanel {
updateState();
}
private void showDialog(final DialogWrapper dialog) {
dialog.setInitialLocationCallback(new Computable<Point>() {
@Override
public Point compute() {
Point point = myConfigureButton.getLocationOnScreen();
point.translate(- 50, - dialog.getSize().height - 20);
return point;
}
});
dialog.show();
}
private List<Library> calculateSuitableLibraries() {
LibraryInfo[] libraryInfos = mySettings.getLibraryInfos();
RequiredLibrariesInfo requiredLibraries = new RequiredLibrariesInfo(libraryInfos);
@@ -131,7 +131,7 @@ public class LibraryOptionsPanel {
for (Library library : libraries) {
RequiredLibrariesInfo.RequiredClassesNotFoundInfo info =
requiredLibraries.checkLibraries(myLibrariesContainer.getLibraryFiles(library, OrderRootType.CLASSES), false);
if (info == null || info.getLibraryInfos().length < libraryInfos.length) {
if (info == null) {
suitableLibraries.add(library);
}
}
@@ -157,17 +157,23 @@ public class LibraryOptionsPanel {
}
private void updateState() {
if (myMessage.isEnabled()) {
myMessage.setForeground(Color.black);
}
myConfigureButton.setEnabled(true);
myMessageLabel.setForeground(Color.black);
myMessageLabel.setVisible(true);
myConfigureButton.setVisible(true);
String message = "";
switch (myButtonEnumModel.getSelected()) {
case DOWNLOAD:
String path = mySettings.getDirectoryForDownloadedLibrariesPath()
.substring(mySettings.getBaseDirectoryForDownloadedFiles().length());
final String downloadPath = mySettings.getDirectoryForDownloadedLibrariesPath();
final String basePath = mySettings.getBaseDirectoryForDownloadedFiles();
String path;
if (FileUtil.startsWith(downloadPath, basePath)) {
path = FileUtil.getRelativePath(basePath, downloadPath, File.separatorChar);
}
else {
path = PathUtil.getFileName(downloadPath);
}
message = MessageFormat.format("{0} jar(s) will be downloaded into <b>{1}</b> directory <br>" +
"{2} library <b>{3}</b> will be created",
mySettings.getLibraryInfos().length,
@@ -178,7 +184,7 @@ public class LibraryOptionsPanel {
case PICK_FILES:
NewLibraryEditor libraryEditor = mySettings.getLibraryEditor();
if (libraryEditor == null) {
myMessage.setForeground(Color.red);
myMessageLabel.setForeground(Color.red);
message = "Press Configure button to add classes to the library";
}
else {
@@ -189,13 +195,12 @@ public class LibraryOptionsPanel {
libraryEditor.getFiles(OrderRootType.CLASSES).length);
}
break;
case DO_NOT_CREATE:
message = "No new library will be created";
myConfigureButton.setEnabled(false);
break;
default:
myMessageLabel.setVisible(false);
myConfigureButton.setVisible(false);
}
myMessage.setText("<html>" + message + "</html>");
myMessageLabel.setText("<html>" + message + "</html>");
}
public LibraryCompositionSettings getSettings() {
@@ -204,7 +209,7 @@ public class LibraryOptionsPanel {
public void apply() {
mySettings.setUsedLibraries(myLibrariesChooser.getMarkedElements());
mySettings.setSelectedExistingLibrary((Library)myExistingLibraryComboBox.getSelectedItem());
mySettings.setDownloadLibraries(myButtonEnumModel.getSelected() == Choice.DOWNLOAD);
}
@@ -1,36 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.openapi.updateSettings.impl.NoUpdatesDialog.NoUpdatesPanel">
<grid id="18751" binding="myPanel" layout-manager="GridBagLayout">
<grid id="18751" binding="myPanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="63" y="44" width="484" height="155"/>
<xy x="63" y="44" width="400" height="149"/>
</constraints>
<properties/>
<border type="etched"/>
<children>
<component id="bc72e" class="javax.swing.JEditorPane" binding="myEditorPane">
<constraints>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false">
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="2" hsize-policy="2" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="150" height="50"/>
</grid>
<gridbag weightx="1.0" weighty="0.0"/>
</constraints>
<properties>
<contentType value="text/html"/>
<text value="&lt;html&gt;&#13;&#10; &lt;head&gt;&#13;&#10;&#13;&#10; &lt;/head&gt;&#13;&#10; &lt;body&gt;&#13;&#10; &lt;p style=&quot;margin-top: 0&quot;&gt;&#13;&#10; &#13;&#10; &lt;/p&gt;&#13;&#10; &lt;/body&gt;&#13;&#10;&lt;/html&gt;&#13;&#10;"/>
<text value="&lt;html&gt;&#13;&#10; &lt;head&gt;&#13;&#10; &#13;&#10; &lt;/head&gt;&#13;&#10; &lt;body&gt;&#13;&#10; &lt;/body&gt;&#13;&#10;&lt;/html&gt;&#13;&#10;"/>
</properties>
</component>
<grid id="71b5" binding="myWholePluginsPanel" layout-manager="GridBagLayout">
<grid id="71b5" binding="myWholePluginsPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="2" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="1.0"/>
<grid row="0" column="0" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<scrollpane class="com.intellij.ui.components.JBScrollPane" id="e1105">
<scrollpane id="e1105" class="com.intellij.ui.components.JBScrollPane">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag weightx="1.0" weighty="1.0"/>
</constraints>
<properties/>
<border type="none"/>
@@ -45,25 +44,17 @@
</scrollpane>
<component id="6b492" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="10" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="1.0" weighty="0.0"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&lt;html&gt;&lt;b&gt;Plugins from configured hosts ready to update.&lt;/b&gt;&lt;br&gt; Uncheck plugins you do not want to update. &lt;/html&gt;"/>
</properties>
</component>
<vspacer id="88098">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
</vspacer>
</children>
</grid>
<component id="42774" class="javax.swing.JLabel" binding="myNothingFoundToUpdateLabel">
<component id="8b5e0" class="javax.swing.JLabel" binding="myNothingFoundToUpdateLabel">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="11" use-parent-layout="false"/>
<gridbag top="0" left="5" bottom="0" right="0" weightx="1.0" weighty="0.0"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&lt;html&gt;&lt;b&gt;Nothing found to update&lt;/b&gt;&lt;/html&gt;"/>
@@ -18,26 +18,33 @@ package org.jetbrains.idea.maven.dom.generate;
import com.intellij.openapi.editor.Editor;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.util.xml.ui.actions.generate.GenerateDomElementAction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.maven.dom.MavenDomBundle;
import org.jetbrains.idea.maven.dom.model.MavenDomDependency;
import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel;
import org.jetbrains.idea.maven.indices.MavenArtifactSearchDialog;
import org.jetbrains.idea.maven.model.MavenId;
import org.jetbrains.idea.maven.project.MavenProject;
import org.jetbrains.idea.maven.project.MavenProjectsManager;
import org.jetbrains.idea.maven.utils.MavenIcons;
public class GenerateDependencyAction extends GenerateDomElementAction {
public GenerateDependencyAction() {
super(new MavenGenerateProvider<MavenDomDependency>(MavenDomBundle.message("generate.dependency"), MavenDomDependency.class) {
@Nullable
@Override
protected MavenDomDependency doGenerate(MavenDomProjectModel mavenModel, Editor editor) {
protected MavenDomDependency doGenerate(@NotNull MavenDomProjectModel mavenModel, Editor editor) {
MavenProjectsManager manager = MavenProjectsManager.getInstance(editor.getProject());
MavenProject project = manager.findProject(mavenModel.getModule());
if (project == null) return null;
MavenId id = MavenArtifactSearchDialog.searchForArtifact(editor.getProject());
if (id == null) return null;
PsiDocumentManager.getInstance(mavenModel.getManager().getProject()).commitAllDocuments();
MavenProjectsManager manager = MavenProjectsManager.getInstance(editor.getProject());
return manager.addDependency(manager.findProject(mavenModel.getModule()), id);
return manager.addDependency(project, id);
}
}, MavenIcons.DEPENDENCY_ICON);
}
@@ -50,7 +50,7 @@ public class GenerateManagedDependencyAction extends GenerateDomElementAction {
}
@Override
protected MavenDomDependency doGenerate(final MavenDomProjectModel mavenModel, final Editor editor) {
protected MavenDomDependency doGenerate(@NotNull final MavenDomProjectModel mavenModel, final Editor editor) {
Set<MavenDomDependency> managingDependencies = collectManagingDependencies(mavenModel);
List<MavenDomDependency> dependenciesToOverride =
@@ -20,6 +20,7 @@ import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.editor.Editor;
import com.intellij.util.xml.DomUtil;
import com.intellij.util.xml.ui.actions.generate.GenerateDomElementAction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.maven.dom.MavenDomBundle;
import org.jetbrains.idea.maven.dom.MavenDomUtil;
import org.jetbrains.idea.maven.dom.model.MavenDomParent;
@@ -31,7 +32,7 @@ import org.jetbrains.idea.maven.utils.MavenIcons;
public class GenerateParentAction extends GenerateDomElementAction {
public GenerateParentAction() {
super(new MavenGenerateProvider<MavenDomParent>(MavenDomBundle.message("generate.parent"), MavenDomParent.class) {
protected MavenDomParent doGenerate(final MavenDomProjectModel mavenModel, Editor editor) {
protected MavenDomParent doGenerate(@NotNull final MavenDomProjectModel mavenModel, Editor editor) {
SelectMavenProjectDialog d = new SelectMavenProjectDialog(editor.getProject(), null);
d.show();
if (!d.isOK()) return null;
@@ -37,10 +37,12 @@ public abstract class MavenGenerateProvider<ELEMENT_TYPE extends DomElement> ext
@Override
public ELEMENT_TYPE generate(@Nullable DomElement parent, Editor editor) {
if (parent == null) return null;
return doGenerate((MavenDomProjectModel)parent, editor);
}
protected abstract ELEMENT_TYPE doGenerate(MavenDomProjectModel mavenModel, Editor editor);
@Nullable
protected abstract ELEMENT_TYPE doGenerate(@NotNull MavenDomProjectModel mavenModel, Editor editor);
@Override
public boolean isAvailableForElement(@NotNull DomElement el) {
@@ -49,14 +49,16 @@ public class AddMavenDependencyQuickFix implements IntentionAction, LowPriorityA
}
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
return MavenDomUtil.findContainingMavenizedModule(file) != null;
return MavenDomUtil.findContainingProject(file) != null;
}
public void invoke(@NotNull final Project project, Editor editor, final PsiFile file) throws IncorrectOperationException {
MavenProject mavenProject = MavenDomUtil.findContainingProject(file);
if (mavenProject == null) return;
MavenId dependency = MavenArtifactSearchDialog.searchForClass(project, getReferenceText());
if (dependency == null) return;
MavenProject mavenProject = MavenProjectsManager.getInstance(project).findProject(MavenDomUtil.findContainingMavenizedModule(file));
MavenProjectsManager.getInstance(project).addDependency(mavenProject, dependency);
}
@@ -20,6 +20,7 @@ import com.intellij.openapi.util.Key;
import com.intellij.util.Function;
import com.intellij.util.containers.SoftValueHashMap;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.maven.facade.MavenEmbedderWrapper;
import org.jetbrains.idea.maven.facade.MavenFacadeManager;
import org.jetbrains.idea.maven.utils.MavenLog;
@@ -58,6 +59,7 @@ public class MavenEmbeddersManager {
myEmbeddersToClear.addAll(myEmbeddersInUse);
}
@NotNull
public synchronized MavenEmbedderWrapper getEmbedder(Key kind) {
MavenEmbedderWrapper result = myPool.get(kind);
if (result == null) {
@@ -74,7 +76,7 @@ public class MavenEmbeddersManager {
return result;
}
public synchronized void release(MavenEmbedderWrapper embedder) {
public synchronized void release(@NotNull MavenEmbedderWrapper embedder) {
if (!myEmbeddersInUse.contains(embedder)) {
embedder.release();
myEmbeddersToClear.remove(embedder);
@@ -455,33 +455,36 @@ public class MavenProjectsManager extends SimpleProjectComponent
}
}
public void addManagedFiles(List<VirtualFile> files) {
public void addManagedFiles(@NotNull List<VirtualFile> files) {
addManagedFilesWithProfiles(files, Collections.<String>emptyList());
}
public void removeManagedFiles(List<VirtualFile> files) {
public void removeManagedFiles(@NotNull List<VirtualFile> files) {
myWatcher.removeManagedFiles(files);
}
public boolean isManagedFile(VirtualFile f) {
public boolean isManagedFile(@NotNull VirtualFile f) {
if (!isInitialized()) return false;
return myProjectsTree.isManagedFile(f);
}
@NotNull
public Collection<String> getExplicitProfiles() {
if (!isInitialized()) return Collections.emptyList();
return myProjectsTree.getExplicitProfiles();
}
public void setExplicitProfiles(Collection<String> profiles) {
public void setExplicitProfiles(@NotNull Collection<String> profiles) {
myWatcher.setExplicitProfiles(profiles);
}
@NotNull
public Collection<String> getAvailableProfiles() {
if (!isInitialized()) return Collections.emptyList();
return myProjectsTree.getAvailableProfiles();
}
@NotNull
public Collection<Pair<String, MavenProfileKind>> getProfilesWithStates() {
if (!isInitialized()) return Collections.emptyList();
return myProjectsTree.getProfilesWithStates();
@@ -492,37 +495,44 @@ public class MavenProjectsManager extends SimpleProjectComponent
return myProjectsTree.hasProjects();
}
@NotNull
public List<MavenProject> getProjects() {
if (!isInitialized()) return Collections.emptyList();
return myProjectsTree.getProjects();
}
@NotNull
public List<MavenProject> getNonIgnoredProjects() {
if (!isInitialized()) return Collections.emptyList();
return myProjectsTree.getNonIgnoredProjects();
}
@NotNull
public List<VirtualFile> getProjectsFiles() {
if (!isInitialized()) return Collections.emptyList();
return myProjectsTree.getProjectsFiles();
}
public MavenProject findProject(VirtualFile f) {
@Nullable
public MavenProject findProject(@NotNull VirtualFile f) {
if (!isInitialized()) return null;
return myProjectsTree.findProject(f);
}
public MavenProject findProject(MavenId id) {
@Nullable
public MavenProject findProject(@NotNull MavenId id) {
if (!isInitialized()) return null;
return myProjectsTree.findProject(id);
}
public MavenProject findProject(MavenArtifact artifact) {
@Nullable
public MavenProject findProject(@NotNull MavenArtifact artifact) {
if (!isInitialized()) return null;
return myProjectsTree.findProject(artifact);
}
public MavenProject findProject(Module module) {
@Nullable
public MavenProject findProject(@NotNull Module module) {
VirtualFile f = findPomFile(module, new MavenModelsProvider() {
public Module[] getModules() {
throw new UnsupportedOperationException();
@@ -536,7 +546,7 @@ public class MavenProjectsManager extends SimpleProjectComponent
}
@Nullable
public Module findModule(MavenProject project) {
public Module findModule(@NotNull MavenProject project) {
if (!isInitialized()) return null;
return ProjectRootManager.getInstance(myProject).getFileIndex().getModuleForFile(project.getFile());
}
@@ -547,13 +557,15 @@ public class MavenProjectsManager extends SimpleProjectComponent
return myProjectsTree.findInheritors(parent);
}
public MavenProject findContainingProject(VirtualFile file) {
@Nullable
public MavenProject findContainingProject(@NotNull VirtualFile file) {
if (!isInitialized()) return null;
Module module = ProjectRootManager.getInstance(myProject).getFileIndex().getModuleForFile(file);
return module == null ? null : findProject(module);
}
private static VirtualFile findPomFile(Module module, MavenModelsProvider modelsProvider) {
@Nullable
private static VirtualFile findPomFile(@NotNull Module module, @NotNull MavenModelsProvider modelsProvider) {
for (VirtualFile root : modelsProvider.getContentRoots(module)) {
final VirtualFile virtualFile = root.findChild(MavenConstants.POM_XML);
if (virtualFile != null) {
@@ -563,47 +575,51 @@ public class MavenProjectsManager extends SimpleProjectComponent
return null;
}
public MavenProject findAggregator(MavenProject module) {
@Nullable
public MavenProject findAggregator(@NotNull MavenProject module) {
if (!isInitialized()) return null;
return myProjectsTree.findAggregator(module);
}
public List<MavenProject> getModules(MavenProject aggregator) {
@NotNull
public List<MavenProject> getModules(@NotNull MavenProject aggregator) {
if (!isInitialized()) return Collections.emptyList();
return myProjectsTree.getModules(aggregator);
}
@NotNull
public List<String> getIgnoredFilesPaths() {
if (!isInitialized()) return Collections.emptyList();
return myProjectsTree.getIgnoredFilesPaths();
}
public void setIgnoredFilesPaths(List<String> paths) {
public void setIgnoredFilesPaths(@NotNull List<String> paths) {
if (!isInitialized()) return;
myProjectsTree.setIgnoredFilesPaths(paths);
}
public boolean getIgnoredState(MavenProject project) {
public boolean getIgnoredState(@NotNull MavenProject project) {
if (!isInitialized()) return false;
return myProjectsTree.getIgnoredState(project);
}
public void setIgnoredState(List<MavenProject> projects, boolean ignored) {
public void setIgnoredState(@NotNull List<MavenProject> projects, boolean ignored) {
if (!isInitialized()) return;
myProjectsTree.setIgnoredState(projects, ignored);
}
@NotNull
public List<String> getIgnoredFilesPatterns() {
if (!isInitialized()) return Collections.emptyList();
return myProjectsTree.getIgnoredFilesPatterns();
}
public void setIgnoredFilesPatterns(List<String> patterns) {
public void setIgnoredFilesPatterns(@NotNull List<String> patterns) {
if (!isInitialized()) return;
myProjectsTree.setIgnoredFilesPatterns(patterns);
}
public boolean isIgnored(MavenProject project) {
public boolean isIgnored(@NotNull MavenProject project) {
if (!isInitialized()) return false;
return myProjectsTree.isIgnored(project);
}
@@ -627,7 +643,7 @@ public class MavenProjectsManager extends SimpleProjectComponent
doScheduleUpdateProjects(null, false, forceImport);
}
public void forceUpdateProjects(Collection<MavenProject> projects) {
public void forceUpdateProjects(@NotNull Collection<MavenProject> projects) {
doScheduleUpdateProjects(projects, true, true);
}
@@ -945,8 +961,9 @@ public class MavenProjectsManager extends SimpleProjectComponent
VirtualFileManager.getInstance().refresh(isNormalProject());
if (postTasks.get() != null /*may be null if importing is cancelled*/)
if (postTasks.get() != null /*may be null if importing is cancelled*/) {
schedulePostImportTasks(postTasks.get());
}
// do not block user too often
myImportingQueue.restartTimer();
@@ -972,16 +989,13 @@ public class MavenProjectsManager extends SimpleProjectComponent
return result;
}
public MavenDomDependency addOverridenDependency(final MavenProject mavenProject, final MavenId id) {
return addDependency(mavenProject, id, true);
}
public MavenDomDependency addDependency(final MavenProject mavenProject, final MavenId id) {
public MavenDomDependency addDependency(@NotNull MavenProject mavenProject, @NotNull MavenId id) {
return addDependency(mavenProject, id, false);
}
public MavenDomDependency addDependency(final MavenProject mavenProject, final MavenId id, final boolean overridden) {
public MavenDomDependency addDependency(@NotNull final MavenProject mavenProject,
@NotNull final MavenId id,
final boolean overridden) {
final MavenArtifact[] artifact = new MavenArtifact[1];
try {
@@ -1019,7 +1033,7 @@ public class MavenProjectsManager extends SimpleProjectComponent
return FileEditorManager.getInstance(myProject).getSelectedTextEditor();
}
public void addManagerListener(Listener listener) {
public void addManagerListener(Listener listener) {
myManagerListeners.add(listener);
}
@@ -30,6 +30,7 @@ import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.Stack;
import gnu.trove.THashMap;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import org.jetbrains.idea.maven.facade.MavenEmbedderWrapper;
@@ -981,12 +982,12 @@ public class MavenProjectsTree {
return result;
}
public void resolve(MavenProject mavenProject,
MavenGeneralSettings generalSettings,
MavenEmbeddersManager embeddersManager,
MavenConsole console,
MavenProgressIndicator process,
Object message) throws MavenProcessCanceledException {
public void resolve(@NotNull MavenProject mavenProject,
@NotNull MavenGeneralSettings generalSettings,
@NotNull MavenEmbeddersManager embeddersManager,
@NotNull MavenConsole console,
@NotNull MavenProgressIndicator process,
@Nullable Object message) throws MavenProcessCanceledException {
MavenEmbedderWrapper embedder = embeddersManager.getEmbedder(MavenEmbeddersManager.FOR_DEPENDENCIES_RESOLVE);
embedder.customizeForResolve(getProjectIdToFileMapping(), console, process);
@@ -1006,11 +1007,11 @@ public class MavenProjectsTree {
}
}
public void resolvePlugins(MavenProject mavenProject,
NativeMavenProjectHolder nativeMavenProject,
MavenEmbeddersManager embeddersManager,
MavenConsole console,
MavenProgressIndicator process) throws MavenProcessCanceledException {
public void resolvePlugins(@NotNull MavenProject mavenProject,
@NotNull NativeMavenProjectHolder nativeMavenProject,
@NotNull MavenEmbeddersManager embeddersManager,
@NotNull MavenConsole console,
@NotNull MavenProgressIndicator process) throws MavenProcessCanceledException {
MavenEmbedderWrapper embedder = embeddersManager.getEmbedder(MavenEmbeddersManager.FOR_PLUGINS_RESOLVE);
embedder.customizeForResolve(console, process);
embedder.clearCachesFor(mavenProject.getMavenId());
@@ -1029,12 +1030,12 @@ public class MavenProjectsTree {
}
}
public void resolveFolders(final MavenProject mavenProject,
final MavenImportingSettings importingSettings,
final MavenEmbeddersManager embeddersManager,
final MavenConsole console,
final MavenProgressIndicator process,
final Object message) throws MavenProcessCanceledException {
public void resolveFolders(@NotNull final MavenProject mavenProject,
@NotNull final MavenImportingSettings importingSettings,
@NotNull final MavenEmbeddersManager embeddersManager,
@NotNull final MavenConsole console,
@NotNull final MavenProgressIndicator process,
@Nullable final Object message) throws MavenProcessCanceledException {
executeWithEmbedder(mavenProject,
embeddersManager,
MavenEmbeddersManager.FOR_FOLDERS_RESOLVE,
@@ -1060,13 +1061,13 @@ public class MavenProjectsTree {
/**
* @return list of unresolved artifacts
*/
public MavenArtifactDownloader.DownloadResult downloadArtifacts(Collection<MavenProject> projects,
public MavenArtifactDownloader.DownloadResult downloadArtifacts(@NotNull Collection<MavenProject> projects,
@Nullable Collection<MavenArtifact> artifacts,
boolean downloadSources,
boolean downloadDocs,
MavenEmbeddersManager embeddersManager,
MavenConsole console,
MavenProgressIndicator process)
@NotNull MavenEmbeddersManager embeddersManager,
@NotNull MavenConsole console,
@NotNull MavenProgressIndicator process)
throws MavenProcessCanceledException {
MavenEmbedderWrapper embedder = embeddersManager.getEmbedder(MavenEmbeddersManager.FOR_DOWNLOAD);
embedder.customizeForResolve(console, process);
@@ -1085,16 +1086,16 @@ public class MavenProjectsTree {
}
}
public static MavenArtifact downloadArtifact(MavenProject mavenProject,
MavenId id,
MavenEmbeddersManager embeddersManager,
MavenConsole console,
MavenProgressIndicator process) throws MavenProcessCanceledException {
public static MavenArtifact downloadArtifact(@NotNull MavenProject mavenProject,
@NotNull MavenId id,
@NotNull MavenEmbeddersManager embeddersManager,
@NotNull MavenConsole console,
@NotNull MavenProgressIndicator process) throws MavenProcessCanceledException {
MavenEmbedderWrapper embedder = embeddersManager.getEmbedder(MavenEmbeddersManager.FOR_DOWNLOAD);
embedder.customizeForResolve(console, process);
try {
MavenArtifact result = embedder.resolve(new MavenArtifactInfo(id, MavenConstants.TYPE_JAR, null),
MavenArtifact result = embedder.resolve(new MavenArtifactInfo(id, MavenConstants.TYPE_JAR, null),
mavenProject.getRemoteRepositories());
result.setScope(MavenConstants.SCOPE_COMPILE);
return result;
@@ -1104,12 +1105,12 @@ public class MavenProjectsTree {
}
}
public void executeWithEmbedder(MavenProject mavenProject,
MavenEmbeddersManager embeddersManager,
Key embedderKind,
MavenConsole console,
MavenProgressIndicator process,
EmbedderTask task) throws MavenProcessCanceledException {
public void executeWithEmbedder(@NotNull MavenProject mavenProject,
@NotNull MavenEmbeddersManager embeddersManager,
@NotNull Key embedderKind,
@NotNull MavenConsole console,
@NotNull MavenProgressIndicator process,
@NotNull EmbedderTask task) throws MavenProcessCanceledException {
MavenEmbedderWrapper embedder = embeddersManager.getEmbedder(embedderKind);
embedder.customizeForStrictResolve(getProjectIdToFileMapping(), console, process);
embedder.clearCachesFor(mavenProject.getMavenId());