Package org.eclipse.swt.custom

Examples of org.eclipse.swt.custom.TableTreeItem


    }
    setFileDirty();
  }

  private void handleEdit() {
    TableTreeItem item = tt.getSelection()[0];
    TableTreeItem parentType = item.getParentItem();

    if (null == parentType) { // editing a type, not a feature
      editType(item);
    } else if (item.getText(NAME_COL).equals(HEADER_ALLOWED_VALUE)) {
      editAllowedValue(item, parentType);
View Full Code Here


  /*
   * Note that the Remove action is disabled if the item selected is imported only
   */
  private void handleRemove() {
    TableTreeItem item = tt.getSelection()[0];
    TableTreeItem parent = item.getParentItem();

    if (null == parent)
      handleRemoveType(item);
    else if (item.getText(NAME_COL).equals(HEADER_ALLOWED_VALUE))
      handleRemoveAllowedValue(item);
View Full Code Here

    }
    throw new InternalErrorCDE("invalid state"); //$NON-NLS-1$
  }

  public static int getIndex(TableTreeItem item) {
    TableTreeItem parent = item.getParentItem();
    TableTreeItem[] items = (null == parent) ? item.getParent().getItems() : parent.getItems();
    for (int i = items.length - 1; i >= 0; i--) {
      if (items[i] == item)
        return i;
    }
    throw new InternalErrorCDE("invalid state"); //$NON-NLS-1$
View Full Code Here

    }
    return filePathName;
  }

  public static void swapTableTreeItems(TableTreeItem itemBelow, int newSelection) {
    TableTreeItem parent = itemBelow.getParentItem();
    if (null == parent)
      throw new InternalErrorCDE("invalid arg");
    int i = getIndex(itemBelow);
    TableTreeItem itemAbove = parent.getItems()[i - 1];
    TableTreeItem newItemAbove = new TableTreeItem(parent, SWT.NONE, i - 1);
    copyTableTreeItem(newItemAbove, itemBelow);
    TableTreeItem newItemBelow = new TableTreeItem(parent, SWT.NONE, i);
    copyTableTreeItem(newItemBelow, itemAbove);
    itemAbove.dispose();
    itemBelow.dispose();
    parent.getParent().setSelection(new TableTreeItem[] { parent.getItems()[newSelection] });
  }
