/**
   * Removes the marker annotation values which are shown on the general Annotations page from the
   * given store and prevents setting the default values in the future.
   *
   * <p>Note: In order to work this method must be called before any call to {@link
   * #initializeDefaultValues(IPreferenceStore)}
   *
   * <p>This method is not part of the API and must only be called by {@link
   * org.eclipse.ui.editors.text.EditorsUI}
   *
   * @param store the preference store to be initialized
   * @throws IllegalStateException if not called by {@link org.eclipse.ui.editors.text.EditorsUI}
   * @since 3.0
   */
  public static void useAnnotationsPreferencePage(IPreferenceStore store)
      throws IllegalStateException {
    checkAccess();

    store.putValue(
        AbstractDecoratedTextEditorPreferenceConstants.USE_ANNOTATIONS_PREFERENCE_PAGE,
        Boolean.toString(true));

    MarkerAnnotationPreferences preferences =
        EditorsPlugin.getDefault().getMarkerAnnotationPreferences();
    Iterator<AnnotationPreference> e = preferences.getAnnotationPreferences().iterator();
    while (e.hasNext()) {
      AnnotationPreference info = e.next();

      // Only reset annotations shown on Annotations preference page
      if (!info.isIncludeOnPreferencePage() || !isComplete(info)) continue;

      store.setToDefault(info.getTextPreferenceKey());
      store.setToDefault(info.getOverviewRulerPreferenceKey());
      if (info.getVerticalRulerPreferenceKey() != null)
        store.setToDefault(info.getVerticalRulerPreferenceKey());
      store.setToDefault(info.getColorPreferenceKey());
      if (info.getShowInNextPrevDropdownToolbarActionKey() != null)
        store.setToDefault(info.getShowInNextPrevDropdownToolbarActionKey());
      if (info.getIsGoToNextNavigationTargetKey() != null)
        store.setToDefault(info.getIsGoToNextNavigationTargetKey());
      if (info.getIsGoToPreviousNavigationTargetKey() != null)
        store.setToDefault(info.getIsGoToPreviousNavigationTargetKey());
      if (info.getHighlightPreferenceKey() != null)
        store.setToDefault(info.getHighlightPreferenceKey());
      if (info.getTextStylePreferenceKey() != null)
        store.setToDefault(info.getTextStylePreferenceKey());
    }
  }
コード例 #2
0
  public void testColorPrefs() throws Exception {
    IPreferenceStore store = PreferenceConstants.getPreferenceStore();
    PreferenceConstants.initializeDefaultValues(store);

    // openTestEditor("");
    fail("Open test editor");

    IPreferenceStore prefs = testEditor.getPreferences();
    Display display = testEditor.getViewer().getTextWidget().getDisplay();
    Color ebg = DartUI.getEditorBackground(prefs, display);
    Color efg = DartUI.getEditorForeground(prefs, display);
    Color esbg = DartUI.getEditorSelectionBackground(prefs, display);
    Color esfg = DartUI.getEditorSelectionForeground(prefs, display);
    assertNull(ebg);
    assertNull(efg);
    assertNull(esbg);
    assertNull(esfg);
    // simulate changing theme
    store.putValue("AbstractTextEditor.Color.Foreground.SystemDefault", "false");
    store.putValue("AbstractTextEditor.Color.Background.SystemDefault", "false");
    store.putValue("AbstractTextEditor.Color.SelectionBackground.SystemDefault", "false");
    store.putValue("AbstractTextEditor.Color.SelectionForeground.SystemDefault", "false");
    store.putValue("AbstractTextEditor.Color.Foreground", "0,0,0");
    store.putValue("AbstractTextEditor.Color.Background", "1,1,1");
    store.putValue("AbstractTextEditor.Color.SelectionForeground", "10,10,10");
    store.putValue("AbstractTextEditor.Color.SelectionBackground", "11,11,11");
    ebg = DartUI.getEditorBackground(prefs, display);
    efg = DartUI.getEditorForeground(prefs, display);
    esbg = DartUI.getEditorSelectionBackground(prefs, display);
    esfg = DartUI.getEditorSelectionForeground(prefs, display);
    assertNotNull(ebg);
    assertNotNull(efg);
    assertNotNull(esbg);
    assertNotNull(esfg);
    // simulate restoring defaults
    store.setToDefault("AbstractTextEditor.Color.Foreground.SystemDefault");
    store.setToDefault("AbstractTextEditor.Color.Background.SystemDefault");
    store.setToDefault("AbstractTextEditor.Color.SelectionBackground.SystemDefault");
    store.setToDefault("AbstractTextEditor.Color.SelectionForeground.SystemDefault");
    store.setToDefault("AbstractTextEditor.Color.Foreground");
    store.setToDefault("AbstractTextEditor.Color.Background");
    store.setToDefault("AbstractTextEditor.Color.SelectionForeground");
    store.setToDefault("AbstractTextEditor.Color.SelectionBackground");
    ebg = DartUI.getEditorBackground(prefs, display);
    efg = DartUI.getEditorForeground(prefs, display);
    esbg = DartUI.getEditorSelectionBackground(prefs, display);
    esfg = DartUI.getEditorSelectionForeground(prefs, display);
    assertNull(ebg);
    assertNull(efg);
    assertNull(esbg);
    assertNull(esfg);
  }
