diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index fe0e4ee4ff..844b8d0144 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -54,6 +54,7 @@ import com.fr.design.mainframe.toolbar.VcsScene; import com.fr.design.menu.MenuDef; import com.fr.design.menu.NameSeparator; import com.fr.design.menu.ShortCut; +import com.fr.design.module.DesignModuleFactory; import com.fr.design.preview.PagePreview; import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.DesignUtils; @@ -1109,6 +1110,10 @@ public abstract class JTemplate> tplMenu.addShortCut(shortCuts4Authority()); } + //查找替换 + tplMenu.addShortCut(new NameSeparator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Replace_Name_Separate"))); + tplMenu.addShortCut((ShortCut) DesignModuleFactory.getITReplaceAction()); + return new MenuDef[]{tplMenu}; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 6a83a159b8..904c281560 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -580,13 +580,7 @@ public abstract class ToolBarMenuDock { } shortCuts.add(new AboutAction()); - try { - if (DesignModuleFactory.getITReplaceAction() != null) { - shortCuts.add((ShortCut) DesignModuleFactory.getITReplaceAction().newInstance()); - } - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + return shortCuts.toArray(new ShortCut[0]); } diff --git a/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java index bab9bb1ac8..cccd6f71e6 100644 --- a/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java +++ b/designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java @@ -19,6 +19,7 @@ import com.fr.log.FineLoggerFactory; import com.fr.plugin.solution.sandbox.collection.PluginSandboxCollections; import com.fr.stable.StableUtils; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.lang.reflect.Constructor; import java.awt.Dialog; @@ -129,8 +130,21 @@ public class DesignModuleFactory { instance.ITReplaceAction = r; } - public static Class getITReplaceAction() { - return instance.ITReplaceAction; + /** + * 获取查找替换 + * + * @return ITReplaceAction + */ + @Nullable + public static Object getITReplaceAction() { + try { + if (instance.ITReplaceAction != null) { + return instance.ITReplaceAction.newInstance(); + } + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return null; } /** diff --git a/designer-base/src/main/resources/com/fr/design/images/replace/replace.png b/designer-base/src/main/resources/com/fr/design/images/replace/replace.png new file mode 100644 index 0000000000..e736042724 Binary files /dev/null and b/designer-base/src/main/resources/com/fr/design/images/replace/replace.png differ diff --git a/designer-base/src/main/resources/com/fr/design/images/replace/replace_normal.svg b/designer-base/src/main/resources/com/fr/design/images/replace/replace_normal.svg new file mode 100644 index 0000000000..efe176ceab --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/replace/replace_normal.svg @@ -0,0 +1,3 @@ + + + diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java index 358dc19652..6d085cbbdf 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ITReplaceAction.java @@ -29,6 +29,7 @@ public class ITReplaceAction extends UpdateAction { this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setAccelerator(getMenuKeySet().getKeyStroke()); + this.setSmallIcon("/com/fr/design/images/replace/replace"); } private static final MenuKeySet IT_REPLACE = new MenuKeySet() {