View Full Code Here

    }
    target.setData(source.getData());
  }

  public static void swapIndexKeys(TableTreeItem itemBelow, int newSelection) {
    TableTreeItem parent = itemBelow.getParentItem();
    FsIndexDescription fsid = getFsIndexDescriptionFromTableTreeItem(parent);
    int i = getIndex(itemBelow);
    FsIndexKeyDescription[] keys = fsid.getKeys();
    FsIndexKeyDescription temp = keys[i];
    keys[i] = keys[i - 1];
View Full Code Here

    tt.removeAll();

    Capability[] cs = getCapabilities();
    if (null != cs) {
      for (int i = 0; i < cs.length; i++) {
        TableTreeItem item = new TableTreeItem(tt, SWT.NONE);
        item.setText(TITLE_COL, CAPABILITY_SET);
        item.setData(cs[i]);
        tt.setSelection(new TableTreeItem[] { item }); // set default selection
        fillCapability(item, cs[i]);
        // if (0 == i) {
        item.setExpanded(true);
        TableTreeItem[] types = item.getItems();
        if (types != null)
          for (int j = 0; j < types.length; j++) {
            types[j].setExpanded(true);
          }
        // }
View Full Code Here

    boolean isOutputUpdate = false;
  }

  private TableTreeItem createLanguageHeaderGui(TableTreeItem parent) {
    TableTreeItem langHdr = new TableTreeItem(parent, SWT.NONE);
    langHdr.setText(TITLE_COL, LANGS_TITLE);
    langHdr.setData(LANGS_TITLE);
    return langHdr;
  }
View Full Code Here

    langHdr.setData(LANGS_TITLE);
    return langHdr;
  }

  private TableTreeItem createSofaHeaderGui(TableTreeItem parent) {
    TableTreeItem sofaHdr = new TableTreeItem(parent, SWT.NONE);
    sofaHdr.setText(TITLE_COL, SOFAS_TITLE);
    sofaHdr.setData(SOFAS_TITLE);
    return sofaHdr;
  }
View Full Code Here

    return sofaHdr;
  }

  private void fillCapability(TableTreeItem parent, Capability c) {
    // first output language capabilities
    TableTreeItem langHdr = createLanguageHeaderGui(parent);
    String[] languages = c.getLanguagesSupported();
    if (null != languages) {
      for (int i = 0; i < languages.length; i++) {
        TableTreeItem lItem = new TableTreeItem(langHdr, SWT.NONE);
        lItem.setData(LANG_TITLE);
        lItem.setText(NAME_COL, languages[i]);
      }
    }

    // second, output Sofas
    TableTreeItem sofaHdr = createSofaHeaderGui(parent);
    String[] inputSofaNames = c.getInputSofas();
    String[] outputSofaNames = c.getOutputSofas();
    Arrays.sort(inputSofaNames);
    Arrays.sort(outputSofaNames);
    for (int i = 0; i < inputSofaNames.length; i++) {
      TableTreeItem item = new TableTreeItem(sofaHdr, SWT.NONE);
      setGuiSofaName(item, inputSofaNames[i], true);
    }
    for (int i = 0; i < outputSofaNames.length; i++) {
      TableTreeItem item = new TableTreeItem(sofaHdr, SWT.NONE);
      setGuiSofaName(item, outputSofaNames[i], false);
    }

    // scan capability, collecting for each type:
    // inputs, outputs, updatesToInputs(features)
    // (updatesToInputs are output features without corresponding output type)
    // <noFeatures>, or <allFeatures> or feature set
    // For each item, generate minimal number of Type items:

    TypeCapability tc = null;
    FeatureCapability fc;
    TypeOrFeature[] inputs = c.getInputs();
    TypeOrFeature[] outputs = c.getOutputs();
    typeInfo = new TreeMap();

    if (null != inputs) {
      for (int i = 0; i < inputs.length; i++) {
        String name = inputs[i].getName();
        if (inputs[i].isType()) {
          tc = getTypeCapability(name);
          tc.isInputType = true;
          if (inputs[i].isAllAnnotatorFeatures()) {
            fc = getFeatureCapability(tc, ALL_FEATURES);
            fc.isInputFeature = true;
          }
        } else {
          tc = getTypeCapability(getTypeNameFromFullFeatureName(name)); // create a typecapability
          // if one doesn't exist
          fc = getFeatureCapability(tc, getShortFeatureName(name));
          fc.isInputFeature = true;
        }
      }
    }

    if (null != outputs) {
      for (int i = 0; i < outputs.length; i++) {
        String name = outputs[i].getName();
        if (outputs[i].isType()) {
          tc = getTypeCapability(name);
          tc.isOutputType = true;
          if (outputs[i].isAllAnnotatorFeatures()) {
            fc = getFeatureCapability(tc, ALL_FEATURES);
            fc.isOutputType = true;
          }
        } else {
          tc = getTypeCapability(getTypeNameFromFullFeatureName(name));
          fc = getFeatureCapability(tc, getShortFeatureName(name));
          fc.isOutputUpdate = true;
        }
      }
    }

    for (Iterator it = typeInfo.entrySet().iterator(); it.hasNext();) {
      Map.Entry entry = (Map.Entry) it.next();
      String typeName = (String) entry.getKey();
      tc = (TypeCapability) entry.getValue();

      TableTreeItem item = new TableTreeItem(parent, SWT.NONE);
      setGuiTypeName(item, typeName);
      if (tc.isInputType)
        item.setText(INPUT_COL, INPUT);
      if (tc.isOutputType)
        item.setText(OUTPUT_COL, OUTPUT);

      for (Iterator fit = tc.features.entrySet().iterator(); fit.hasNext();) {
        Map.Entry fEntry = (Map.Entry) fit.next();
        String featName = (String) fEntry.getKey();
        fc = (FeatureCapability) fEntry.getValue();

        TableTreeItem fItem = new TableTreeItem(item, SWT.NONE);
        fItem.setData(FEAT_TITLE);
        fItem.setText(NAME_COL, featName);
        if (fc.isInputFeature)
          fItem.setText(INPUT_COL, INPUT);
        if (fc.isOutputUpdate || fc.isOutputType) {
          fItem.setText(OUTPUT_COL, OUTPUT);
        }
      }
    }
  }
View Full Code Here

      handleAddCapability();
      enable();
      return;
    }

    TableTreeItem selItem = tt.getSelection()[0];
    int itemKind = getItemKind(selItem);

    if (event.widget == addLangButton) {
      handleAddLang(selItem, itemKind);
    } else if (event.widget == addTypeButton) {
View Full Code Here

TOP

Related Classes of org.eclipse.swt.custom.TableTreeItem

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.