コード例 #3
0
  /**
   * @see
   *     org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
   */
  public void initializeDefaultPreferences() {
    IPreferenceStore store = UnifiedEditorsPlugin.getDefault().getPreferenceStore();

    store.setDefault(com.aptana.ide.core.preferences.IPreferenceConstants.SHOW_LIVE_HELP, true);

    store.setDefault(IPreferenceConstants.CACHE_BUST_BROWSERS, true);
    store.setDefault(IPreferenceConstants.PIANO_KEY_DIFFERENCE, 7);
    store.setDefault(IPreferenceConstants.MATCH_BRACKETS, "true"); // $NON-NLS-1$
    store.setDefault(
        IPreferenceConstants.MATCH_BRACKETS_COLOR,
        StringConverter.asString(new RGB(150, 150, 150)));
    store.setDefault(IPreferenceConstants.SHOW_WHITESPACE, false);
    store.setDefault(IPreferenceConstants.ENABLE_WORD_WRAP, false);
    store.setDefault(IPreferenceConstants.USER_AGENT_PREFERENCE, "IE,Mozilla"); // $NON-NLS-1$
    store.setDefault(IPreferenceConstants.INSERT_ON_TAB, false);

    store.setDefault(AbstractTextEditor.PREFERENCE_NAVIGATION_SMART_HOME_END, false);
    store.setDefault(IPreferenceConstants.CONTENT_ASSIST_DELAY, 200);
    store.setDefault(IPreferenceConstants.COLORIZER_TEXT_HIGHLIGHT_ENABLED, false);
    store.setDefault(
        IPreferenceConstants.COLORIZER_TEXT_HIGHLIGHT_BACKGROUND_COLOR,
        StringConverter.asString(new RGB(212, 212, 212)));
    store.setDefault(IPreferenceConstants.COLORIZER_MAXCOLUMNS, 500);
    store.setDefault(IPreferenceConstants.EXPAND_EDITOR_OPTIONS, true);
    store.setDefault(IPreferenceConstants.EXPAND_TOKENS, true);
    store.setDefault(IPreferenceConstants.EXPAND_REGIONS, false);
    store.setDefault(IPreferenceConstants.SHOW_ERRORS, true);
    store.setDefault(IPreferenceConstants.SHOW_WARNINGS, false);
    store.setDefault(IPreferenceConstants.SHOW_INFOS, false);
    store.setDefault(IPreferenceConstants.DRAG_AND_DROP_ENABLED, true);
    store.setDefault(IPreferenceConstants.SORT_OUTLINE_ALPHABETICALLY, false);
    store.setDefault(IPreferenceConstants.PARSER_OFF_UI, true);

    // Tasks
    store.setDefault(IPreferenceConstants.COMPILER_TASK_CASE_SENSITIVE, true);
    store.setDefault(IPreferenceConstants.COMPILER_TASK_TAGS, "TODO,FIXME,XXX,OPTIMIZE");
    store.setDefault(IPreferenceConstants.COMPILER_TASK_PRIORITIES, "NORMAL,HIGH,NORMAL,LOW");

    // These two _must_ be set as a preference, or UnifiedEditor will crash
    // hard without
    // warning on initialization.
    // store.setDefault(ColorizerPreferencePage.HRD_SET, "default");
    // store.setDefault(ColorizerPreferencePage.USE_BACK, true);
    //
    // store.setDefault(ColorizerPreferencePage.FULL_BACK, true);
    // store.setDefault(ColorizerPreferencePage.PAIRS_MATCH,
    // "PAIRS_OUTLINE");
    //
    // store.setDefault(ColorizerPreferencePage.HORZ_CROSS, true);
    // store.setDefault(ColorizerPreferencePage.VERT_CROSS, true);

    // To set preferences for AbstractTextEditor
    store = org.eclipse.ui.internal.editors.text.EditorsPlugin.getDefault().getPreferenceStore();
    store.setToDefault(AbstractTextEditor.PREFERENCE_NAVIGATION_SMART_HOME_END);
    store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_UNDO_HISTORY_SIZE, 500);
  }
  /**
   * Removes the Quick Diff marker annotation values which are shown on the general Quick Diff page
   * from the given store and prevents setting the default values in the future.
   *
   * <p>Note: In order to work this method must be called before any call to {@link
   * #initializeDefaultValues(IPreferenceStore)}
   *
   * <p>This method is not part of the API and must only be called by {@link EditorsUI}
   *
   * @param store the preference store to be initialized
   * @throws IllegalStateException if not called by {@link EditorsUI}
   * @since 3.0
   */
  public static void useQuickDiffPreferencePage(IPreferenceStore store)
      throws IllegalStateException {
    checkAccess();

    store.putValue(
        AbstractDecoratedTextEditorPreferenceConstants.USE_QUICK_DIFF_PREFERENCE_PAGE,
        Boolean.toString(true));

    MarkerAnnotationPreferences preferences =
        EditorsPlugin.getDefault().getMarkerAnnotationPreferences();
    Iterator<AnnotationPreference> e = preferences.getAnnotationPreferences().iterator();
    while (e.hasNext()) {
      AnnotationPreference info = e.next();

      // Only reset annotations shown on Quick Diff preference page

      if (!(info.getAnnotationType()
              .equals("org.eclipse.ui.workbench.texteditor.quickdiffChange") // $NON-NLS-1$
          || (info.getAnnotationType()
              .equals("org.eclipse.ui.workbench.texteditor.quickdiffAddition")) // $NON-NLS-1$
          || (info.getAnnotationType()
              .equals("org.eclipse.ui.workbench.texteditor.quickdiffDeletion")) // $NON-NLS-1$
      )) continue;

      store.setToDefault(info.getTextPreferenceKey());
      store.setToDefault(info.getOverviewRulerPreferenceKey());
      if (info.getVerticalRulerPreferenceKey() != null)
        store.setToDefault(info.getVerticalRulerPreferenceKey());
      store.setToDefault(info.getColorPreferenceKey());
      if (info.getShowInNextPrevDropdownToolbarActionKey() != null)
        store.setToDefault(info.getShowInNextPrevDropdownToolbarActionKey());
      if (info.getIsGoToNextNavigationTargetKey() != null)
        store.setToDefault(info.getIsGoToNextNavigationTargetKey());
      if (info.getIsGoToPreviousNavigationTargetKey() != null)
        store.setToDefault(info.getIsGoToPreviousNavigationTargetKey());
      if (info.getHighlightPreferenceKey() != null)
        store.setToDefault(info.getHighlightPreferenceKey());
      if (info.getTextStylePreferenceKey() != null)
        store.setToDefault(info.getTextStylePreferenceKey());
    }
  }
