Browse Source

REPORT-8790 改动太多了,先commit一次

master
ju 7 years ago
parent
commit
a48c9ab91c
  1. 23
      designer-base/src/com/fr/design/DesignerEnvManager.java
  2. 14
      designer-base/src/com/fr/design/actions/file/SwitchExistEnv.java
  3. 29
      designer-base/src/com/fr/design/env/DesignerWorkspaceGenerator.java
  4. 22
      designer-base/src/com/fr/design/env/EnvGenerator.java
  5. 5
      designer-base/src/com/fr/design/env/RemoteEnvConfig.java
  6. 61
      designer-base/src/com/fr/design/env/RemoteWorkspace.java
  7. 4
      designer-base/src/com/fr/design/file/HistoryTemplateListPane.java
  8. 4
      designer-base/src/com/fr/design/file/TemplateTreePane.java
  9. 24
      designer-base/src/com/fr/design/mainframe/DesignerFrame.java
  10. 18
      designer-base/src/com/fr/design/mainframe/TemplatePane.java
  11. 6
      designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java
  12. 4
      designer-base/src/com/fr/env/EnvListPane.java
  13. 2
      designer-base/src/com/fr/env/LocalEnvPane.java
  14. 30
      designer-base/src/com/fr/env/RemoteEnv.java
  15. 1
      designer-base/src/com/fr/env/RemoteEnvPane.java
  16. 46
      designer-base/src/com/fr/env/SignIn.java
  17. 6
      designer-base/src/com/fr/start/ServerStarter.java
  18. 10
      designer-realize/src/com/fr/start/EnvSwitcher.java
  19. 15
      designer-realize/src/com/fr/start/module/DesignerEnvProvider.java
  20. 2
      designer-realize/src/com/fr/start/module/DesignerStartup.java

23
designer-base/src/com/fr/design/DesignerEnvManager.java

