Package org.eclipse.wb.internal.core.utils.state

Examples of org.eclipse.wb.internal.core.utils.state.EditorState


    return IPreferenceConstants.TOOLKIT_ID;
  }

  @Override
  protected ClassLoader getClassLoader(AstEditor editor) throws Exception {
    EditorState editorState = EditorState.get(editor);
    IJavaProject javaProject = editor.getJavaProject();
    ICompilationUnit modelUnit = editor.getModelUnit();
    // check for shared GWTState
    if (m_sharedUse && m_shared_GWTState != null) {
      editor.putGlobalValue(UIObjectInfo.STATE_KEY, m_shared_GWTState);
      rememberVariable_isStrictMode(editorState, m_shared_GWTState);
      m_shared_GWTState.activate();
      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();
        }
      });
View Full Code Here


            return;
          }
          // evaluate arguments
          List<Object> argumentValues;
          {
            EditorState state = JavaInfoUtils.getState(m_this);
            EvaluationContext context =
                new EvaluationContext(state.getEditorLoader(), state.getFlowDescription());
            argumentValues = Lists.newArrayList();
            for (Expression argument : arguments) {
              Object value = AstEvaluationEngine.evaluate(context, argument);
              JavaInfoEvaluationHelper.setValue(argument, value);
              argumentValues.add(value);
View Full Code Here

TOP

Related Classes of org.eclipse.wb.internal.core.utils.state.EditorState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.