forked from fanruan/design
hzzz
7 years ago
3 changed files with 46 additions and 3 deletions
@ -0,0 +1,43 @@
|
||||
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.EnvEvent; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.event.Event; |
||||
import com.fr.event.EventDispatcher; |
||||
import com.fr.event.Listener; |
||||
import com.fr.event.Null; |
||||
import com.fr.general.Inter; |
||||
import com.fr.stable.AssistUtils; |
||||
|
||||
import javax.swing.JOptionPane; |
||||
|
||||
|
||||
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);
|
||||
} |
||||
} |
Loading…
Reference in new issue