Browse Source

REPORT-100527 中断迁移没有异常提示

newui
Destiny.Lin 1 year ago
parent
commit
ab9dbfe11b
  1. 6
      designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java
  2. 7
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  3. 54
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovingExitOption.java

6
designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java

@ -7,6 +7,7 @@ import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.SaveSomeTemplatePane; import com.fr.design.file.SaveSomeTemplatePane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.vcs.ui.VcsMovingExitOption;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
@ -60,6 +61,11 @@ public class SwitchExistEnv extends MenuDef {
* @param e 事件 * @param e 事件
*/ */
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
//检查是否正在迁移,如果正在迁移就弹出弹窗让用户选择
if (!VcsMovingExitOption.ShowDialogAndConfirmSwitch()) {
//如果用户选择取消切换环境则返回,不然说明用户就是想切换,则往下走
return;
}
final String envName = getName(); final String envName = getName();
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName); DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName);

7
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -34,6 +34,7 @@ import com.fr.design.mainframe.share.mini.MiniShopDisposingChecker;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.mainframe.vcs.ui.VcsMovingExitOption;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.os.impl.MacOsAddListenerAction; import com.fr.design.os.impl.MacOsAddListenerAction;
import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.os.impl.SupportOSImpl;
@ -161,6 +162,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
@Override @Override
public void windowClosing(WindowEvent e) { public void windowClosing(WindowEvent e) {
//检查是否正在迁移,如果正在迁移就弹出弹窗让用户选择
if (!VcsMovingExitOption.ShowDialogAndConfirmExit()) {
//如果用户选择取消退出则返回,不然说明用户就是想退出,则往下走
return;
}
// 检查mini商城是否存在未结束的后台任务 // 检查mini商城是否存在未结束的后台任务
if (!MiniShopDisposingChecker.check()) { if (!MiniShopDisposingChecker.check()) {
return; return;

54
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/VcsMovingExitOption.java

@ -0,0 +1,54 @@
package com.fr.design.mainframe.vcs.ui;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.workspace.server.vcs.v2.move.VcsMoveService;
import javax.swing.JOptionPane;
/**
* 版本管理迁移检查
*
* @author Destiny.Lin
* @since 11.0
* Created on 2023/7/18
*/
public class VcsMovingExitOption {
/**
* 关闭前的检查
*
* @return
*/
public static boolean ShowDialogAndConfirmExit() {
return showDialogAndChoose(Toolkit.i18nText("Fine-Design_Vcs_Close_Tips"));
}
/**
* 切换环境前的检查
*
* @return
*/
public static boolean ShowDialogAndConfirmSwitch() {
return showDialogAndChoose(Toolkit.i18nText("Fine-Design_Vcs_Switch_Tips"));
}
private static boolean showDialogAndChoose(String msg) {
if (VcsMoveService.getInstance().isMoving()) {
int result = FineJOptionPane.showConfirmDialog(
DesignerContext.getDesignerFrame(),
msg,
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
FineJOptionPane.YES_NO_OPTION
);
return result == JOptionPane.YES_OPTION;
}
return true;
}
}
Loading…
Cancel
Save