Browse Source

REPORT-78817 重命名没有实时刷新名称等

feature/x
roger 2 years ago
parent
commit
d526f12687
  1. 21
      designer-base/src/main/java/com/fr/design/actions/file/RenameAction.java
  2. 20
      designer-base/src/main/java/com/fr/design/file/DefaultTemplateTreeDefineProcessor.java
  3. 3
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

21
designer-base/src/main/java/com/fr/design/actions/file/RenameAction.java

@ -16,6 +16,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager;
import com.fr.design.utils.TemplateUtils; import com.fr.design.utils.TemplateUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
@ -228,7 +229,7 @@ public class RenameAction extends UpdateAction {
this.setSize(340, 200); this.setSize(340, 200);
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Rename")); this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Rename"));
this.setResizable(false); this.setResizable(false);
this.setAlwaysOnTop(true); this.setAlwaysOnTop(false);
this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png")); this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png"));
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
GUICoreUtils.centerWindow(this); GUICoreUtils.centerWindow(this);
@ -270,11 +271,7 @@ public class RenameAction extends UpdateAction {
boolean success = selectedOperation.rename(fnf, path, newPath); boolean success = selectedOperation.rename(fnf, path, newPath);
if (success) { if (success) {
EventDispatcher.fire(DesignerFrameFileDealerPane.TEMPLATE_RENAME, new TwoTuple<>(path, newPath)); afterRename(path, newPath);
HistoryTemplateListCache.getInstance().rename(fnf, path, newPath);
DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(fnf.isDirectory(), path, newPath);
selectedOperation.refreshParent();
DesignerContext.getDesignerFrame().setTitle();
} else { } else {
FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Rename_Failure"), Toolkit.i18nText("Fine-Design_Basic_Rename_Failure"),
@ -284,6 +281,18 @@ public class RenameAction extends UpdateAction {
} }
} }
private void afterRename(String path, String newPath) {
EventDispatcher.fire(DesignerFrameFileDealerPane.TEMPLATE_RENAME, new TwoTuple<>(path, newPath));
HistoryTemplateListCache.getInstance().rename(fnf, path, newPath);
DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(fnf.isDirectory(), path, newPath);
selectedOperation.refreshParent();
DesignerContext.getDesignerFrame().setTitle();
if (TemplateTreeSearchManager.getInstance().isInSearchMode()) {
TemplateTreeSearchManager.getInstance().outOfSearchMode();
LocateAction.gotoEditingTemplateLeaf(newPath);
}
}
private void validInput() { private void validInput() {

20
designer-base/src/main/java/com/fr/design/file/DefaultTemplateTreeDefineProcessor.java

@ -186,11 +186,19 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
for (ExpandMutableTreeNode treeNode : treeNodeList) { for (ExpandMutableTreeNode treeNode : treeNodeList) {
checkFreeOrLock(treeNode, pasteNodes, lockedNodes); checkFreeOrLock(treeNode, pasteNodes, lockedNodes);
} }
if (pasteNodes.isEmpty()) {
//提示:复制的文件都不能黏贴
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Confirm_Paste_Unlock_File"),
Toolkit.i18nText("Fine-Design_Basic_Alert"),
WARNING_MESSAGE);
return;
}
if (lockedNodes.isEmpty()) { if (lockedNodes.isEmpty()) {
doPaste(targetDir, pasteNodes); doPaste(targetDir, pasteNodes);
} else { } else {
if (FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), if (FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Confirm_Paste_Unlock_File"), Toolkit.i18nText("Fine-Design_Basic_Confirm_Paste_Other_File"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"), Toolkit.i18nText("Fine-Design_Basic_Confirm"),
YES_NO_OPTION) YES_NO_OPTION)
== JOptionPane.YES_OPTION) { == JOptionPane.YES_OPTION) {
@ -242,14 +250,6 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
if (StringUtils.isEmpty(targetDir)) { if (StringUtils.isEmpty(targetDir)) {
return; return;
} }
if (pasteNodes.isEmpty()) {
//提示:复制的文件都不能黏贴
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Confirm_Paste_Unlock_File"),
Toolkit.i18nText("Fine-Design_Basic_Alert"),
WARNING_MESSAGE);
return;
}
for (ExpandMutableTreeNode node : pasteNodes) { for (ExpandMutableTreeNode node : pasteNodes) {
if (node.getUserObject() instanceof FileNode) { if (node.getUserObject() instanceof FileNode) {
FileNode fileNode = (FileNode) node.getUserObject(); FileNode fileNode = (FileNode) node.getUserObject();
@ -361,7 +361,7 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
this.setSize(new Dimension(600, 400)); this.setSize(new Dimension(600, 400));
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Move")); this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Move"));
this.setResizable(false); this.setResizable(false);
this.setAlwaysOnTop(true); this.setAlwaysOnTop(false);
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
GUICoreUtils.setWindowCenter(DesignerContext.getDesignerFrame(), this); GUICoreUtils.setWindowCenter(DesignerContext.getDesignerFrame(), this);
this.setVisible(true); this.setVisible(true);

3
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -8,6 +8,7 @@ import com.fr.design.data.DesignTableDataManager;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.JNullTemplate;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JVirtualTemplate; import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
@ -312,7 +313,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
JTemplate<?, ?> template; JTemplate<?, ?> template;
template = this.getCurrentEditingTemplate(); template = this.getCurrentEditingTemplate();
if (template != null) { if (template != null && !(template instanceof JNullTemplate)) {
String editingPath = FilenameUtils.standard(template.getEditingFILE().getPath()); String editingPath = FilenameUtils.standard(template.getEditingFILE().getPath());
if (isDir ? editingPath.contains(from + CoreConstants.SEPARATOR) : editingPath.equals(from)) { if (isDir ? editingPath.contains(from + CoreConstants.SEPARATOR) : editingPath.equals(from)) {
FILE renameFile = template.getEditingFILE(); FILE renameFile = template.getEditingFILE();

Loading…
Cancel
Save