|
|
|
@ -59,6 +59,7 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
|
|
|
|
|
private PasteAction pasteAction; |
|
|
|
|
private DelFileAction delFileAction; |
|
|
|
|
private MoveAction moveAction; |
|
|
|
|
private LocateAction locateAction; |
|
|
|
|
|
|
|
|
|
public static DefaultTemplateTreeDefineProcessor getInstance() { |
|
|
|
|
return DefaultTemplateTreeDefineProcessor.HOLDER.singleton; |
|
|
|
@ -78,6 +79,7 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
|
|
|
|
|
pasteAction = new PasteAction(); |
|
|
|
|
delFileAction = new DelFileAction(); |
|
|
|
|
moveAction = new MoveAction(); |
|
|
|
|
locateAction = new OpenInTemplateTreeAction(); |
|
|
|
|
//右键菜单
|
|
|
|
|
popupMenu = new UIPopupMenu(); |
|
|
|
|
popupMenu.add(renameAction.createMenuItem()); |
|
|
|
@ -87,6 +89,7 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
|
|
|
|
|
popupMenu.add(delFileAction.createMenuItem()); |
|
|
|
|
popupMenu.addSeparator(); |
|
|
|
|
popupMenu.add(moveAction.createMenuItem()); |
|
|
|
|
popupMenu.add(locateAction.createMenuItem()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -103,6 +106,7 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
|
|
|
|
|
pasteAction.setEnabled(false); |
|
|
|
|
delFileAction.setEnabled(false); |
|
|
|
|
moveAction.setEnabled(false); |
|
|
|
|
locateAction.setEnabled(false); |
|
|
|
|
int length = getFileTree().getSelectionCount(); |
|
|
|
|
if (length == 0) { |
|
|
|
|
//没有选中文件时,只能黏贴
|
|
|
|
@ -114,6 +118,10 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
|
|
|
|
|
if (length == 1) { |
|
|
|
|
//选中一个时可以,可以重命名、黏贴
|
|
|
|
|
renameAction.setEnabled(true); |
|
|
|
|
if (TemplateTreeSearchManager.getInstance().isInSearchMode()) { |
|
|
|
|
//搜索模式开启定位当前模板
|
|
|
|
|
locateAction.setEnabled(true); |
|
|
|
|
} |
|
|
|
|
if (!CollectionUtils.isEmpty(TemplateTreeClipboard.getInstance().takeFromClip())) { |
|
|
|
|
pasteAction.setEnabled(true); |
|
|
|
|
} |
|
|
|
@ -158,6 +166,22 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private class OpenInTemplateTreeAction extends LocateAction { |
|
|
|
|
|
|
|
|
|
public OpenInTemplateTreeAction() { |
|
|
|
|
this.setName(Toolkit.i18nText("Fine-Design_Basic_Locate_Node")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
FileNode fileNode = getFileTree().getSelectedFileNode(); |
|
|
|
|
if (fileNode == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
gotoEditingTemplateLeaf(fileNode.getEnvPath()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 黏贴功能 |
|
|
|
|
*/ |
|
|
|
@ -256,10 +280,6 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
|
|
|
|
|
JOptionPane.ERROR_MESSAGE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 粘贴时如果正在搜索,跳回原树
|
|
|
|
|
if (TemplateTreeSearchManager.getInstance().isInSearchMode()) { |
|
|
|
|
TemplateTreeSearchManager.getInstance().outOfSearchMode(); |
|
|
|
|
} |
|
|
|
|
DesignerFrameFileDealerPane.getInstance().getSelectedOperation().refreshParent(); |
|
|
|
|
LocateAction.gotoEditingTemplateLeaf(targetFile); |
|
|
|
|
} |
|
|
|
@ -402,10 +422,6 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
|
|
|
|
|
ToastMsgDialog dialog = DesignerToastMsgUtil.createPromptDialog(Toolkit.i18nText("Fine-Design_Basic_Template_Moved_Success")); |
|
|
|
|
dialog.setVisible(true); |
|
|
|
|
|
|
|
|
|
// 移动时如果正在搜索,跳回原树
|
|
|
|
|
if (TemplateTreeSearchManager.getInstance().isInSearchMode()) { |
|
|
|
|
TemplateTreeSearchManager.getInstance().outOfSearchMode(); |
|
|
|
|
} |
|
|
|
|
DesignerFrameFileDealerPane.getInstance().getSelectedOperation().refresh(); |
|
|
|
|
LocateAction.gotoEditingTemplateLeaf(targetFile); |
|
|
|
|
} |
|
|
|
|