@ -6,12 +6,11 @@ package com.fr.design;
import com.fr.base.BaseXMLUtils;
import com.fr.base.FRContext;
import com.fr.base.Utils;
import com.fr.base.env.EnvUpdater;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.impl.LocalEnvConfig;
import com.fr.base.env.EnvConfig;
import com.fr.base.env.LocalEnvConfig;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.constants.UIConstants;
import com.fr.design.env.EnvGenerator;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.file.FILEFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogFormatter;
@ -33,6 +32,7 @@ import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.workspace.WorkContext;
import javax.swing.*;
import javax.swing.SwingWorker.StateValue;
@ -194,7 +194,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (installHome != null) {
String name = Inter.getLocText("FR-Engine_DEFAULT");
String envPath = StableUtils.pathJoin(new String[]{installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME});
designerEnvManager.putEnv(name, new LocalEnvConfig(envPath));
designerEnvManager.putEnv(name, new LocalEnvConfig(envPath, name));
designerEnvManager.setCurEnvName(name);
}
}
@ -482,7 +482,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
/**
* 返回默认环境
*/
public EnvConfig getDefaultEnv() {
public EnvConfig getDefaultConfig() {
String installHome = StableUtils.getInstallHome();
String defaultenvPath = StableUtils.pathJoin(installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME);
defaultenvPath = new File(defaultenvPath).getPath();
@ -494,8 +494,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
return env;
}
}
EnvConfig newDefaultEnv = new LocalEnvConfig(defaultenvPath);
this.putEnv(Inter.getLocText(new String[]{"Default", "Utils-Report_Runtime_Env"}), newDefaultEnv);
String name = Inter.getLocText(new String[]{"Default", "Utils-Report_Runtime_Env"});
EnvConfig newDefaultEnv = new LocalEnvConfig(defaultenvPath, name);
this.putEnv(name, newDefaultEnv);
return newDefaultEnv;
}
@ -526,7 +527,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (isCurrentEnvDefault()) {
return;
}
EnvUpdater.updateEnv(EnvGenerator.generate(getDefaultEnv()));
WorkContext.switchTo(DesignerWorkspaceGenerator.generate(getDefaultConfig()));
}
/**
@ -1416,9 +1417,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if ((tmpVal = reader.getAttrAsString("webinfLocation", null)) != null) {
// marks:兼容6.1的
// marks:设置默认的目录.
EnvConfig reportServer = new LocalEnvConfig(tmpVal);
String curReportServerName = Inter.getLocText("Server-Embedded_Server");
EnvConfig reportServer = new LocalEnvConfig(tmpVal,curReportServerName);
this.putEnv(curReportServerName, reportServer);
this.setCurEnvName(curReportServerName);
}

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

@ -1,15 +1,13 @@
package com.fr.design.actions.file;
import com.fr.base.BaseUtils;
import com.fr.base.env.Callback;
import com.fr.base.env.EnvUpdater;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.impl.LocalEnvConfig;
import com.fr.base.env.EnvConfig;
import com.fr.base.env.LocalEnvConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.ResponseDataSourceChange;
import com.fr.design.env.EnvGenerator;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.RemoteEnvConfig;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext;
@ -19,11 +17,11 @@ import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.utils.DesignUtils;
import com.fr.env.RemoteEnv;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EnvChangedListener;
import com.fr.workspace.WorkContext;
import com.fr.workspace.WorkContextCallback;
import javax.swing.*;
import java.awt.event.ActionEvent;
@ -102,7 +100,7 @@ public class SwitchExistEnv extends MenuDef {
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
final String envName = getName();
EnvConfig selectedEnv = envManager.getEnv(envName);
EnvUpdater.updateEnv(EnvGenerator.generate(selectedEnv), new Callback() {
WorkContext.switchTo(DesignerWorkspaceGenerator.generate(selectedEnv), new WorkContextCallback() {
@Override
public void success() {
DesignerEnvManager.getEnvManager().setCurEnvName(envName);

29
designer-base/src/com/fr/design/env/DesignerWorkspaceGenerator.java vendored

@ -0,0 +1,29 @@
package com.fr.design.env;
import com.fr.base.Env;
import com.fr.base.env.EnvConfig;
import com.fr.base.env.LocalEnvConfig;
import com.fr.env.RemoteEnv;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.connect.WorkspaceClient;
import com.fr.workspace.connect.WorkspaceConnection;
/**
* 根据配置生成运行环境
*/
public class DesignerWorkspaceGenerator {
public static Workspace generate(EnvConfig config) {
Workspace workspace = null;
if (config instanceof LocalEnvConfig) {
workspace = WorkContext.getFactory().build(config.getPath());
} else if (config instanceof RemoteEnvConfig) {
RemoteEnvConfig remoteConfig = (RemoteEnvConfig) config;
WorkspaceClient client = WorkContext.getConnector().connect(new WorkspaceConnection(remoteConfig.getHost(), remoteConfig.getPort(), remoteConfig.getUsername(), remoteConfig.getPassword()));
workspace = new RemoteWorkspace(client, remoteConfig.getHost() + ":" + remoteConfig.getPort(), remoteConfig.getPassword());
}
return workspace;
}
}

22
designer-base/src/com/fr/design/env/EnvGenerator.java vendored

@ -1,22 +0,0 @@
package com.fr.design.env;
import com.fr.base.Env;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.impl.LocalEnvConfig;
import com.fr.dav.LocalEnv;
import com.fr.env.RemoteEnv;
/**
* 根据配置生成运行环境
*/
public class EnvGenerator {
public static Env generate(EnvConfig config) {
Env env = null;
if (config instanceof LocalEnvConfig) {
env = new LocalEnv((LocalEnvConfig)config);
} else if (config instanceof RemoteEnvConfig) {
env = new RemoteEnv((RemoteEnvConfig) config);
}
return env;
}
}

5
designer-base/src/com/fr/design/env/RemoteEnvConfig.java vendored

