Examples of EditorState


Examples of net.sourceforge.jiu.apps.EditorState

   * Creates a {@link JiuAwtFrame} object.
   * @param args program arguments, call jiuawt with <code>--help</code> as single argument to get a help screen
   */
  public static void main(String[] args)
  {
    EditorState state = new EditorState();
    int index = 0;
    while (index < args.length)
    {
      String s = args[index++];
      if ("--dir".equals(s))
      {
        if (index == args.length)
        {
          throw new IllegalArgumentException("Directory switch must be followed by a directory name.");
        }
        state.setCurrentDirectory(args[index++]);
      }
      else
      if ("--help".equals(s))
      {
        printVersion();
        System.out.println();
        System.out.println("Usage: jiuawt [OPTIONS] [FILE]");
        System.out.println("\tFILE is the name of an image file to be loaded after start-up");
        System.out.println("\t--dir  DIRECTORY  set working directory to DIRECTORY");
        System.out.println("\t--help            print this help screen and exit");
        System.out.println("\t--lang LANGCODE   set language to LANGCODE (de=German, en=English, es=Spanish)");
        System.out.println("\t--system          print system info and exit");
        System.out.println("\t--version         print version information and exit");
        System.exit(0);
      }
      else
      if ("--lang".equals(s))
      {
        if (index == args.length)
        {
          throw new IllegalArgumentException("Language switch must be followed by language code.");
        }
        state.setStrings(args[index++]);
      }
      else
      if ("--system".equals(s))
      {
        String info = SystemInfo.getSystemInfo(state.getStrings());
        System.out.println(info);
        System.exit(0);
      }
      else
      if ("--version".equals(s))
      {
        printVersion();
        System.exit(0);
      }
      else
      {
        if (s.startsWith("-"))
        {
          throw new IllegalArgumentException("Unknown switch: " + s);
        }
        else
        {
          state.setStartupImageName(s);
        }
      }
    }
    state.ensureStringsAvailable();
    new JiuAwtFrame(state);
  }
View Full Code Here

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

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

            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
Copyright © 2018 www.massapi.com. 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.