EngineStartupListener

来自ling
跳转至: 导航搜索

实现onStartup可初始化一些static值

package com.bstek.dorado.cloudo.workbench;

import com.bstek.dorado.core.Context;
import com.bstek.dorado.core.EngineStartupListener;

public class StartupListener extends EngineStartupListener {

	public void onStartup() throws Exception {
		Context doradoContext = Context.getCurrent();

		IFileExplorer fileController;
	
		try {
			fileController = (IFileExplorer) doradoContext
					.getServiceBean("cloudo.FileExplorer");
		} catch (Exception e) {
			fileController = new DefaultFileExplorer();
		}

		IDEContext.setFileExplorer(fileController);
	}

}


public class IDEContext {
	private static IFileExplorer fileExplorer;
	
	public static IFileExplorer getFileExplorer() {
		return fileExplorer;
	}

	public static void setFileExplorer(IFileExplorer fileController) {
		IDEContext.fileExplorer = fileController;
	}

}