|
|
|
@ -18,6 +18,7 @@ import com.fr.design.mainframe.manager.clip.TemplateTreeClipboard;
|
|
|
|
|
import com.fr.design.mainframe.manager.search.TemplateDirTreeSearchManager; |
|
|
|
|
import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager; |
|
|
|
|
import com.fr.design.mainframe.manager.search.searcher.control.pane.TemplateDirTreeSearchPane; |
|
|
|
|
import com.fr.design.utils.TemplateUtils; |
|
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
import com.fr.file.FileNodeFILE; |
|
|
|
|
import com.fr.file.filetree.FileNode; |
|
|
|
@ -49,6 +50,9 @@ import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
|
|
|
|
|
import static javax.swing.JOptionPane.WARNING_MESSAGE; |
|
|
|
|
import static javax.swing.JOptionPane.YES_NO_OPTION; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 默认的模板右键处理方式:包含重命名、复制、黏贴、删除、移动等功能 |
|
|
|
|
*/ |
|
|
|
|
public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefineProcessor { |
|
|
|
|
|
|
|
|
|
private UIPopupMenu popupMenu; |
|
|
|
@ -129,6 +133,9 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
|
|
|
|
|
return TemplateDirTreePane.getInstance().getTemplateDirTree(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 复制功能 |
|
|
|
|
*/ |
|
|
|
|
private class CopyAction extends UpdateAction { |
|
|
|
|
|
|
|
|
|
public CopyAction() { |
|
|
|
@ -153,6 +160,9 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 黏贴功能 |
|
|
|
|
*/ |
|
|
|
|
private class PasteAction extends UpdateAction { |
|
|
|
|
|
|
|
|
|
public PasteAction() { |
|
|
|
@ -207,14 +217,20 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
//确定目标目录并检查权限
|
|
|
|
|
FileOperations selectedOperation = DesignerFrameFileDealerPane.getInstance().getSelectedOperation(); |
|
|
|
|
if (getFileTree().getSelectionCount() != 0 && !selectedOperation.access()) { |
|
|
|
|
if (getDirTree().getSelectionCount() != 0 && !TemplateDirTreePane.getInstance().selectedAccess()) { |
|
|
|
|
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Alert"), |
|
|
|
|
WARNING_MESSAGE); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
//检测之前复制的文件是否被打开
|
|
|
|
|
if (TemplateUtils.checkTemplateIsEditing(treeNodeList.toArray(new ExpandMutableTreeNode[0]))) { |
|
|
|
|
return FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Template_Is_Editing"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Alert"), |
|
|
|
|
YES_NO_OPTION) == JOptionPane.YES_OPTION; |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -251,6 +267,9 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 移动功能 |
|
|
|
|
*/ |
|
|
|
|
private class MoveAction extends UpdateAction { |
|
|
|
|
|
|
|
|
|
public MoveAction() { |
|
|
|
@ -347,12 +366,8 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void confirmClose() { |
|
|
|
|
//获取目录数中所选中的文件,并判断是否有权限
|
|
|
|
|
if (getFileTree().getSelectionCount() != 0 && !TemplateDirTreePane.getInstance().selectedAccess()) { |
|
|
|
|
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Alert"), |
|
|
|
|
WARNING_MESSAGE); |
|
|
|
|
//获取目录树中所选中的文件,并判断是否有权限
|
|
|
|
|
if (!checkBeforeMove()) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
boolean moveSuccess = doMove(); |
|
|
|
@ -372,9 +387,27 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean checkBeforeMove() { |
|
|
|
|
if (getDirTree().getSelectionCount() != 0 && !TemplateDirTreePane.getInstance().selectedAccess()) { |
|
|
|
|
FineJOptionPane.showMessageDialog(this, |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Alert"), |
|
|
|
|
WARNING_MESSAGE); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
if (TemplateUtils.checkSelectedTemplateIsEditing()) { |
|
|
|
|
return FineJOptionPane.showConfirmDialog(this, |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Template_Is_Editing"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Alert"), |
|
|
|
|
YES_NO_OPTION) == JOptionPane.YES_OPTION; |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean doMove() { |
|
|
|
|
FileNode fileNode = getDirTree().getSelectedFileNode(); |
|
|
|
|
fileNode = fileNode == null ? (FileNode) getFileTree().getModel().getRoot() : fileNode; |
|
|
|
|
ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) getDirTree().getModel().getRoot(); |
|
|
|
|
fileNode = fileNode == null ? (FileNode) rootTreeNode.getUserObject() : fileNode; |
|
|
|
|
boolean moveSuccess = true; |
|
|
|
|
try { |
|
|
|
|
//待移动的文件可以有多个
|
|
|
|
|