project configuration: improve 'Convert to Repository Library' action

Allow excluding transitive dependencies when searching for a library in repositories, before the library files are downloaded and compared with the existing files.
This commit is contained in:
nik
2017-11-27 12:52:47 +03:00
parent 76f8a354e0
commit 827b8594b2
3 changed files with 32 additions and 5 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.jarRepository.RepositoryAttachDialog">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="5" 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>
<xy x="20" y="20" width="500" height="400"/>
@@ -10,7 +10,7 @@
<children>
<vspacer id="ab1b5">
<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="4" 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="c48e0" layout-manager="GridLayoutManager" row-count="2" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
@@ -121,6 +121,30 @@
</component>
</children>
</grid>
<grid id="60a4a" binding="mySearchOptionsPanel" 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="3" 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>
<hspacer id="b701b">
<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>
<component id="71194" class="com.intellij.ui.components.JBCheckBox" binding="myIncludeTransitiveDependenciesForSearchCheckBox">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="true"/>
<text value="Include &amp;transitive dependencies"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</form>
@@ -91,6 +91,8 @@ public class RepositoryAttachDialog extends DialogWrapper {
private JBLabel myCaptionLabel;
private JPanel myDownloadOptionsPanel;
private JBCheckBox myIncludeTransitiveDepsCheckBox;
private JPanel mySearchOptionsPanel;
private JBCheckBox myIncludeTransitiveDependenciesForSearchCheckBox;
private final JComboBox myCombobox;
@@ -182,6 +184,7 @@ public class RepositoryAttachDialog extends DialogWrapper {
descriptor);
updateInfoLabel();
myDownloadOptionsPanel.setVisible(mode == Mode.DOWNLOAD);
mySearchOptionsPanel.setVisible(mode == Mode.SEARCH);
init();
}
@@ -218,7 +221,7 @@ public class RepositoryAttachDialog extends DialogWrapper {
}
public boolean getIncludeTransitiveDependencies() {
return myIncludeTransitiveDepsCheckBox.isSelected();
return myMode == Mode.DOWNLOAD ? myIncludeTransitiveDepsCheckBox.isSelected() : myIncludeTransitiveDependenciesForSearchCheckBox.isSelected();
}
@Nullable
@@ -79,7 +79,7 @@ abstract class ConvertToRepositoryLibraryActionBase(protected val context: Struc
private fun downloadLibraryAndReplace(library: LibraryEx,
mavenCoordinates: JpsMavenRepositoryLibraryDescriptor) {
val libraryProperties = RepositoryLibraryProperties(mavenCoordinates.groupId, mavenCoordinates.artifactId, mavenCoordinates.version)
val libraryProperties = RepositoryLibraryProperties(mavenCoordinates.groupId, mavenCoordinates.artifactId, mavenCoordinates.version, mavenCoordinates.isIncludeTransitiveDependencies)
val hasSources = RepositoryUtils.libraryHasSources(library)
val hasJavadoc = RepositoryUtils.libraryHasJavaDocs(library)
LOG.debug("Resolving $mavenCoordinates")
@@ -150,7 +150,7 @@ abstract class ConvertToRepositoryLibraryActionBase(protected val context: Struc
return null
}
return JpsMavenRepositoryLibraryDescriptor(dialog.coordinateText)
return JpsMavenRepositoryLibraryDescriptor(dialog.coordinateText, dialog.includeTransitiveDependencies)
}
private fun replaceByLibrary(library: Library, configuration: NewLibraryConfiguration) {