Browse Source

Pull request #9844: REPORT-78817 重命名没有实时刷新名称等

Merge in DESIGN/design from ~ROGER.CHEN/design:feature/x to feature/x

* commit 'd38db927db9648fad2c50a20e5db2135fb00e6b1':
  REPORT-78817 重命名没有实时刷新名称等
feature/x
Roger.Chen 2 years ago
parent
commit
d7fc0ea628
  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.mainframe.DesignerContext;
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.gui.GUICoreUtils;
import com.fr.event.EventDispatcher;
@ -228,7 +229,7 @@ public class RenameAction extends UpdateAction {
this.setSize(340, 200);
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Rename"));
this.setResizable(false);
this.setAlwaysOnTop(true);
this.setAlwaysOnTop(false);
this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png"));
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
GUICoreUtils.centerWindow(this);
@ -270,11 +271,7 @@ public class RenameAction extends UpdateAction {
boolean success = selectedOperation.rename(fnf, path, newPath);
if (success) {
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();
afterRename(path, newPath);
} else {
FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
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() {

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) {
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()) {
doPaste(targetDir, pasteNodes);
} else {
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"),
YES_NO_OPTION)
== JOptionPane.YES_OPTION) {
@ -242,14 +250,6 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
if (StringUtils.isEmpty(targetDir)) {
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) {
if (node.getUserObject() instanceof FileNode) {
FileNode fileNode = (FileNode) node.getUserObject();
@ -361,7 +361,7 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
this.setSize(new Dimension(600, 400));
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Move"));
this.setResizable(false);
this.setAlwaysOnTop(true);
this.setAlwaysOnTop(false);
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
GUICoreUtils.setWindowCenter(DesignerContext.getDesignerFrame(), this);
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.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.JNullTemplate;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.design.ui.util.UIUtil;
@ -312,7 +313,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
JTemplate<?, ?> template;
template = this.getCurrentEditingTemplate();
if (template != null) {
if (template != null && !(template instanceof JNullTemplate)) {
String editingPath = FilenameUtils.standard(template.getEditingFILE().getPath());
if (isDir ? editingPath.contains(from + CoreConstants.SEPARATOR) : editingPath.equals(from)) {
FILE renameFile = template.getEditingFILE();

Loading…
Cancel
Save