Use EditorTextField to edit description and change notes

This commit is contained in:
Rustam Vishnyakov
2017-10-16 17:02:35 +03:00
parent dc88fb4ac7
commit 5c0cddd394
2 changed files with 92 additions and 90 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.application.options.colors.pluginExport.PluginInfoForm">
<grid id="27dc6" binding="myTopPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="myTopPanel" 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="20" y="20" width="500" height="400"/>
@@ -8,82 +8,13 @@
<properties/>
<border type="none"/>
<children>
<grid id="ce6c1" binding="myVendorDataPanel" 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>
<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" title="Vendor:"/>
<children>
<component id="a92db" 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 value="Name:"/>
</properties>
</component>
<hspacer id="af013">
<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>
<component id="4e75" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="1" 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>
<labelFor value="3cff3"/>
<text value="e-mail:"/>
</properties>
</component>
<component id="3cff3" class="javax.swing.JTextField" binding="myVendorMailField">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<columns value="20"/>
</properties>
</component>
<component id="6db68" class="javax.swing.JTextField" binding="myVendorNameField">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<columns value="20"/>
</properties>
</component>
<component id="c78ec" class="com.intellij.ui.components.JBTextField" binding="myVendorUrl">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<columns value="20"/>
</properties>
</component>
<component id="cd7fc" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="2" 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="URL:"/>
</properties>
</component>
</children>
</grid>
<vspacer id="cbd23">
<constraints>
<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>
<grid id="3ec52" binding="myPluginDataPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="3ec52" layout-manager="GridLayoutManager" row-count="6" 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" title="Plugin Data:"/>
<border type="none"/>
<children>
<component id="d89d" class="com.intellij.ui.components.JBLabel">
<constraints>
@@ -95,7 +26,7 @@
</component>
<component id="72fc4" class="com.intellij.ui.components.JBTextField" binding="myVersionField">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<columns value="6"/>
@@ -103,16 +34,14 @@
</component>
<scrollpane id="80db7" class="com.intellij.ui.components.JBScrollPane">
<constraints>
<grid row="1" column="1" 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="1" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="87e" class="javax.swing.JTextArea" binding="myDescriptionArea">
<component id="87e" class="com.intellij.ui.EditorTextField" binding="myDescriptionArea" custom-create="true">
<constraints/>
<properties>
<rows value="5"/>
</properties>
<properties/>
</component>
</children>
</scrollpane>
@@ -126,16 +55,14 @@
</component>
<scrollpane id="c034f" class="com.intellij.ui.components.JBScrollPane">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="2" column="1" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="e20d2" class="javax.swing.JTextArea" binding="myChangeNotesArea">
<component id="e20d2" class="com.intellij.ui.EditorTextField" binding="myChangeNotesArea" custom-create="true">
<constraints/>
<properties>
<rows value="5"/>
</properties>
<properties/>
</component>
</children>
</scrollpane>
@@ -147,6 +74,60 @@
<text value="Change Notes:"/>
</properties>
</component>
<component id="6db68" class="javax.swing.JTextField" binding="myVendorNameField">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<columns value="20"/>
</properties>
</component>
<component id="a92db" class="javax.swing.JLabel">
<constraints>
<grid row="3" 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="Name:"/>
</properties>
</component>
<component id="4e75" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="4" 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>
<labelFor value="3cff3"/>
<text value="e-mail:"/>
</properties>
</component>
<component id="3cff3" class="javax.swing.JTextField" binding="myVendorMailField">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<columns value="20"/>
</properties>
</component>
<component id="c78ec" class="com.intellij.ui.components.JBTextField" binding="myVendorUrl">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<columns value="20"/>
</properties>
</component>
<component id="cd7fc" class="com.intellij.ui.components.JBLabel">
<constraints>
<grid row="5" 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="URL:"/>
</properties>
</component>
<hspacer id="af013">
<constraints>
<grid row="3" 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>
@@ -15,26 +15,26 @@
*/
package com.intellij.application.options.colors.pluginExport;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.openapi.editor.colors.EditorColorsUtil;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.ui.EditorTextField;
import com.intellij.ui.components.JBTextField;
import com.intellij.util.ui.JBUI;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.*;
public class PluginInfoForm {
private JTextField myVendorMailField;
private JTextField myVendorNameField;
private JPanel myVendorDataPanel;
private JBTextField myVendorUrl;
private JBTextField myVersionField;
private JTextArea myDescriptionArea;
private JTextArea myChangeNotesArea;
private EditorTextField myDescriptionArea;
private EditorTextField myChangeNotesArea;
private JPanel myTopPanel;
private JPanel myPluginDataPanel;
public PluginInfoForm() {
myPluginDataPanel.setBorder(IdeBorderFactory.createTitledBorder("Plugin"));
myVendorDataPanel.setBorder(IdeBorderFactory.createTitledBorder("Vendor"));
}
public JPanel getTopPanel() {
@@ -58,4 +58,25 @@ public class PluginInfoForm {
exportData.setDescription(myDescriptionArea.getText());
exportData.setChangeNotes(myChangeNotesArea.getText());
}
private void createUIComponents() {
myDescriptionArea = createDescriptionEditor();
myChangeNotesArea = createDescriptionEditor();
}
private static EditorTextField createDescriptionEditor() {
EditorTextField descriptionEditor = new EditorTextField() {
@Override
protected EditorEx createEditor() {
EditorEx editor = super.createEditor();
editor.getSettings().setUseSoftWraps(true);
editor.getScrollPane().setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
editor.setColorsScheme(EditorColorsUtil.getColorSchemeForComponent(this));
return editor;
}
};
descriptionEditor.setOneLineMode(false);
descriptionEditor.setPreferredSize(new Dimension(descriptionEditor.getWidth(), JBUI.scale(100)));
return descriptionEditor;
}
}