@ -1,6 +1,6 @@
package com.fr.design.env;
import com.fr.core.env.impl.AbstractEnvConfig;
import com.fr.base.env.AbstractEnvConfig;
import com.fr.general.Inter;
import com.fr.security.SecurityToolbox;
import com.fr.stable.AssistUtils;
@ -21,9 +21,12 @@ public class RemoteEnvConfig extends AbstractEnvConfig {
public RemoteEnvConfig() {
super(name);
}
public RemoteEnvConfig(String host, int port, String username, String password) {
super(name);
this.host = host;
this.port = port;
this.username = username;

61
designer-base/src/com/fr/design/env/RemoteWorkspace.java vendored

@ -0,0 +1,61 @@
package com.fr.design.env;
import com.fr.general.Inter;
import com.fr.workspace.Workspace;
import com.fr.workspace.connect.WorkspaceClient;
/**
* Created by juhaoyu on 2018/6/14.
* 远程工作目录
*/
public class RemoteWorkspace implements Workspace {
private final WorkspaceClient client;
private final String address;
private final String userName;
public RemoteWorkspace(WorkspaceClient client, String address, String userName) {
this.client = client;
this.address = address;
this.userName = userName;
}
@Override
public String getName() {
return userName;
}
@Override
public String getPath() {
return address;
}
@Override
public String getDescription() {
return userName + "@" + "[" + Inter.getLocText("Fine-Designer_Basic_Remote_Env") + "]";
}
@Override
public boolean isWarDeploy() {
return false;
}
@Override
public boolean isLocal() {
return false;
}
@Override
public <T> T get(Class<T> type) {
return client.getPool().get(type);
}
}

4
designer-base/src/com/fr/design/file/HistoryTemplateListPane.java

@ -3,7 +3,6 @@ package com.fr.design.file;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.dav.LocalEnv;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants;
@ -25,6 +24,7 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
@ -368,7 +368,7 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C
FileNode fileNode = new FileNode(((JTemplate<?, ?>) list.getSelectedValue()).getEditingFILE().getPath(), false);
Env env = FRContext.getCurrentEnv();
if (env.isLocalEnv()) {
IOUtils.openWindowsFolder(StableUtils.pathJoin(env.getEnvConfig().getPath(), fileNode.getEnvPath()));
IOUtils.openWindowsFolder(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), fileNode.getEnvPath()));
}
}

4
designer-base/src/com/fr/design/file/TemplateTreePane.java

@ -6,7 +6,6 @@ package com.fr.design.file;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.base.io.FileAssistUtils;
import com.fr.dav.LocalEnv;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.layout.FRGUIPaneFactory;
@ -23,6 +22,7 @@ import com.fr.stable.CoreConstants;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
@ -147,7 +147,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
try {
Desktop.getDesktop().open(new File(filePath));
} catch (Exception e) {
IOUtils.openWindowsFolder(StableUtils.pathJoin(localEnv.getEnvConfig().getPath(), fn.getEnvPath()));
IOUtils.openWindowsFolder(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), fn.getEnvPath()));
}
}

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

@ -5,8 +5,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.env.EnvUpdater;
import com.fr.core.env.EnvConfig;
import com.fr.base.env.EnvConfig;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager;
@ -54,24 +53,11 @@ import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.image4j.codec.ico.ICODecoder;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLayeredPane;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import javax.swing.*;
import javax.swing.border.MatteBorder;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.DnDConstants;
@ -993,7 +979,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
DesignerEnvManager.getEnvManager().saveXMLFile();
EnvUpdater.disconnect();
WorkContext.switchTo(null);
this.setVisible(false);
this.dispose();

18
designer-base/src/com/fr/design/mainframe/TemplatePane.java

