예제 #1
0
  /** Adds or update local palette */
  public static void addLocalPalette(
      String paletteID,
      String paletteName,
      ProviderPriority priority,
      String editorID,
      Set<String> requiredProfiles) {
    // retrieves memento
    XMLMemento rootMemento = getExistingLocalPalettes();

    // search existing customization
    IMemento paletteMemento = searchPaletteMemento(rootMemento, paletteID);
    if (paletteMemento == null) {
      paletteMemento = createMemento(rootMemento, paletteID);
    }

    // update values in the memento
    paletteMemento.putString(NAME, paletteName);
    paletteMemento.putString(PRIORITY, priority.getName());
    paletteMemento.putString(EDITOR_ID, editorID);
    paletteMemento.putString(PATH, getPalettePathFromID(paletteID));

    // add properties if required
    IMemento propertiesMemento =
        paletteMemento.createChild(IPapyrusPaletteConstant.PALETTE_DESCRIPTION_PROPERTIES);
    propertiesMemento.putString(
        IPapyrusPaletteConstant.PROFILE_LIST,
        PaletteUtil.getSerializedProfileListFromSet(requiredProfiles));

    // saves the root memento
    saveLocalPalettes(rootMemento);
  }
 /**
  * The <code>WizardNewFileCreationPage</code> implementation of this <code>Listener</code> method
  * handles all events and enablements for controls on this page. Subclasses may extend.
  */
 public void handleEvent(Event event) {
   Widget widget = event.widget;
   if (widget.equals(nameText)) {
     name = nameText.getText();
   } else if (widget.equals(idText)) {
     paletteID = idText.getText();
   } else if (widget.equals(editorText)) {
     editorID = editorText.getText();
   } else if (widget.equals(priorityCombo)) {
     priority = ProviderPriority.parse(priorityCombo.getText());
   }
   setPageComplete(validatePage());
 }
예제 #3
0
  /** Returns the provider priority for the palette provider with the given ID */
  public static ProviderPriority getPalettePriority(String paletteID) {
    // retrieves memento
    XMLMemento rootMemento = getExistingLocalPalettes();

    // search existing customization
    IMemento paletteMemento = searchPaletteMemento(rootMemento, paletteID);
    if (paletteMemento == null) {
      paletteMemento = createMemento(rootMemento, paletteID);
    }

    // update values in the memento
    String palettePriority = paletteMemento.getString(PRIORITY);
    return ProviderPriority.parse(palettePriority);
  }
 /** intialize the field using current value of the palette id */
 protected void initialPopulatePriorityField() {
   priorityCombo.select(Arrays.asList(priorityList).indexOf(priority.getName()));
 }