ui fixes for groovy libraries setup

This commit is contained in:
nik
2010-10-06 10:10:04 +04:00
parent 8fe70e2cde
commit 5d1826c83a
3 changed files with 28 additions and 7 deletions
@@ -34,7 +34,7 @@
<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="71da4" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="71da4" layout-manager="GridLayoutManager" row-count="1" column-count="5" 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"/>
@@ -53,23 +53,32 @@
</component>
<component id="6d530" class="javax.swing.JComboBox" binding="myExistingLibraryComboBox">
<constraints>
<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"/>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<hspacer id="a5d26">
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="4" 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="eaf39" class="javax.swing.JButton" binding="myCreateButton" default-binding="true">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Create..."/>
</properties>
</component>
<component id="3bfa9" class="javax.swing.JLabel" binding="myUseLibraryLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Use library"/>
<visible value="false"/>
</properties>
</component>
</children>
</grid>
<grid id="7ea1" binding="myConfigurationPanel" layout-manager="CardLayout" hgap="0" vgap="0">
@@ -66,6 +66,7 @@ public class LibraryOptionsPanel {
private JButton myCreateButton;
private JRadioButton myDownloadRadioButton;
private JRadioButton myUseLibraryRadioButton;
private JLabel myUseLibraryLabel;
private ButtonGroup myButtonGroup;
private final LibraryCompositionSettings mySettings;
@@ -134,6 +135,7 @@ public class LibraryOptionsPanel {
if (!canDownload && !showDoNotCreateOption) {
myUseLibraryRadioButton.setVisible(false);
myUseLibraryLabel.setVisible(true);
}
myCreateButton.addActionListener(new ActionListener() {
@@ -16,7 +16,7 @@
package org.jetbrains.plugins.groovy.config;
import com.intellij.openapi.fileChooser.FileChooser;
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.roots.libraries.LibraryKind;
import com.intellij.openapi.roots.libraries.LibraryPresentationProvider;
import com.intellij.openapi.roots.ui.configuration.libraries.CustomLibraryDescription;
@@ -110,13 +110,23 @@ public class GroovyLibraryDescription extends CustomLibraryDescription {
initial = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(envHome));
}
final VirtualFile[] files = FileChooser.chooseFiles(parentComponent, FileChooserDescriptorFactory.createSingleFolderDescriptor(), initial);
final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, false) {
@Override
public boolean isFileSelectable(VirtualFile file) {
if (!super.isFileSelectable(file)) {
return false;
}
return findManager(file) != null;
}
};
descriptor.setTitle("Groovy SDK");
descriptor.setDescription("Choose a directory containing Groovy distribution");
final VirtualFile[] files = FileChooser.chooseFiles(parentComponent, descriptor, initial);
if (files.length != 1) return null;
final VirtualFile dir = files[0];
final GroovyLibraryPresentationProviderBase provider = findManager(dir);
if (provider == null) {
//todo[nik,peter] show error message in file chooser
return null;
}