@ -1,16 +1,13 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.env.Callback;
import com.fr.base.env.EnvUpdater;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.impl.LocalEnvConfig;
import com.fr.base.env.EnvConfig;
import com.fr.base.env.LocalEnvConfig;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.InformationWarnPane;
import com.fr.design.env.EnvGenerator;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.RemoteEnvConfig;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.TemplateTreePane;
@ -18,14 +15,12 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.DesignUtils;
import com.fr.env.EnvListPane;
import com.fr.env.RemoteEnv;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.WorkContextCallback;
import javax.swing.*;
import java.awt.*;
@ -120,7 +115,7 @@ public class TemplatePane extends JPanel implements MouseListener {
EnvConfig selectedEnv = envManager.getEnv(selectedName);
GeneralContext.fireEnvWillChangeListener();
try {
EnvUpdater.updateEnv(EnvGenerator.generate(selectedEnv), new Callback() {
WorkContext.switchTo(DesignerWorkspaceGenerator.generate(selectedEnv), new WorkContextCallback() {
@Override
public void fail() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}));
@ -128,7 +123,6 @@ public class TemplatePane extends JPanel implements MouseListener {
@Override
public void success() {
DesignerEnvManager.getEnvManager().setCurEnvName(selectedName);
DesignUtils.refreshDesignerFrame();
}
});

6
designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java

@ -2,13 +2,10 @@ package com.fr.design.mainframe.loghandler.socketio;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.config.ConfigEvent;
import com.fr.config.Configuration;
import com.fr.core.env.EnvConfig;
import com.fr.base.env.EnvConfig;
import com.fr.core.env.EnvConstants;
import com.fr.core.env.EnvContext;
import com.fr.core.env.EnvEvent;
import com.fr.core.env.impl.LocalEnvConfig;
import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.design.env.RemoteEnvConfig;
import com.fr.design.mainframe.loghandler.DesignerLogHandler;
@ -27,7 +24,6 @@ import io.socket.emitter.Emitter;
import java.io.ByteArrayInputStream;
import java.net.URI;
import java.net.URL;
public class DesignerSocketIO {

4
designer-base/src/com/fr/env/EnvListPane.java vendored

@ -1,7 +1,7 @@
package com.fr.env;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.impl.LocalEnvConfig;
import com.fr.base.env.EnvConfig;
import com.fr.base.env.LocalEnvConfig;
import com.fr.design.env.RemoteEnvConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.controlpane.JListControlPane;

2
designer-base/src/com/fr/env/LocalEnvPane.java vendored

@ -1,6 +1,6 @@
package com.fr.env;
import com.fr.core.env.impl.LocalEnvConfig;
import com.fr.base.env.LocalEnvConfig;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea;

30
designer-base/src/com/fr/env/RemoteEnv.java vendored

@ -6,9 +6,6 @@ import com.fr.base.operator.connect.ConnectOperator;
import com.fr.base.operator.file.FileOperator;
import com.fr.base.operator.org.OrganizationOperator;
import com.fr.base.remote.RemoteDeziConstants;
import com.fr.common.rpc.RemoteCallServerConfig;
import com.fr.common.rpc.netty.MessageSendExecutor;
import com.fr.common.rpc.netty.RemoteCallClient;
import com.fr.core.env.EnvConstants;
import com.fr.core.env.EnvContext;
import com.fr.data.impl.storeproc.StoreProcedure;
@ -20,7 +17,6 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.file.CacheManager;
import com.fr.general.CommonIOUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.EnvProxyFactory;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.general.http.HttpToolbox;
@ -42,6 +38,9 @@ import com.fr.stable.project.ProjectConstants;
import com.fr.third.guava.base.Strings;
import com.fr.third.guava.collect.ImmutableMap;
import com.fr.web.ResourceConstants;
import com.fr.workspace.engine.server.rpc.RemoteCallServerConfig;
import com.fr.workspace.engine.server.rpc.netty.MessageSendExecutor;
import com.fr.workspace.engine.server.rpc.netty.RemoteCallClient;
import javax.swing.*;
import javax.xml.transform.Source;
@ -109,24 +108,6 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut
return true;
}
@Override
public EnvProxyFactory getProxyFactory() {
return new EnvProxyFactory() {
@Override
public <T> T get(Class<T> clazz, T obj) {
assert clazz != null;
try {
return MessageSendExecutor.getInstance().execute(clazz);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
};
}
@Override
public FileOperator getFileOperator() throws Exception {
@ -143,11 +124,6 @@ public class RemoteEnv extends AbstractEnv<RemoteEnvConfig> implements DesignAut
return MessageSendExecutor.getInstance().execute(OrganizationOperator.class);
}
@Override
public RemoteEnvConfig getEnvConfig() {
return config;
}
@Override
public String getPath() {
return config.getPath();

1
designer-base/src/com/fr/env/RemoteEnvPane.java vendored

@ -1,7 +1,6 @@
package com.fr.env;
import com.fr.base.FRContext;
import com.fr.core.env.resource.EnvConfigUtils;
import com.fr.design.env.RemoteEnvConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.beans.BasicBeanPane;

46
designer-base/src/com/fr/env/SignIn.java vendored

@ -1,46 +0,0 @@
package com.fr.env;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.EnvContext;
import com.fr.core.env.EnvEvent;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.DesignUtils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.AssistUtils;
import javax.swing.*;
public class SignIn {
static {
EventDispatcher.listen(EnvEvent.CONNECTION_ERROR, new Listener<Null>() {
@Override
public void on(Event event, Null param) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Datasource-Connection_failed"));
}
});
}
/**
* 注册入环境
*
* @param selectedEnv 选择的环境
* @throws Exception 异常
*/
public static void signIn(EnvConfig selectedEnv) throws Exception {
Env env = FRContext.getCurrentEnv();
if (env != null && AssistUtils.equals(env.getEnvConfig(), selectedEnv)) {
env.disconnect();
}
//DesignUtils.switchToEnv(selectedEnv);
}
}

6
designer-base/src/com/fr/start/ServerStarter.java

@ -2,13 +2,12 @@ package com.fr.start;
import com.fr.base.FRContext;
import com.fr.base.ServerConfig;
import com.fr.base.env.EnvUpdater;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.env.EnvGenerator;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.mainframe.DesignerContext;
@ -22,6 +21,7 @@ import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.start.server.FineEmbedServer;
import com.fr.workspace.WorkContext;
import javax.swing.*;
import java.awt.*;
@ -54,7 +54,7 @@ public class ServerStarter {
@Override
public void doOk() {
try {
EnvUpdater.updateEnv(EnvGenerator.generate(DesignerEnvManager.getEnvManager().getDefaultEnv()));
WorkContext.switchTo(DesignerWorkspaceGenerator.generate(DesignerEnvManager.getEnvManager().getDefaultConfig()));
TemplateTreePane.getInstance().refreshDockingView();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
} catch (Exception e) {

10
designer-realize/src/com/fr/start/EnvSwitcher.java

@ -1,10 +1,10 @@
package com.fr.start;
import com.fr.base.Env;
import com.fr.base.env.EnvUpdater;
import com.fr.design.DesignerEnvManager;
import com.fr.design.env.EnvGenerator;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.mainframe.TemplatePane;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
/**
* Created by juhaoyu on 2018/1/31.
@ -16,8 +16,8 @@ public class EnvSwitcher {
try {
String current = DesignerEnvManager.getEnvManager().getCurEnvName();
Env env = EnvGenerator.generate(DesignerEnvManager.getEnvManager().getEnv(current));
EnvUpdater.updateEnv(env);
Workspace workspace = DesignerWorkspaceGenerator.generate(DesignerEnvManager.getEnvManager().getEnv(current));
WorkContext.switchTo(workspace);
} catch (Exception e) {
TemplatePane.getInstance().dealEvnExceptionWhenStartDesigner();
}

15
designer-realize/src/com/fr/start/module/DesignerEnvProvider.java

@ -1,15 +1,11 @@
package com.fr.start.module;
import com.fr.base.Env;
import com.fr.base.ModifiedTable;
import com.fr.base.Parameter;
import com.fr.base.StoreProcedureParameter;
import com.fr.base.TableData;
import com.fr.base.env.EnvUpdater;
import com.fr.base.env.serializer.OldSerializerAdapter;
import com.fr.base.env.serializer.ProcedureDataModelSerializer;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.EnvEvent;
import com.fr.core.env.proxy.EnvProxy;
import com.fr.data.core.db.TableProcedure;
import com.fr.data.impl.Connection;
@ -17,10 +13,6 @@ import com.fr.data.impl.storeproc.ProcedureDataModel;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.dav.DavXMLUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.env.EnvGenerator;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.module.Activator;
@ -58,13 +50,6 @@ public class DesignerEnvProvider extends Activator {
private void initDesignerEnv() {
addSerializers();
EventDispatcher.listen(EnvEvent.BEFORE_SIGN_IN, new Listener<EnvConfig>() {
@Override
public void on(Event event, EnvConfig envConfig) {
Env env = EnvGenerator.generate(envConfig);
EnvUpdater.updateEnv(env);
}
});
}
private void addSerializers() {

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

@ -1,6 +1,6 @@
package com.fr.start.module;
import com.fr.core.env.EnvConfig;
import com.fr.base.env.EnvConfig;
import com.fr.core.env.EnvEvent;
import com.fr.event.Event;
import com.fr.event.Listener;

Loading…
Cancel
Save