|
|
|
@ -22,19 +22,7 @@ import java.util.concurrent.ExecutorService;
|
|
|
|
|
*/ |
|
|
|
|
public class DesignerWorkspaceActivator extends Activator { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void start() { |
|
|
|
|
|
|
|
|
|
registerEnvListener(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 注册切换环境前后事件监听 |
|
|
|
|
*/ |
|
|
|
|
private void registerEnvListener() { |
|
|
|
|
|
|
|
|
|
/*切换环境前,关闭所有相关模块,最后执行*/ |
|
|
|
|
listenEvent(WorkspaceEvent.BeforeSwitch, new Listener<Workspace>(Integer.MIN_VALUE) { |
|
|
|
|
private final Listener<Workspace> stopModuleAction = new Listener<Workspace>(Integer.MIN_VALUE) { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void on(Event event, Workspace current) { |
|
|
|
@ -52,9 +40,9 @@ public class DesignerWorkspaceActivator extends Activator {
|
|
|
|
|
return module.profileStop(); |
|
|
|
|
})); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
/*切换环境后,重新启动所有相关模块,最先执行*/ |
|
|
|
|
listenEvent(WorkspaceEvent.AfterSwitch, new Listener<Workspace>(Integer.MAX_VALUE) { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
private final Listener<Workspace> startModuleAction = new Listener<Workspace>(Integer.MAX_VALUE) { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void on(Event event, Workspace current) { |
|
|
|
@ -72,7 +60,23 @@ public class DesignerWorkspaceActivator extends Activator {
|
|
|
|
|
return module.profile(); |
|
|
|
|
})); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void start() { |
|
|
|
|
|
|
|
|
|
registerEnvListener(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 注册切换环境前后事件监听 |
|
|
|
|
*/ |
|
|
|
|
private void registerEnvListener() { |
|
|
|
|
|
|
|
|
|
/*切换环境前,关闭所有相关模块,最后执行*/ |
|
|
|
|
listenEvent(WorkspaceEvent.BeforeSwitch, stopModuleAction); |
|
|
|
|
/*切换环境后,重新启动所有相关模块,最先执行*/ |
|
|
|
|
listenEvent(WorkspaceEvent.AfterSwitch, startModuleAction); |
|
|
|
|
/*切换环境前,存储一下打开的所有文件对象,要先于 关闭相关模块部分 被触发*/ |
|
|
|
|
listenEvent(WorkspaceEvent.BeforeSwitch, new Listener<Workspace>(Integer.MAX_VALUE) { |
|
|
|
|
|
|
|
|
|