コード例 #5
0
  private void createFromColumnConfig() {
    // if a configuration store is used, then migrate the preferences into
    // the store. This is done once. Unfortunately, if the user then does
    // not save the file subsequently, the configuration is lost (e.g. the
    // order and size of the displayed columns). Therefore the key is saved
    // for manual recovery.

    // if no configuration store is used (i.e. column configuration cannot
    // be saved), we continue to use the preferences to store configuration

    String configInPreferences = preferences.getString(identifier);

    if (store != null && !configInPreferences.isEmpty()) {
      preferences.setToDefault(identifier);
      preferences.setValue("__backup__" + identifier, configInPreferences); // $NON-NLS-1$
      store.insertMigratedConfiguration(configInPreferences);
    }

    String config = store != null ? store.getActive() : configInPreferences;
    createFromColumnConfig(config);
  }
コード例 #6
0
  /**
   * Informs the user about the fact that there are no enabled categories in the default content
   * assist set and shows a link to the preferences.
   *
   * @return <code>true</code> if the default should be restored
   * @since 3.3
   */
  private boolean informUserAboutEmptyDefaultCategory() {
    if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) {
      final Shell shell = JavaPlugin.getActiveWorkbenchShell();
      String title = JavaTextMessages.ContentAssistProcessor_all_disabled_title;
      String message = JavaTextMessages.ContentAssistProcessor_all_disabled_message;
      // see PreferencePage#createControl for the 'defaults' label
      final String restoreButtonLabel = JFaceResources.getString("defaults"); // $NON-NLS-1$
      final String linkMessage =
          Messages.format(
              JavaTextMessages.ContentAssistProcessor_all_disabled_preference_link,
              LegacyActionTools.removeMnemonics(restoreButtonLabel));
      final int restoreId = IDialogConstants.CLIENT_ID + 10;
      final int settingsId = IDialogConstants.CLIENT_ID + 11;
      final OptionalMessageDialog dialog =
          new OptionalMessageDialog(
              PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY,
              shell,
              title,
              null /* default image */,
              message,
              MessageDialog.WARNING,
              new String[] {restoreButtonLabel, IDialogConstants.CLOSE_LABEL},
              1) {
            /*
             * @see org.eclipse.jdt.internal.ui.dialogs.OptionalMessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
             */
            @Override
            protected Control createCustomArea(Composite composite) {
              // wrap link and checkbox in one composite without space
              Composite parent = new Composite(composite, SWT.NONE);
              GridLayout layout = new GridLayout();
              layout.marginHeight = 0;
              layout.marginWidth = 0;
              layout.verticalSpacing = 0;
              parent.setLayout(layout);

              Composite linkComposite = new Composite(parent, SWT.NONE);
              layout = new GridLayout();
              layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
              layout.marginWidth =
                  convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
              layout.horizontalSpacing =
                  convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
              linkComposite.setLayout(layout);

              Link link = new Link(linkComposite, SWT.NONE);
              link.setText(linkMessage);
              link.addSelectionListener(
                  new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                      setReturnCode(settingsId);
                      close();
                    }
                  });
              GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
              gridData.widthHint = this.getMinimumMessageWidth();
              link.setLayoutData(gridData);

              // create checkbox and "don't show this message" prompt
              super.createCustomArea(parent);

              return parent;
            }

            /*
             * @see org.eclipse.jface.dialogs.MessageDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
             */
            @Override
            protected void createButtonsForButtonBar(Composite parent) {
              Button[] buttons = new Button[2];
              buttons[0] = createButton(parent, restoreId, restoreButtonLabel, false);
              buttons[1] =
                  createButton(
                      parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true);
              setButtons(buttons);
            }
          };
      int returnValue = dialog.open();
      if (restoreId == returnValue || settingsId == returnValue) {
        if (restoreId == returnValue) {
          IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
          store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER);
          store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
        }
        if (settingsId == returnValue)
          PreferencesUtil.createPreferenceDialogOn(
                  shell, "org.eclipse.jdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null)
              .open(); //$NON-NLS-1$
        fComputerRegistry.reload();
        return true;
      }
    }
    return false;
  }
