Update UI for Configure Kotlin Dialog
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.jet.plugin.framework.ui.ChooseLibraryPathPanel">
|
||||
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="3" 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>
|
||||
<xy x="20" y="20" width="465" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<vspacer id="7a17e">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="5" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="d31a1" class="javax.swing.JRadioButton" binding="copyToRadioButton" default-binding="true">
|
||||
<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"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<borderPainted value="false"/>
|
||||
<contentAreaFilled value="true"/>
|
||||
<hideActionText value="false"/>
|
||||
<text value="&Copy to:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="258c2" binding="copyPanelPlace" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="4" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<component id="a15f" class="javax.swing.JRadioButton" binding="useFromPluginRadioButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="5" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="&Use library from plugin"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,83 @@
|
||||
package org.jetbrains.jet.plugin.framework.ui;
|
||||
|
||||
import com.intellij.util.EventDispatcher;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
|
||||
public class ChooseLibraryPathPanel {
|
||||
|
||||
private final CopyIntoPanel copyFilePanel;
|
||||
|
||||
private JPanel contentPane;
|
||||
private JRadioButton useFromPluginRadioButton;
|
||||
private JRadioButton copyToRadioButton;
|
||||
private JPanel copyPanelPlace;
|
||||
|
||||
private final EventDispatcher<ActionListener> actionDispatcher = EventDispatcher.create(ActionListener.class);
|
||||
|
||||
public ChooseLibraryPathPanel(@NotNull String defaultPath) {
|
||||
ButtonGroup modulesGroup = new ButtonGroup();
|
||||
modulesGroup.add(useFromPluginRadioButton);
|
||||
modulesGroup.add(copyToRadioButton);
|
||||
copyToRadioButton.setSelected(true);
|
||||
|
||||
ActionListener actionListener = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
actionDispatcher.getMulticaster().actionPerformed(e);
|
||||
updateComponents();
|
||||
}
|
||||
};
|
||||
|
||||
copyToRadioButton.addActionListener(actionListener);
|
||||
useFromPluginRadioButton.addActionListener(actionListener);
|
||||
|
||||
copyFilePanel = new CopyIntoPanel(null, defaultPath);
|
||||
copyFilePanel.addValidityListener(new ValidityListener() {
|
||||
@Override
|
||||
public void validityChanged(boolean isValid) {
|
||||
updateComponents();
|
||||
}
|
||||
});
|
||||
copyPanelPlace.add(copyFilePanel.getContentPane(), BorderLayout.CENTER);
|
||||
|
||||
updateComponents();
|
||||
}
|
||||
|
||||
public JComponent getContentPane() {
|
||||
return contentPane;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getPath() {
|
||||
return copyToRadioButton.isSelected() ? copyFilePanel.getPath() : null;
|
||||
}
|
||||
|
||||
public void addValidityListener(ValidityListener listener) {
|
||||
copyFilePanel.addValidityListener(listener);
|
||||
}
|
||||
|
||||
public void addActionListener(ActionListener listener) {
|
||||
actionDispatcher.addListener(listener);
|
||||
}
|
||||
|
||||
public boolean hasErrors() {
|
||||
return copyToRadioButton.isSelected() && copyFilePanel.hasErrors();
|
||||
}
|
||||
|
||||
private void updateComponents() {
|
||||
copyFilePanel.setEnabled(copyToRadioButton.isSelected());
|
||||
if (copyToRadioButton.isSelected() && copyFilePanel.hasErrors()) {
|
||||
copyToRadioButton.setForeground(Color.RED);
|
||||
}
|
||||
else {
|
||||
copyToRadioButton.setForeground(Color.BLACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.jet.plugin.framework.ui.ChooseModulePanel">
|
||||
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="3" 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>
|
||||
<xy x="20" y="20" width="465" height="400"/>
|
||||
@@ -24,15 +24,9 @@
|
||||
<model/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="93a4f" class="javax.swing.JSeparator" binding="separator">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="3" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<vspacer id="72c0e">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="3" 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="3" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="5ca07" class="javax.swing.JTextField" binding="allModulesNames">
|
||||
|
||||
@@ -35,7 +35,6 @@ public class ChooseModulePanel {
|
||||
private JRadioButton allModulesWithKtRadioButton;
|
||||
private JRadioButton singleModuleRadioButton;
|
||||
private JComboBox singleModuleComboBox;
|
||||
private JSeparator separator;
|
||||
private JTextField allModulesNames;
|
||||
|
||||
@NotNull private final Project project;
|
||||
@@ -79,15 +78,9 @@ public class ChooseModulePanel {
|
||||
modulesGroup.add(singleModuleRadioButton);
|
||||
allModulesWithKtRadioButton.setSelected(true);
|
||||
|
||||
separator.setVisible(false);
|
||||
|
||||
updateComponents();
|
||||
}
|
||||
|
||||
public void showSeparator() {
|
||||
separator.setVisible(true);
|
||||
}
|
||||
|
||||
public JComponent getContentPane() {
|
||||
return contentPane;
|
||||
}
|
||||
|
||||
-2
@@ -47,8 +47,6 @@ public class ConfigureDialogWithModulesAndVersion extends DialogWrapper {
|
||||
chooseModulePanel = new ChooseModulePanel(project, modules);
|
||||
chooseModulesPanelPlace.add(chooseModulePanel.getContentPane(), BorderLayout.CENTER);
|
||||
|
||||
chooseModulePanel.showSeparator();
|
||||
|
||||
for (String version : kotlinVersions) {
|
||||
kotlinVersionComboBox.addItem(version);
|
||||
}
|
||||
|
||||
@@ -21,11 +21,7 @@
|
||||
</vspacer>
|
||||
<component id="9d5d5" class="javax.swing.JLabel" binding="copyIntoLabel">
|
||||
<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">
|
||||
<minimum-size width="80" height="-1"/>
|
||||
<preferred-size width="80" height="-1"/>
|
||||
<maximum-size width="80" height="-1"/>
|
||||
</grid>
|
||||
<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"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="&Copy into:"/>
|
||||
|
||||
@@ -61,6 +61,9 @@ public class CopyIntoPanel {
|
||||
copyIntoLabel.setDisplayedMnemonic(mnemonicChar);
|
||||
copyIntoLabel.setDisplayedMnemonicIndex(mnemonicIndex);
|
||||
}
|
||||
else {
|
||||
copyIntoLabel.setVisible(false);
|
||||
}
|
||||
|
||||
copyIntoLabel.setLabelFor(copyIntoField.getTextField());
|
||||
copyIntoField.getTextField().setText(defaultPath);
|
||||
@@ -107,4 +110,8 @@ public class CopyIntoPanel {
|
||||
public boolean hasErrors() {
|
||||
return hasErrorsState;
|
||||
}
|
||||
|
||||
public void setLabelWight(int wight) {
|
||||
copyIntoLabel.setPreferredSize(new Dimension(wight, -1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.jet.plugin.framework.ui.CreateJavaLibraryDialogBase">
|
||||
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="5" 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="48" y="54" width="436" height="297"/>
|
||||
@@ -10,36 +10,9 @@
|
||||
<children>
|
||||
<vspacer id="bb37c">
|
||||
<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="46726" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="10" 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"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="90315" class="javax.swing.JCheckBox" binding="copyLibraryCheckbox">
|
||||
<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"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text value="&Make a local copy of the library (could be stored in VCS) "/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="e47d8" binding="copyIntoPanelPlace" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="3" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<component id="b2a7" class="javax.swing.JLabel" binding="compilerTextLabel">
|
||||
<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"/>
|
||||
@@ -56,6 +29,20 @@
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<component id="9a49" class="com.intellij.ui.SeparatorWithText" binding="modulesSeparator">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<grid id="36738" binding="chooseLibraryPathPlace" layout-manager="BorderLayout" hgap="0" vgap="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/>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<buttonGroups>
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.jet.plugin.framework.ui;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.ui.SeparatorWithText;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.plugin.JetPluginUtil;
|
||||
@@ -28,13 +29,13 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public abstract class CreateJavaLibraryDialogBase extends DialogWrapper {
|
||||
protected final CopyIntoPanel copyIntoPanel;
|
||||
|
||||
protected JPanel contentPane;
|
||||
protected JCheckBox copyLibraryCheckbox;
|
||||
protected JPanel copyIntoPanelPlace;
|
||||
protected JLabel compilerTextLabel;
|
||||
protected JPanel chooseModulesPanelPlace;
|
||||
protected SeparatorWithText modulesSeparator;
|
||||
protected JPanel chooseLibraryPathPlace;
|
||||
|
||||
protected final ChooseLibraryPathPanel pathPanel;
|
||||
|
||||
public CreateJavaLibraryDialogBase(
|
||||
@Nullable Project project,
|
||||
@@ -48,32 +49,31 @@ public abstract class CreateJavaLibraryDialogBase extends DialogWrapper {
|
||||
|
||||
compilerTextLabel.setText(compilerTextLabel.getText() + " - " + JetPluginUtil.getPluginVersion());
|
||||
|
||||
copyIntoPanel = new CopyIntoPanel(project, defaultPath);
|
||||
copyIntoPanel.addValidityListener(new ValidityListener() {
|
||||
pathPanel = new ChooseLibraryPathPanel(defaultPath);
|
||||
pathPanel.addValidityListener(new ValidityListener() {
|
||||
@Override
|
||||
public void validityChanged(boolean isValid) {
|
||||
updateComponents();
|
||||
}
|
||||
});
|
||||
|
||||
copyIntoPanelPlace.add(copyIntoPanel.getContentPane(), BorderLayout.CENTER);
|
||||
|
||||
copyLibraryCheckbox.addActionListener(new ActionListener() {
|
||||
pathPanel.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull ActionEvent e) {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updateComponents();
|
||||
}
|
||||
});
|
||||
chooseLibraryPathPlace.add(pathPanel.getContentPane(), BorderLayout.CENTER);
|
||||
|
||||
modulesSeparator.setCaption("Kotlin Java Runtime Library");
|
||||
}
|
||||
|
||||
protected void updateComponents() {
|
||||
copyIntoPanel.setEnabled(copyLibraryCheckbox.isSelected());
|
||||
setOKActionEnabled(!copyIntoPanel.hasErrors());
|
||||
setOKActionEnabled(!pathPanel.hasErrors());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getCopyIntoPath() {
|
||||
return copyLibraryCheckbox.isSelected() ? copyIntoPanel.getPath() : null;
|
||||
return pathPanel.getPath();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+1
-7
@@ -40,13 +40,7 @@ public class CreateJavaLibraryDialogWithModules extends CreateJavaLibraryDialogB
|
||||
chooseModulePanel = new ChooseModulePanel(project, modules);
|
||||
chooseModulesPanelPlace.add(chooseModulePanel.getContentPane(), BorderLayout.CENTER);
|
||||
|
||||
if (!showPathPanel) {
|
||||
copyIntoPanelPlace.setVisible(false);
|
||||
copyLibraryCheckbox.setVisible(false);
|
||||
}
|
||||
else {
|
||||
chooseModulePanel.showSeparator();
|
||||
}
|
||||
chooseLibraryPathPlace.setVisible(showPathPanel);
|
||||
|
||||
updateComponents();
|
||||
}
|
||||
|
||||
+25
-46
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.jet.plugin.framework.ui.CreateJavaScriptLibraryDialogBase">
|
||||
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="cbd77" binding="contentPane" 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="48" y="54" width="436" height="297"/>
|
||||
@@ -10,52 +10,9 @@
|
||||
<children>
|
||||
<vspacer id="bb37c">
|
||||
<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="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="46726" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="10" 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"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="90315" class="javax.swing.JCheckBox" binding="copyJarCheckbox">
|
||||
<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"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text value="&Make a local copy of the library (could be stored in VCS) "/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="11e35" binding="copyJsFilesPanelPlace" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="3" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="2bd15" binding="copyJarFilePanelPlace" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="3" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<component id="70a46" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="JavaScript runtime files"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<component id="982e8" class="javax.swing.JLabel" binding="compilerTextLabel">
|
||||
<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"/>
|
||||
@@ -64,7 +21,7 @@
|
||||
<text value="Using compiler bundled into plugin"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="beed7" binding="chooseModulesPanelPlace" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<grid id="beed7" binding="chooseModulesPlace" layout-manager="BorderLayout" hgap="0" vgap="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>
|
||||
@@ -72,6 +29,28 @@
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="486ab" binding="copyLibraryPlace" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="4" 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/>
|
||||
</grid>
|
||||
<grid id="11e35" binding="copyJsFilesPlace" layout-manager="BorderLayout" hgap="0" vgap="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/>
|
||||
</grid>
|
||||
<component id="89994" class="com.intellij.ui.SeparatorWithText" binding="modulesSeparator">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<buttonGroups>
|
||||
|
||||
+23
-27
@@ -18,6 +18,7 @@ package org.jetbrains.jet.plugin.framework.ui;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.ui.SeparatorWithText;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.plugin.JetPluginUtil;
|
||||
@@ -25,19 +26,20 @@ import org.jetbrains.jet.plugin.framework.JSLibraryCreateOptions;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public abstract class CreateJavaScriptLibraryDialogBase extends DialogWrapper implements JSLibraryCreateOptions {
|
||||
protected final CopyIntoPanel copyJsFilesPanel;
|
||||
protected final CopyIntoPanel copyJarPanel;
|
||||
protected final CopyIntoPanel copyLibraryFilePanel;
|
||||
|
||||
protected JPanel contentPane;
|
||||
protected JCheckBox copyJarCheckbox;
|
||||
protected JPanel copyJsFilesPanelPlace;
|
||||
protected JPanel copyJarFilePanelPlace;
|
||||
|
||||
protected JLabel compilerTextLabel;
|
||||
protected JPanel chooseModulesPanelPlace;
|
||||
protected JPanel chooseModulesPlace;
|
||||
|
||||
private SeparatorWithText modulesSeparator;
|
||||
|
||||
protected JPanel copyJsFilesPlace;
|
||||
protected JPanel copyLibraryPlace;
|
||||
|
||||
public CreateJavaScriptLibraryDialogBase(
|
||||
@Nullable Project project,
|
||||
@@ -54,6 +56,8 @@ public abstract class CreateJavaScriptLibraryDialogBase extends DialogWrapper im
|
||||
|
||||
compilerTextLabel.setText(compilerTextLabel.getText() + " - " + JetPluginUtil.getPluginVersion());
|
||||
|
||||
modulesSeparator.setCaption("Kotlin JavaScript Library");
|
||||
|
||||
ValidityListener validityListener = new ValidityListener() {
|
||||
@Override
|
||||
public void validityChanged(boolean isValid) {
|
||||
@@ -61,48 +65,40 @@ public abstract class CreateJavaScriptLibraryDialogBase extends DialogWrapper im
|
||||
}
|
||||
};
|
||||
|
||||
copyJsFilesPanel = new CopyIntoPanel(project, defaultPathToJsFile, "&Script directory:");
|
||||
copyJsFilesPanel = new CopyIntoPanel(project, defaultPathToJsFile, "Copy &runtime files to:");
|
||||
copyJsFilesPanel.addValidityListener(validityListener);
|
||||
copyJsFilesPanelPlace.add(copyJsFilesPanel.getContentPane(), BorderLayout.CENTER);
|
||||
copyJsFilesPanel.setLabelWight(110);
|
||||
copyJsFilesPlace.add(copyJsFilesPanel.getContentPane(), BorderLayout.CENTER);
|
||||
|
||||
copyJarPanel = new CopyIntoPanel(project, defaultPathToJar, "&Lib directory:");
|
||||
copyJarPanel.addValidityListener(validityListener);
|
||||
copyJarFilePanelPlace.add(copyJarPanel.getContentPane(), BorderLayout.CENTER);
|
||||
copyLibraryFilePanel = new CopyIntoPanel(project, defaultPathToJar, "Copy &headers to:");
|
||||
copyLibraryFilePanel.addValidityListener(validityListener);
|
||||
copyLibraryFilePanel.setLabelWight(110);
|
||||
copyLibraryPlace.add(copyLibraryFilePanel.getContentPane(), BorderLayout.CENTER);
|
||||
|
||||
if (!showPathToJarPanel) {
|
||||
copyJarFilePanelPlace.setVisible(false);
|
||||
copyJarCheckbox.setVisible(false);
|
||||
copyLibraryPlace.setVisible(false);
|
||||
}
|
||||
|
||||
if (!showPathToJsFilePanel) {
|
||||
copyJsFilesPanelPlace.setVisible(false);
|
||||
copyJsFilesPlace.setVisible(false);
|
||||
}
|
||||
|
||||
copyJarCheckbox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull ActionEvent e) {
|
||||
updateComponents();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getCopyJsIntoPath() {
|
||||
if (!copyJsFilesPanelPlace.isVisible()) return null;
|
||||
if (!copyJsFilesPlace.isVisible()) return null;
|
||||
return copyJsFilesPanel.getPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getCopyLibraryIntoPath() {
|
||||
return copyJarCheckbox.isSelected() ? copyJarPanel.getPath() : null;
|
||||
return copyLibraryFilePanel.getPath();
|
||||
}
|
||||
|
||||
protected void updateComponents() {
|
||||
copyJarPanel.setEnabled(copyJarCheckbox.isSelected());
|
||||
|
||||
setOKActionEnabled(!copyJsFilesPanel.hasErrors() && !copyJarPanel.hasErrors());
|
||||
setOKActionEnabled(!copyJsFilesPanel.hasErrors() && !copyLibraryFilePanel.hasErrors());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+1
-5
@@ -39,11 +39,7 @@ public class CreateJavaScriptLibraryDialogWithModules extends CreateJavaScriptLi
|
||||
super(project, defaultPathToJar, defaultPathToJsFile, showPathToJarPanel, showPathToJsFilePanel);
|
||||
|
||||
chooseModulePanel = new ChooseModulePanel(project, modules);
|
||||
chooseModulesPanelPlace.add(chooseModulePanel.getContentPane(), BorderLayout.CENTER);
|
||||
|
||||
if (showPathToJarPanel || showPathToJsFilePanel) {
|
||||
chooseModulePanel.showSeparator();
|
||||
}
|
||||
chooseModulesPlace.add(chooseModulePanel.getContentPane(), BorderLayout.CENTER);
|
||||
|
||||
updateComponents();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user