Browse Source

REPORT-9480 & REPORT-9159 解决切换目录窗口被挡住问题

master
Mata.Li 6 years ago
parent
commit
5b68f75f7a
  1. 9
      designer-base/src/main/java/com/fr/start/Demo.java
  2. 14
      designer-base/src/main/java/com/fr/start/ServerStarter.java
  3. 13
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

9
designer-base/src/main/java/com/fr/start/Demo.java

@ -5,12 +5,11 @@ import com.fr.base.FRContext;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import java.io.File;
import java.io.IOException; import java.io.IOException;
public class Demo { public class Demo {
public static void main(String[] args) { public static void main(String[] args) {
String installHome = StableUtils.getInstallHome(); String installHome = "D:\\应用\\FineReport_10.1";//StableUtils.getInstallHome();
if (installHome == null) { if (installHome == null) {
FRContext.getLogger().error("Can not find the install home, please check it."); FRContext.getLogger().error("Can not find the install home, please check it.");
return; return;
@ -21,11 +20,7 @@ public class Demo {
if (OperatingSystem.isMacOS()) { if (OperatingSystem.isMacOS()) {
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.app"); executorPath = StableUtils.pathJoin(installHome, "bin", "designer.app");
} else { } else {
//转成反斜杠格式 executorPath = StableUtils.pathJoin(installHome, "bin", "designer.exe demo");
executorPath = new File(StableUtils.pathJoin(installHome, "bin", "designer.exe demo")).getPath();
}
if (!new java.io.File(executorPath).exists()) {
FRContext.getLogger().error(executorPath + " can not be found.");
} }
if (OperatingSystem.isMacOS()) { if (OperatingSystem.isMacOS()) {

14
designer-base/src/main/java/com/fr/start/ServerStarter.java

@ -22,6 +22,7 @@ import com.fr.stable.StringUtils;
import com.fr.start.server.FineEmbedServer; import com.fr.start.server.FineEmbedServer;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.io.IOException; import java.io.IOException;
@ -39,13 +40,17 @@ public class ServerStarter {
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
//有问题,这里拿不到远程的http端口 //有问题,这里拿不到远程的http端口
browser(WorkContext.getCurrent().getPath()); browser(WorkContext.getCurrent().getPath());
return;
} }
if (ComparatorUtils.equals(StableUtils.getInstallHome(), ".")) {//august:供代码使用 else if (ComparatorUtils.equals(StableUtils.getInstallHome(), ".")) {//august:供代码使用
String web = GeneralContext.getCurrentAppNameOfEnv(); String web = GeneralContext.getCurrentAppNameOfEnv();
browserURLWithLocalEnv("http://localhost:" + DesignerEnvManager.getEnvManager().getEmbedServerPort() + "/" + web + "/" + ServerConfig.getInstance().getServletName()); browserURLWithLocalEnv("http://localhost:" + DesignerEnvManager.getEnvManager().getEmbedServerPort() + "/" + web + "/" + ServerConfig.getInstance().getServletName());
return; }else{
initDemoServerAndBrowser();
} }
}
public static void switchWorkContext(){
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
if (!envManager.isCurrentEnvDefault()) { if (!envManager.isCurrentEnvDefault()) {
InformationPane inf = new InformationPane(envManager.getDefaultEnvName()); InformationPane inf = new InformationPane(envManager.getDefaultEnvName());
@ -60,12 +65,9 @@ public class ServerStarter {
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
initDemoServerAndBrowser();
} }
}).setVisible(true); }).setVisible(true);
} else {
initDemoServerAndBrowser();
} }
} }

13
designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

@ -1,13 +1,16 @@
package com.fr.start.module; package com.fr.start.module;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.general.ComparatorUtils;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.record.analyzer.EnableMetrics; import com.fr.record.analyzer.EnableMetrics;
import com.fr.record.analyzer.Metrics; import com.fr.record.analyzer.Metrics;
import com.fr.start.Designer; import com.fr.start.Designer;
import com.fr.start.EnvSwitcher; import com.fr.start.EnvSwitcher;
import com.fr.start.ServerStarter;
import com.fr.start.SplashContext; import com.fr.start.SplashContext;
import com.fr.startup.activators.BasicActivator; import com.fr.startup.activators.BasicActivator;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
@ -49,6 +52,16 @@ public class DesignerStartup extends Activator {
SplashContext.getInstance().hide(); SplashContext.getInstance().hide();
DesignerContext.getDesignerFrame().getProgressDialog().setVisible(true); DesignerContext.getDesignerFrame().getProgressDialog().setVisible(true);
//需要切换工作目录的弹窗放在打开设计器后,以免被挡住
if (args != null) {
for (String arg : args) {
if (ComparatorUtils.equals(arg, "demo")) {
ServerStarter.switchWorkContext();
break;
}
}
}
startSub(StartFinishActivator.class); startSub(StartFinishActivator.class);
} }

Loading…
Cancel
Save