return m_shared_GWTState.getClassLoader();
}
// use same GwtState for same editor
boolean hasCurrentEditor = GwtEditorLifeCycleListener.hasCurrentEditor();
if (hasCurrentEditor) {
GwtState state = GwtEditorLifeCycleListener.getCurrentEditorState();
if (state != null) {
editor.putGlobalValue(UIObjectInfo.STATE_KEY, state);
rememberVariable_isStrictMode(editorState, state);
state.activate();
return state.getClassLoader();
}
}
// prepare module
ModuleDescription moduleDescription = Utils.getSingleModule(modelUnit);
if (moduleDescription == null) {
throw new DesignerException(IExceptionConstants.NO_MODULE_FILE);
}
// always include standard D2 ClassLoader's
CompositeClassLoader parentClassLoader;
{
parentClassLoader = createClassLoader_parent(editor);
initializeClassLoader_parent(editor, parentClassLoader);
// add ClassLoader to use only for loading resources
{
ClassLoader resourcesClassLoader = moduleDescription.getClassLoader();
parentClassLoader.add(resourcesClassLoader, ImmutableList.<String>of(), null);
}
}
// initialize GWTState
final GwtState state = new GwtState(parentClassLoader, moduleDescription);
try {
state.initialize();
editor.putGlobalValue(UIObjectInfo.STATE_KEY, state);
rememberVariable_isStrictMode(editorState, state);
} catch (Throwable e) {
state.dispose();
ReflectionUtils.propagate(e);
}
// remember shared state
if (m_sharedUse) {
state.setShared(true);
m_shared_GWTState = state;
}
// remember editor GwtState
GwtEditorLifeCycleListener.setCurrentEditorState(state);
// remember ClassLoader
ClassLoader gwtClassLoader = state.getClassLoader();
// validate
try {
validate(javaProject, state);
} catch (Throwable e) {
state.dispose();
ReflectionUtils.propagate(e);
}
// dispose GWTState during hierarchy dispose
if (!hasCurrentEditor) {
editorState.getBroadcast().addListener(null, new ObjectEventListener() {
@Override
public void dispose() throws Exception {
state.dispose();
}
});
}
// final result
return gwtClassLoader;