Browse Source

Merge pull request #1167 in DESIGN/design from ~BRYANT/design:feature/10.0 to feature/10.0

* commit '8133b368d04ce08c565efd4c4884470dbb20a4dc':
  KERNEL-418 更新升级重构
  KERNEL-418 更新升级重构
research/11.0
Bryant 5 years ago
parent
commit
1ad18a68af
  1. 25
      designer-base/src/main/java/com/fr/design/upm/UpmFinder.java
  2. 31
      designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java

25
designer-base/src/main/java/com/fr/design/upm/UpmFinder.java

@ -2,11 +2,16 @@ package com.fr.design.upm;
import com.fr.base.FRContext;
import com.fr.design.dialog.UIDialog;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.update.domain.UpdateConstants;
import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent;
@ -51,11 +56,31 @@ public class UpmFinder {
}
public static void showUPMDialog() {
boolean flag = false;
File file = new File(StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LIB_NAME));
File[] files = file.listFiles();
if (files != null) {
for (File file1 : files) {
if (file1.getName().contains(UpdateConstants.JXBROWSER)) {
flag = true;
break;
}
}
}else {
FineLoggerFactory.getLogger().error("Designer lib can not be null");
}
if (flag) {
UpmShowPane upmPane = new UpmShowPane();
if (dialog == null) {
dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane);
}
dialog.setVisible(true);
} else {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message"));
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.setAutoUpdateAfterInit();
dialog.showDialog();
}
}
public static void closeWindow() {

31
designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java

@ -1,26 +1,16 @@
package com.fr.design.upm;
import com.fr.design.dialog.BasicPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.ui.ModernUIPane;
import com.fr.design.update.domain.UpdateConstants;
import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.design.upm.event.DownloadEvent;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.io.FileNotFoundException;
/**
* @author richie
@ -39,20 +29,6 @@ public class UpmShowPane extends BasicPane {
UpmShowPane() {
setLayout(new BorderLayout());
boolean flag = false;
File file = new File(StableUtils.pathJoin(StableUtils.getInstallHome(),ProjectConstants.LIB_NAME));
File[] files = file.listFiles();
if (files != null) {
for (File file1 : files) {
if (file1.getName().contains(UpdateConstants.JXBROWSER)) {
flag = true;
break;
}
}
}else {
FineLoggerFactory.getLogger().error("Designer lib can not be null");
}
if (flag) {
if (UpmFinder.checkUPMResourcesExist()) {
modernUIPane = new ModernUIPane.Builder<>()
.prepare(new ScriptContextAdapter() {
@ -87,13 +63,6 @@ public class UpmShowPane extends BasicPane {
}
});
}
} else {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message"));
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.setAutoUpdateAfterInit();
dialog.showDialog();
}
add(modernUIPane, BorderLayout.CENTER);
}
}

Loading…
Cancel
Save