コード例 #7
0
  public static void restoreDefaults(IPreferenceStore store) {
    store.setToDefault(EXPORT_SORT_ORDER);
    store.setToDefault(DONT_REMIND_ABOUT_FULL_BUILD);
    store.setToDefault(DISABLED_CATEGORIES);
    store.setToDefault(RUN_ANALYSIS_AUTOMATICALLY);
    store.setToDefault(RUN_ANALYSIS_ON_FULL_BUILD);
    store.setToDefault(ASK_ABOUT_PERSPECTIVE_SWITCH);
    store.setToDefault(SWITCH_PERSPECTIVE_AFTER_ANALYSIS);
    store.setToDefault(PRIO_LOW_MARKER_SEVERITY);
    store.setToDefault(PRIO_NORMAL_MARKER_SEVERITY);
    store.setToDefault(PRIO_HIGH_MARKER_SEVERITY);

    store.setToDefault(KEY_CACHE_CLASS_DATA);
    store.setToDefault(KEY_RUN_ANALYSIS_AS_EXTRA_JOB);
    store.setToDefault(KEY_SHORT_CLASSPATH);
  }
コード例 #8
0
  /** Stores the values of the controls back to the preference store. */
  private void storeValues() {
    IPreferenceStore store = getPreferenceStore();

    // Set version
    int version;
    if (this.mVersionRadioButton.getSelection()) {
      version = ECLIPSE_MAINTENANCE_VERSION;
    } else {
      version = ECLIPSE_DEVELOPMENT_VERSION;
    }
    store.setValue(PRE_ECLIPSE_VERSION, version);

    // Set database values
    store.setValue(PRE_DATABASE_CONNECTION, this.dbConnectionCheckBox.getSelection());
    final boolean dbLocal = this.dbLocalRadioButton.getSelection();
    store.setValue(PRE_DATABASE_LOCAL, dbLocal);
    String location = this.databaseLocationCombo.getText();
    if (dbLocal) {
      store.setValue(PRE_DATABASE_LOCATION, location);
    } else {
      store.setValue(PRE_DATABASE_LOCATION, NETWORK_DATABASE_LOCATION);
    }
    int count = this.databaseLocationCombo.getItemCount();
    for (int i = 0; i < count; i++) {
      String item = this.databaseLocationCombo.getItem(i);
      if (item.equals(location)) {
        this.databaseLocationCombo.remove(i);
        break;
      }
    }
    if (dbLocal) {
      this.databaseLocationCombo.add(location, 0);
    }
    int i = 0;
    for (; i < count; i++) {
      String item = this.databaseLocationCombo.getItem(i);
      if (item.length() == 0) break;
      store.setValue(PRE_DATABASE_LOCATION + "." + i, item);
    }
    while (store.getString(PRE_DATABASE_LOCATION + "." + i).length() > 0) {
      store.setToDefault(PRE_DATABASE_LOCATION + "." + i);
      i++;
    }

    // Set milestones
    count = this.milestonesCombo.getItemCount();
    for (i = 0; i < count; i++) {
      store.putValue(PRE_MILESTONE_BUILDS + version + i, this.milestonesCombo.getItem(i));
    }
    Util.setMilestones(this.milestonesCombo.getItems());

    // Set default dimension
    String defaultDimension = this.defaultDimensionCombo.getText();
    store.putValue(PRE_DEFAULT_DIMENSION, defaultDimension);
    DB_Results.setDefaultDimension(defaultDimension);

    // Set generated dimensions
    int[] indices = this.resultsDimensionsList.getSelectionIndices();
    int length = indices.length;
    String[] dimensions = new String[length];
    if (length > 0) {
      for (i = 0; i < indices.length; i++) {
        dimensions[i] = this.resultsDimensionsList.getItem(indices[i]);
        store.putValue(PRE_RESULTS_DIMENSION + "." + i, dimensions[i]);
      }
    }
    int currentLength = DB_Results.getResultsDimensions().length;
    if (currentLength > length) {
      for (i = currentLength - 1; i >= length; i--) {
        store.putValue(PRE_RESULTS_DIMENSION + "." + i, ""); // reset extra dimensions
      }
    }
    DB_Results.setResultsDimensions(dimensions);

    // Set config descriptors
    /* TODO See whether config descriptors need to be set as preferences or not...
    TableItem[] items = this.configDescriptorsTable.getItems();
    length = items.length;
    for (int i = 0; i < length; i++) {
    	TableItem item = items[i];
    	store.putValue(PRE_CONFIG_DESCRIPTOR_NAME + "." + i, item.getText(0));
    	store.putValue(PRE_CONFIG_DESCRIPTOR_DESCRIPTION + "." + i, item.getText(1));
    }
    */
  }
