mirror of https://gitee.com/makejava/EasyCode.git
commit
49ef97aade
|
@ -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.sjhy.plugin.ui.MainSetting">
|
||||
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="3" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="4" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="0" y="1" width="606" height="499"/>
|
||||
|
@ -10,7 +10,7 @@
|
|||
<children>
|
||||
<component id="c1393" 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"/>
|
||||
<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="3e397"/>
|
||||
|
@ -19,7 +19,7 @@
|
|||
</component>
|
||||
<component id="9b299" class="javax.swing.JLabel">
|
||||
<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"/>
|
||||
<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>
|
||||
<labelFor value="94649"/>
|
||||
|
@ -28,7 +28,7 @@
|
|||
</component>
|
||||
<component id="3e397" class="javax.swing.JComboBox" binding="encodeComboBox">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<model>
|
||||
|
@ -44,7 +44,7 @@
|
|||
</component>
|
||||
<component id="94649" class="javax.swing.JTextField" binding="authorTextField">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="3" vsize-policy="0" hsize-policy="6" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<grid row="2" column="1" row-span="1" col-span="3" vsize-policy="0" hsize-policy="6" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
|
@ -54,7 +54,7 @@
|
|||
</component>
|
||||
<component id="49eb5" class="javax.swing.JButton" binding="resetBtn">
|
||||
<constraints>
|
||||
<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"/>
|
||||
<grid row="1" 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 resource-bundle="string" key="button.reset"/>
|
||||
|
@ -62,13 +62,13 @@
|
|||
</component>
|
||||
<hspacer id="fefd">
|
||||
<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"/>
|
||||
<grid row="1" 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>
|
||||
<grid id="45da" layout-manager="GridLayoutManager" row-count="2" 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="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"/>
|
||||
<grid row="3" 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"/>
|
||||
|
@ -101,6 +101,22 @@
|
|||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<component id="9a049" 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="string" key="label.version"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="a9c9" class="javax.swing.JLabel" binding="versionLabel">
|
||||
<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=""/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
|
|
|
@ -62,6 +62,10 @@ public class MainSetting implements Configurable, Configurable.Composite {
|
|||
* 模板导出按钮
|
||||
*/
|
||||
private JButton exportBtn;
|
||||
/**
|
||||
* 当前版本号
|
||||
*/
|
||||
private JLabel versionLabel;
|
||||
|
||||
/**
|
||||
* 重置列表
|
||||
|
@ -294,6 +298,7 @@ public class MainSetting implements Configurable, Configurable.Composite {
|
|||
*/
|
||||
private void init() {
|
||||
//初始化数据
|
||||
versionLabel.setText(settings.getVersion());
|
||||
authorTextField.setText(settings.getAuthor());
|
||||
encodeComboBox.setSelectedItem(settings.getEncode());
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ public class TemplateSettingPanel implements Configurable {
|
|||
};
|
||||
|
||||
// 创建元素选择面板
|
||||
this.baseItemSelectPanel = new BaseItemSelectPanel<Template>(group.get(currGroupName).getElementList()) {
|
||||
this.baseItemSelectPanel = new BaseItemSelectPanel<Template>(group.get(currGroupName).getElementList(), true) {
|
||||
@Override
|
||||
protected void addItem(String name) {
|
||||
List<Template> templateList = group.get(currGroupName).getElementList();
|
||||
|
|
|
@ -34,6 +34,10 @@ public abstract class BaseItemSelectPanel<T extends Item> {
|
|||
* 可选面板集合
|
||||
*/
|
||||
private List<T> itemList;
|
||||
/**
|
||||
* 列表元素是否可上下移动
|
||||
*/
|
||||
private boolean movable = false;
|
||||
|
||||
/**
|
||||
* 左边面板
|
||||
|
@ -54,6 +58,11 @@ public abstract class BaseItemSelectPanel<T extends Item> {
|
|||
this.itemList = itemList;
|
||||
}
|
||||
|
||||
protected BaseItemSelectPanel(@NotNull List<T> itemList, boolean movable) {
|
||||
this.itemList = itemList;
|
||||
this.movable = movable;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增元素
|
||||
*
|
||||
|
@ -230,6 +239,72 @@ public abstract class BaseItemSelectPanel<T extends Item> {
|
|||
}
|
||||
});
|
||||
|
||||
// 如果启动顺序移动
|
||||
if (isMovable()) {
|
||||
// 上移事件
|
||||
actionGroup.add(new AnAction(AllIcons.Actions.MoveUp) {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
T selectedItem = getSelectedItem();
|
||||
|
||||
// 获取当前选项索引
|
||||
int index = getItemList().indexOf(selectedItem);
|
||||
int targetIndex = index - 1;
|
||||
|
||||
// 判断选项是否是不可移动情况, 已经在第一项 或 只有一个选项
|
||||
if (index == 0 || getItemList().size() == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
T targetItem = getItemList().get(targetIndex);
|
||||
getItemList().set(index, targetItem);
|
||||
getItemList().set(targetIndex, selectedItem);
|
||||
|
||||
reset(getItemList(), targetIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
boolean movable = false;
|
||||
if (getSelectedItem() != null && itemList.size() > 1 && itemList.indexOf(getSelectedItem()) > 0) {
|
||||
movable = true;
|
||||
}
|
||||
e.getPresentation().setEnabled(movable);
|
||||
}
|
||||
});
|
||||
// 下移事件
|
||||
actionGroup.add(new AnAction(AllIcons.Actions.MoveDown) {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
T selectedItem = getSelectedItem();
|
||||
// 获取当前选项索引
|
||||
int index = getItemList().indexOf(selectedItem);
|
||||
int targetIndex = index + 1;
|
||||
|
||||
// 判断选项是否是不可移动情况, 已经在最后一项 或 只有一个选项
|
||||
if (index == getItemList().size() - 1 || getItemList().size() == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
T targetItem = getItemList().get(targetIndex);
|
||||
getItemList().set(index, targetItem);
|
||||
getItemList().set(targetIndex, selectedItem);
|
||||
|
||||
reset(getItemList(), targetIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
boolean movable = false;
|
||||
boolean isLast = itemList.size() - itemList.indexOf(getSelectedItem()) == 1;
|
||||
if (getSelectedItem() != null && itemList.size() > 1 && !isLast) {
|
||||
movable = true;
|
||||
}
|
||||
e.getPresentation().setEnabled(movable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return actionGroup;
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@
|
|||
<p>More <a href="https://github.com/makejavas/EasyCode">Help Info</a>.</p>
|
||||
]]></change-notes>
|
||||
|
||||
<!-- please see https://confluence.jetbrains.com/display/IDEADEV/Build+Number+Ranges for description -->
|
||||
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
|
||||
<idea-version since-build="172"/>
|
||||
|
||||
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
button.reset=\u91CD\u7F6E\u9ED8\u8BA4\u8BBE\u7F6E
|
||||
button.type.mapper.copy.group=Copy Group
|
||||
label.all=&All
|
||||
label.version=&\u5f53\u524d\u7248\u672c\uFF1A
|
||||
label.author.name=&\u4F5C\u8005\u540D\u79F0\uFF1A
|
||||
label.cancel=&Cancel
|
||||
label.choose=&Choose
|
||||
|
|
Loading…
Reference in New Issue