mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
BuildFilePropertiesPanel. Toolbar decorator and some fixes.
This commit is contained in:
+9
-26
@@ -1,18 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.lang.ant.config.impl.configuration.AntClasspathEditorPanel$Form">
|
||||
<grid id="e8f1e" binding="myWholePanel" row-count="7" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="e8f1e" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="6" 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="76" y="46" width="433" height="265"/>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="3fa57" class="javax.swing.JButton" binding="myAddButton">
|
||||
<constraints>
|
||||
<xy x="306" y="25" width="127" height="25"/>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1"/>
|
||||
<grid row="0" column="1" 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 resource-bundle="messages/AntBundle" key="button.add"/>
|
||||
@@ -20,8 +18,7 @@
|
||||
</component>
|
||||
<component id="f3cd" class="javax.swing.JButton" binding="myRemoveButton">
|
||||
<constraints>
|
||||
<xy x="306" y="85" width="127" height="25"/>
|
||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1"/>
|
||||
<grid row="2" column="1" 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 resource-bundle="messages/AntBundle" key="button.remove"/>
|
||||
@@ -29,8 +26,7 @@
|
||||
</component>
|
||||
<component id="4c683" class="javax.swing.JButton" binding="myMoveUpButton">
|
||||
<constraints>
|
||||
<xy x="306" y="115" width="127" height="25"/>
|
||||
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1"/>
|
||||
<grid row="3" column="1" 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 resource-bundle="messages/AntBundle" key="button.move.up"/>
|
||||
@@ -38,8 +34,7 @@
|
||||
</component>
|
||||
<component id="57625" class="javax.swing.JButton" binding="myMoveDownButton">
|
||||
<constraints>
|
||||
<xy x="306" y="145" width="127" height="25"/>
|
||||
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1"/>
|
||||
<grid row="4" column="1" 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 resource-bundle="messages/AntBundle" key="button.move.down"/>
|
||||
@@ -47,14 +42,12 @@
|
||||
</component>
|
||||
<vspacer id="585ab">
|
||||
<constraints>
|
||||
<xy x="364" y="170" width="11" height="95"/>
|
||||
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2"/>
|
||||
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<scrollpane class="com.intellij.ui.components.JBScrollPane" id="50e51">
|
||||
<scrollpane id="50e51" class="com.intellij.ui.components.JBScrollPane">
|
||||
<constraints>
|
||||
<xy x="0" y="25" width="296" height="240"/>
|
||||
<grid row="1" column="0" row-span="6" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3"/>
|
||||
<grid row="0" column="0" row-span="6" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -65,19 +58,9 @@
|
||||
</component>
|
||||
</children>
|
||||
</scrollpane>
|
||||
<component id="ef36" class="javax.swing.JLabel" binding="myClasspathLabel">
|
||||
<constraints>
|
||||
<xy x="0" y="3" width="124" height="14"/>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="<#############>"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="84aa7" class="javax.swing.JButton" binding="myAddAllInDir">
|
||||
<constraints>
|
||||
<xy x="306" y="55" width="127" height="25"/>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1"/>
|
||||
<grid row="1" column="1" 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 resource-bundle="messages/AntBundle" key="additional.classpath.tab.add.all.in.directory.button"/>
|
||||
|
||||
+1
-12
@@ -18,7 +18,6 @@ package com.intellij.lang.ant.config.impl.configuration;
|
||||
import com.intellij.lang.ant.config.impl.AllJarsUnderDirEntry;
|
||||
import com.intellij.lang.ant.config.impl.AntClasspathEntry;
|
||||
import com.intellij.lang.ant.config.impl.SinglePathEntry;
|
||||
import com.intellij.openapi.ui.LabeledComponent;
|
||||
import com.intellij.ui.ListUtil;
|
||||
import com.intellij.util.config.AbstractProperty;
|
||||
import com.intellij.util.config.ListProperty;
|
||||
@@ -68,19 +67,17 @@ public class AntClasspathEditorPanel extends JPanel {
|
||||
return myBinding;
|
||||
}
|
||||
|
||||
private static class Form {
|
||||
public static class Form {
|
||||
private JButton myAddButton;
|
||||
private JButton myAddAllInDir;
|
||||
private JButton myRemoveButton;
|
||||
private JButton myMoveUpButton;
|
||||
private JButton myMoveDownButton;
|
||||
private JPanel myWholePanel;
|
||||
private JLabel myClasspathLabel;
|
||||
private JList myClasspathList;
|
||||
private final ArrayList<ListUtil.Updatable> myUpdatables = new ArrayList<ListUtil.Updatable>();
|
||||
|
||||
public Form() {
|
||||
myClasspathLabel.setLabelFor(myClasspathList);
|
||||
myClasspathList.setCellRenderer(new AntUIUtil.ClasspathRenderer());
|
||||
|
||||
myUpdatables.add(ListUtil.addRemoveListener(myRemoveButton, myClasspathList));
|
||||
@@ -96,14 +93,6 @@ public class AntClasspathEditorPanel extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
public void setClasspathLabel(String textWithMnemonic) {
|
||||
LabeledComponent.TextWithMnemonic.fromTextWithMnemonic(textWithMnemonic).setToLabel(myForm.myClasspathLabel);
|
||||
}
|
||||
|
||||
public String getClasspathLabel() {
|
||||
return LabeledComponent.TextWithMnemonic.fromLabel(myForm.myClasspathLabel).getTextWithMnemonic();
|
||||
}
|
||||
|
||||
public JComponent getPreferedFocusComponent() {
|
||||
return myForm.myClasspathList;
|
||||
}
|
||||
|
||||
+38
-14
@@ -28,16 +28,13 @@ import com.intellij.openapi.projectRoots.ui.ProjectJdksEditor;
|
||||
import com.intellij.openapi.ui.ComponentWithBrowseButton;
|
||||
import com.intellij.openapi.ui.DialogBuilder;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.ui.ComboboxWithBrowseButton;
|
||||
import com.intellij.ui.RawCommandLineEditor;
|
||||
import com.intellij.ui.SimpleColoredComponent;
|
||||
import com.intellij.ui.TabbedPaneWrapper;
|
||||
import com.intellij.util.NewInstanceFactory;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.table.JBTable;
|
||||
import com.intellij.util.config.AbstractProperty;
|
||||
import com.intellij.util.containers.Convertor;
|
||||
import com.intellij.util.ui.ColumnInfo;
|
||||
import com.intellij.util.ui.ListTableModel;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -197,8 +194,6 @@ public class BuildFilePropertiesPanel {
|
||||
}
|
||||
|
||||
private static class PropertiesTab extends Tab {
|
||||
private JButton myAddButton;
|
||||
private JButton myRemoveButton;
|
||||
private JTable myPropertiesTable;
|
||||
private JPanel myWholePanel;
|
||||
|
||||
@@ -237,11 +232,41 @@ public class BuildFilePropertiesPanel {
|
||||
private static final ColumnInfo[] PROPERTY_COLUMNS = new ColumnInfo[]{NAME_COLUMN, VALUE_COLUMN};
|
||||
|
||||
public PropertiesTab() {
|
||||
myPropertiesTable = new JBTable();
|
||||
UIPropertyBinding.TableListBinding<BuildFileProperty> tableListBinding = getBinding().bindList(myPropertiesTable, PROPERTY_COLUMNS,
|
||||
AntBuildFileImpl.ANT_PROPERTIES);
|
||||
AntBuildFileImpl.ANT_PROPERTIES);
|
||||
tableListBinding.setColumnWidths(GlobalAntConfiguration.PROPERTIES_TABLE_LAYOUT);
|
||||
tableListBinding.addAddFacility(myAddButton, NewInstanceFactory.fromClass(BuildFileProperty.class));
|
||||
tableListBinding.addRemoveFacility(myRemoveButton, Condition.TRUE);
|
||||
|
||||
myWholePanel = ToolbarDecorator.createDecorator(myPropertiesTable)
|
||||
.setAddAction(new AnActionButtonRunnable() {
|
||||
|
||||
|
||||
@Override
|
||||
public void run(AnActionButton button) {
|
||||
if (myPropertiesTable.isEditing() && !myPropertiesTable.getCellEditor().stopCellEditing()) {
|
||||
return;
|
||||
}
|
||||
BuildFileProperty item = new BuildFileProperty();
|
||||
ListTableModel<BuildFileProperty> model = (ListTableModel<BuildFileProperty>)myPropertiesTable.getModel();
|
||||
ArrayList<BuildFileProperty> items = new ArrayList<BuildFileProperty>(model.getItems());
|
||||
items.add(item);
|
||||
model.setItems(items);
|
||||
int newIndex = model.indexOf(item);
|
||||
ListSelectionModel selectionModel = myPropertiesTable.getSelectionModel();
|
||||
selectionModel.clearSelection();
|
||||
selectionModel.setSelectionInterval(newIndex, newIndex);
|
||||
ColumnInfo[] columns = model.getColumnInfos();
|
||||
for (int i = 0; i < columns.length; i++) {
|
||||
ColumnInfo column = columns[i];
|
||||
if (column.isCellEditable(item)) {
|
||||
myPropertiesTable.requestFocusInWindow();
|
||||
myPropertiesTable.editCellAt(newIndex, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}).disableUpDownActions().createPanel();
|
||||
myWholePanel.setBorder(null);
|
||||
}
|
||||
|
||||
public JComponent getComponent() {
|
||||
@@ -288,9 +313,9 @@ public class BuildFilePropertiesPanel {
|
||||
private static final Comparator<TargetFilter> NAME_COMPARATOR = new Comparator<TargetFilter>() {
|
||||
public int compare(TargetFilter o1, TargetFilter o2) {
|
||||
final String name1 = o1.getTargetName();
|
||||
if(name1 == null) return -1;
|
||||
if (name1 == null) return -1;
|
||||
final String name2 = o2.getTargetName();
|
||||
if(name2 == null) return 1;
|
||||
if (name2 == null) return 1;
|
||||
return name1.compareToIgnoreCase(name2);
|
||||
}
|
||||
};
|
||||
@@ -482,5 +507,4 @@ public class BuildFilePropertiesPanel {
|
||||
private static void setLabelFor(JLabel label, ComponentWithBrowseButton component) {
|
||||
label.setLabelFor(component.getChildComponent());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,24 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.lang.ant.config.impl.configuration.BuildFilePropertiesPanel.FiltersTab">
|
||||
<grid id="ecb84" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="6" left="6" bottom="6" right="6"/>
|
||||
<grid id="ecb84" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="1" 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="154" y="86" width="398" height="336"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="aabbb" class="javax.swing.JLabel">
|
||||
<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>
|
||||
<text resource-bundle="messages/AntBundle" key="run.filters.tab.targets.label"/>
|
||||
</properties>
|
||||
</component>
|
||||
<scrollpane id="8b9bc" class="com.intellij.ui.components.JBScrollPane">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.lang.ant.config.impl.configuration.BuildFilePropertiesPanel.PropertiesTab">
|
||||
<grid id="23284" binding="myWholePanel" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="6" left="6" bottom="6" right="6"/>
|
||||
<constraints>
|
||||
<xy x="173" y="110" width="248" height="158"/>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<scrollpane class="com.intellij.ui.components.JBScrollPane" id="9e63e">
|
||||
<constraints>
|
||||
<xy x="6" y="6" width="151" height="146"/>
|
||||
<grid row="0" column="0" row-span="3" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="2a3e5" class="com.intellij.util.ui.Table" binding="myPropertiesTable">
|
||||
<constraints/>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</scrollpane>
|
||||
<component id="5fffe" class="javax.swing.JButton" binding="myAddButton">
|
||||
<constraints>
|
||||
<xy x="167" y="6" width="75" height="25"/>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/AntBundle" key="button.add"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="fad56" class="javax.swing.JButton" binding="myRemoveButton">
|
||||
<constraints>
|
||||
<xy x="167" y="36" width="75" height="25"/>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/AntBundle" key="button.remove"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="bcf7d">
|
||||
<constraints>
|
||||
<xy x="199" y="61" width="11" height="91"/>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
Reference in New Issue
Block a user