コード例 #9
0
ファイル: CanvasPlugin.java プロジェクト: prajar/bridgepoint
  private void initializeCanvases() {
    Ooaofgraphics graphicsModelRoot = Ooaofgraphics.getDefaultInstance();
    IExtensionRegistry reg = Platform.getExtensionRegistry();
    IExtensionPoint extPt = reg.getExtensionPoint("org.xtuml.bp.core.editors"); // $NON-NLS-1$
    IExtension[] exts = extPt.getExtensions();
    IPreferenceStore prefStore = CanvasPlugin.getDefault().getPreferenceStore();
    for (int i = 0; i < exts.length; i++) {
      IConfigurationElement[] elems = exts[i].getConfigurationElements();
      for (int j = 0; j < elems.length; j++) {
        if (elems[j].getName().equals("editor")) { // $NON-NLS-1$
          IConfigurationElement[] defs = elems[j].getChildren();
          for (int k = 0; k < defs.length; k++) {
            int value = 0;
            if (defs[k].getName().equals("symbol")) {
              String className = defs[k].getAttribute("class");
              if (!className.equals("")) {
                String symTypDef = defs[k].getAttribute("elemType");
                if (symTypDef != null) {
                  int elemType = getValueFor(symTypDef);
                  String elemName = defs[k].getAttribute("name");
                  ElementSpecification_c es = new ElementSpecification_c(graphicsModelRoot);
                  es.setName(elemName);
                  es.setOoa_type(elemType);
                  IConfigurationElement[] col = defs[k].getChildren("color");
                  if (col != null && col.length > 0) {
                    int r = Integer.parseInt(col[0].getAttribute("r"));
                    int g = Integer.parseInt(col[0].getAttribute("g"));
                    int b = Integer.parseInt(col[0].getAttribute("b"));
                    String clrStr =
                        Integer.toString(r) + "," + Integer.toString(g) + "," + Integer.toString(b);
                    String prefStr = "CanvasPreferencePage." + elemName + ".intColor";
                    prefStore.setDefault(prefStr, clrStr);
                    clrStr = prefStore.getString(prefStr);
                    if (clrStr == null || clrStr.equals("")) {
                      // The preference is not set, set it to the default
                      prefStore.setToDefault(prefStr);
                      clrStr = prefStore.getString(prefStr);
                    }
                    es.setInternal(parseColor(clrStr));
                  } else {
                    es.setHasnointeriorcolor(true);
                    es.setInternal(parseColor("255,255,255"));
                  }
                  try {
                    es.setRepresents(Class.forName(className));
                  } catch (ClassNotFoundException e) {
                    logError("Specified metamodel class not found: ", e);
                  }
                  es.setCreator(defs[k].getAttribute("createMethod"));
                  es.setIconname(defs[k].getAttribute("icon"));
                  String defHStr = defs[k].getAttribute("defaultHeight");
                  String defWStr = defs[k].getAttribute("defaultWidth");
                  if (defHStr != null) {
                    int defH = Integer.parseInt(defHStr);
                    es.setDefaultheight(defH);
                  }
                  if (defWStr != null) {
                    int defW = Integer.parseInt(defWStr);
                    es.setDefaultwidth(defW);
                  }
                  String isFixedAspectStr = defs[k].getAttribute("fixedAspect");
                  if (isFixedAspectStr != null && isFixedAspectStr.equals("true")) {
                    es.setIsfixedaspectratio(true);
                  }
                  String isFixedSizeStr = defs[k].getAttribute("fixedSize");
                  if (isFixedSizeStr != null && isFixedSizeStr.equals("true")) {
                    es.setIsfixedsize(true);
                  }
                  String isAnchorHost = defs[k].getAttribute("isAnchorHost");
                  if (isAnchorHost != null && isAnchorHost.equals("true")) {
                    es.setIsanchorhost(true);
                  }
                  String hasFloatingStr = defs[k].getAttribute("floatingText");
                  if (hasFloatingStr != null && hasFloatingStr.equals("true")) {
                    es.setHasfloatingtext(true);
                  }
                  String layer = defs[k].getAttribute("layer");
                  if (layer != null) {
                    try {
                      es.setLayer(Integer.parseInt(layer));
                    } catch (NumberFormatException e) {
                      logError("Could not parse symbol '" + elemName + "' layer: ", e);
                    }
                  }
                  String antiAliased = defs[k].getAttribute("antiAliased");
                  if (antiAliased != null) {
                    if (antiAliased.equalsIgnoreCase("true")) {
                      es.setAntialiased(true);
                    } else {
                      es.setAntialiased(false);
                    }
                  } else {
                    // default to false until drawing performance is enhanced
                    es.setAntialiased(false);
                  }
                  String isTransparent = defs[k].getAttribute("isTransparent");
                  if (isTransparent != null && isTransparent.equalsIgnoreCase("true")) {
                    es.setIstransparent(true);
                  } else {
                    es.setIstransparent(false);
                  }
                  String creationRule = defs[k].getAttribute("creationRule");
                  if (creationRule != null) {
                    es.setCreationrule(creationRule);
                  } else {
                    es.setCreationrule("manual");
                  }
                  String hasNameCompartment = defs[k].getAttribute("hasNameCompartment");
                  if (hasNameCompartment != null) {
                    if (hasNameCompartment.equalsIgnoreCase("true")) {
                      es.setHasnamecompartment(true);
                    } else es.setHasnamecompartment(false);
                  }

                  // setup element spec subtypes
                  String symbolType = defs[k].getAttribute("symbolType");
                  es.setSymboltype(symbolType);
                  if (symbolType.equalsIgnoreCase("connector")) {
                    ConnectorSpecification_c cs = new ConnectorSpecification_c(graphicsModelRoot);
                    cs.relateAcrossR200To(es);
                  }
                  // setup dependencies
                  addClientClassDependency(es, className);
                  IConfigurationElement[] depends = defs[k].getChildren("dependsOn");
                  for (int d = 0; d < depends.length; ++d) {
                    addClientClassDependency(es, depends[d].getAttribute("class"));
                  }
                  // setup auto resize
                  String causeAutoResize = defs[k].getAttribute("causeAutoResize");
                  if (causeAutoResize != null) {
                    if (causeAutoResize.equalsIgnoreCase("false")) {
                      es.setCauseautoresize(false);
                    }
                  } else {
                    es.setCauseautoresize(true);
                  }
                }
              }
            } // end if element name is Symbol
          }
          for (int k = 0; k < defs.length; k++) {
            int value = 0;
            if (defs[k].getName().equals("defaultFor")) {
              String className = defs[k].getAttribute("class");
              if (!className.equals("")) {
                String mdlTypDef = defs[k].getAttribute("modelType");
                String ooaTypDef = defs[k].getAttribute("ooaType");
                if (mdlTypDef != null && !mdlTypDef.equals("")) {
                  int modelType = getValueFor(mdlTypDef);
                  int ooaType = getValueFor(ooaTypDef);
                  IConfigurationElement[] col = defs[k].getChildren("color");
                  int r = Integer.parseInt(col[0].getAttribute("r"));
                  int g = Integer.parseInt(col[0].getAttribute("g"));
                  int b = Integer.parseInt(col[0].getAttribute("b"));
                  String diagName = defs[k].getAttribute("name");
                  ModelSpecification_c ms = new ModelSpecification_c(graphicsModelRoot);
                  ms.setName(diagName);
                  ms.setModel_type(modelType);
                  ms.setOoa_type(ooaType);
                  String clrStr =
                      Integer.toString(r) + "," + Integer.toString(g) + "," + Integer.toString(b);
                  String prefStr = "CanvasPreferencePage." + diagName + ".bkgColor";
                  prefStore.setDefault(prefStr, clrStr);
                  clrStr = prefStore.getString(prefStr);
                  if (clrStr == null || clrStr.equals("")) {
                    // The preference is not set, set it to the default
                    prefStore.setToDefault(prefStr);
                    clrStr = prefStore.getString(prefStr);
                  }
                  ms.setBackground(parseColor(clrStr));
                  try {
                    ms.setRepresents(Class.forName(className));
                  } catch (ClassNotFoundException e) {
                    logError("Specified metamodel class not found: ", e);
                  }
                  IConfigurationElement[] symbols = defs[k].getChildren("validSymbol");
                  for (int m = 0; m < symbols.length; m++) {
                    final String name = symbols[m].getAttribute("name");
                    final String symbolClassName = symbols[m].getAttribute("class");
                    String symbolOoaTypeDef = symbols[m].getAttribute("elemType");
                    int symbolElemType = -1;
                    if (symbolOoaTypeDef != null) {
                      symbolElemType = getValueFor(symbolOoaTypeDef);
                    }
                    final int finalElemType = symbolElemType;
                    ElementSpecification_c elem =
                        ElementSpecification_c.ElementSpecificationInstance(
                            graphicsModelRoot,
                            new ClassQueryInterface_c() {
                              public boolean evaluate(Object candidate) {
                                boolean result = false;
                                ElementSpecification_c elemSpec =
                                    (ElementSpecification_c) candidate;
                                if (elemSpec.getName().equals(name)) {
                                  result = true;
                                }
                                if (finalElemType != -1) {
                                  if (elemSpec.getOoa_type() == finalElemType) result = true;
                                  else result = false;
                                }
                                if (symbolClassName != null) {
                                  try {
                                    if (elemSpec.getRepresents() == Class.forName(symbolClassName)
                                        && elemSpec.getName().equals(name)) {
                                      result = true;
                                    } else {
                                      result = false;
                                    }
                                  } catch (ClassNotFoundException e) {
                                    logError("Specified metamodel class not found: ", e);
                                  }
                                }
                                return result;
                              }
                            });
                    if (elem != null) {
                      // get the tool category from specification
                      String toolCategory = symbols[m].getAttribute("tool_category");
                      if (toolCategory != null) {
                        elem.setToolcategory(toolCategory);
                      }
                      ElementInModelSpecification_c eims =
                          new ElementInModelSpecification_c(graphicsModelRoot);
                      ms.relateAcrossR11To(eims);
                      elem.relateAcrossR11To(eims);
                    }
                  }
                }
              }
            }
          }
          for (int k = 0; k < defs.length; k++) {
            if (defs[k].getName().equals("symbol")) {
              final String finalName = defs[k].getAttribute("name");
              String symTypDef = defs[k].getAttribute("elemType");
              if (symTypDef != null) {
                final int elemType = getValueFor(symTypDef);
                ElementSpecification_c es =
                    ElementSpecification_c.ElementSpecificationInstance(
                        graphicsModelRoot,
                        new ClassQueryInterface_c() {

                          public boolean evaluate(Object candidate) {
                            ElementSpecification_c es = (ElementSpecification_c) candidate;
                            return es.getName().equals(finalName) && es.getOoa_type() == elemType;
                          }
                        });
                // setup element spec subtypes
                String symbolType = defs[k].getAttribute("symbolType");
                if (symbolType.equalsIgnoreCase("connector")) {
                  ConnectorSpecification_c cs = ConnectorSpecification_c.getOneTS_CSPOnR200(es);
                  IConfigurationElement[] terms = defs[k].getChildren("terminator");
                  for (int l = 0; l < terms.length; l++) {
                    TerminalSpecification_c tms = new TerminalSpecification_c(graphicsModelRoot);
                    tms.setName(terms[l].getAttribute("name"));
                    boolean isStart = terms[l].getAttribute("end").equals("start");
                    if (isStart) {
                      cs.relateAcrossR202To(tms);
                    } else {
                      cs.relateAcrossR203To(tms);
                    }
                    final String symbol = terms[l].getAttribute("symbol");
                    final String symbolClassName = terms[l].getAttribute("symbolClass");
                    ElementSpecification_c els =
                        ElementSpecification_c.ElementSpecificationInstance(
                            graphicsModelRoot,
                            new ClassQueryInterface_c() {
                              public boolean evaluate(Object candidate) {
                                boolean result = false;
                                ElementSpecification_c elemSpec =
                                    (ElementSpecification_c) candidate;
                                if (elemSpec.getName().equals(symbol)) {
                                  result = true;
                                }

                                if (symbolClassName != null) {
                                  try {
                                    if (elemSpec.getRepresents() == Class.forName(symbolClassName)
                                        && (elemSpec.getName().equals(symbol))) {
                                      result = true;
                                    } else {
                                      result = false;
                                    }
                                  } catch (ClassNotFoundException e) {
                                    logError("Specified metamodel class not found: ", e);
                                  }
                                }
                                return result;
                              }
                            });
                    String type = terms[l].getAttribute("type");
                    if (els != null) {
                      if (type.equals("shape")) {
                        ShapeTerminal_c sst = new ShapeTerminal_c(graphicsModelRoot);
                        sst.relateAcrossR201To(tms);
                        ShapeSpecification_c ss = ShapeSpecification_c.getOneTS_SSPOnR200(els);
                        if (ss != null) {
                          sst.relateAcrossR204To(ss);
                        }
                      } else if (type.equals("connector")) {
                        ConnectorTerminal_c cnt = new ConnectorTerminal_c(graphicsModelRoot);
                        cnt.relateAcrossR201To(tms);
                        ConnectorSpecification_c cns =
                            ConnectorSpecification_c.getOneTS_CSPOnR200(els);
                        if (cns != null) {
                          cnt.relateAcrossR205To(cns);
                          String terminatesAt = terms[l].getAttribute("terminatesAt");
                          if (terminatesAt.equals("start")) {
                            cnt.setTerminatesat(End_c.Start);
                          } else if (terminatesAt.equals("middle")) {
                            cnt.setTerminatesat(End_c.Middle);
                          } else if (terminatesAt.equals("end")) {
                            cnt.setTerminatesat(End_c.End);
                          }
                        }
                      }
                    } else if (type.equals("whitespace")) {
                      WhitespaceTerminal_c wst = new WhitespaceTerminal_c(graphicsModelRoot);
                      wst.relateAcrossR201To(tms);
                    }
                    IConfigurationElement[] automaticCreations =
                        terms[l].getChildren("automaticCreation");
                    for (IConfigurationElement automaticCreation : automaticCreations) {
                      final String creationSymbol = automaticCreation.getAttribute("symbol");
                      final String creationSymbolClassName =
                          automaticCreation.getAttribute("symbolClass");
                      els =
                          ElementSpecification_c.ElementSpecificationInstance(
                              graphicsModelRoot,
                              new ClassQueryInterface_c() {
                                public boolean evaluate(Object candidate) {
                                  boolean result = false;
                                  ElementSpecification_c elemSpec =
                                      (ElementSpecification_c) candidate;
                                  if (elemSpec.getName().equals(creationSymbol)) {
                                    result = true;
                                  }

                                  if (creationSymbolClassName != null) {
                                    try {
                                      if (elemSpec.getRepresents()
                                              == Class.forName(creationSymbolClassName)
                                          && (elemSpec.getName().equals(creationSymbol))) {
                                        result = true;
                                      } else {
                                        result = false;
                                      }
                                    } catch (ClassNotFoundException e) {
                                      logError("Specified metamodel class not found: ", e);
                                    }
                                  }
                                  return result;
                                }
                              });
                      if (els != null) {
                        tms.relateAcrossR209To(els);
                      }
                    }
                  }
                } else if (symbolType.equalsIgnoreCase("shape")) {
                  ShapeSpecification_c ss = new ShapeSpecification_c(graphicsModelRoot);
                  ss.relateAcrossR200To(es);

                  NoncontainingShapeSpecification_c ncss =
                      new NoncontainingShapeSpecification_c(graphicsModelRoot);
                  ncss.relateAcrossR208To(ss);
                } else if (symbolType.equalsIgnoreCase("container")) {
                  ShapeSpecification_c ss = new ShapeSpecification_c(graphicsModelRoot);
                  ss.relateAcrossR200To(es);

                  ContainingShapeSpecification_c css =
                      new ContainingShapeSpecification_c(graphicsModelRoot);
                  css.relateAcrossR208To(ss);
                }
              }
            }
          }
        }
      }
    } // end for all extensions
    // Auto reconcile instance left until last to ensure that all
    // symbol specifications that might be referenced are created

    // Here to set the association between ARS and the ES //

    for (int i = 0; i < exts.length; i++) {
      IConfigurationElement[] elems = exts[i].getConfigurationElements();
      for (int j = 0; j < elems.length; j++) {
        if (elems[j].getName().equals("editor")) { // $NON-NLS-1$
          IConfigurationElement[] defs = elems[j].getChildren();
          for (int k = 0; k < defs.length; k++) {
            if (defs[k].getName().equals("symbol")) {
              // setup autoReconcile
              IConfigurationElement[] autoReconcile = defs[k].getChildren("autoReconcile");
              for (int e = 0; e < autoReconcile.length; ++e) {
                AutoReconciliationSpecification_c ars =
                    new AutoReconciliationSpecification_c(graphicsModelRoot);
                ars.setName(autoReconcile[e].getAttribute("name"));
                ars.setCountmethod(autoReconcile[e].getAttribute("countMethod"));
                ars.setElementmethod(autoReconcile[e].getAttribute("elementMethod"));
                ars.setElementexistsmethod(autoReconcile[e].getAttribute("elementExistsMethod"));
                ars.setTemplateelementmethod(
                    autoReconcile[e].getAttribute("templateElementMethod"));
                if (ars.getTemplateelementmethod() == null) {
                  ars.setTemplateelementmethod("");
                }
                ElementSpecification_c scanTarget =
                    locateEsByNameAndClassType(
                        graphicsModelRoot,
                        defs[k].getAttribute("name"),
                        defs[k].getAttribute("class"));
                ars.relateAcrossR29To(scanTarget);
                ElementSpecification_c targetSymbol =
                    locateEsByNameAndClassType(
                        graphicsModelRoot, autoReconcile[e].getAttribute("targetSymbol"), null);
                ars.relateAcrossR31To(targetSymbol);
                String ssSpec = autoReconcile[e].getAttribute("sourceSymbol");
                if (ssSpec != null) {
                  ars.relateAcrossR30To(
                      locateEsByNameAndClassType(graphicsModelRoot, ssSpec, null));
                } else {
                  ars.relateAcrossR30To(targetSymbol);
                }
              }

            } else if (defs[k].getName().equals("defaultFor")) {
              // setup autoReconcile
              IConfigurationElement[] autoReconcile = defs[k].getChildren("autoReconcile");
              for (int e = 0; e < autoReconcile.length; ++e) {
                AutoReconciliationSpecification_c ars =
                    new AutoReconciliationSpecification_c(graphicsModelRoot);
                ars.setName(autoReconcile[e].getAttribute("name"));
                ars.setCountmethod(autoReconcile[e].getAttribute("countMethod"));
                ars.setElementmethod(autoReconcile[e].getAttribute("elementMethod"));
                ars.setElementexistsmethod(autoReconcile[e].getAttribute("elementExistsMethod"));
                ars.setTemplateelementmethod(
                    autoReconcile[e].getAttribute("templateElementMethod"));
                if (ars.getTemplateelementmethod() == null) {
                  ars.setTemplateelementmethod("");
                }
                // ElementSpecification_c scanTarget = locateEsByNameAndClassType(
                // graphicsModelRoot, defs[k].getAttribute("name"), defs[k].getAttribute("class"));
                ModelSpecification_c modelSpec =
                    locateMesByNameAndClassType(
                        graphicsModelRoot,
                        defs[k].getAttribute("name"),
                        defs[k].getAttribute("class"));
                ars.relateAcrossR33To(modelSpec);
                ElementSpecification_c targetSymbol =
                    locateEsByNameAndClassType(
                        graphicsModelRoot,
                        autoReconcile[e].getAttribute("targetSymbol"),
                        autoReconcile[e].getAttribute("class"));
                ars.relateAcrossR31To(targetSymbol);
                String ssSpec = autoReconcile[e].getAttribute("sourceSymbol");
                if (ssSpec != null) {
                  ars.relateAcrossR30To(
                      locateEsByNameAndClassType(graphicsModelRoot, ssSpec, null));
                } else {
                  ars.relateAcrossR30To(targetSymbol);
                }
              }
            }
          }
        }
      }
    }
  }