Package org.eclipse.swt.custom

Examples of org.eclipse.swt.custom.TableTreeItem


    if (dialog.isInput)
      c.setInputSofas(stringArrayAdd(c.getInputSofas(), dialog.sofaName));
    else
      c.setOutputSofas(stringArrayAdd(c.getOutputSofas(), dialog.sofaName));

    TableTreeItem item = new TableTreeItem(selItem, SWT.NONE);
    setGuiSofaName(item, dialog.sofaName, dialog.isInput);
    selItem.setExpanded(true);
    pack04();

    sofaMapSection.markStale();
View Full Code Here


      prevFeatGUI[i].dispose();
    }

    // update GUI for <all features> - add element if needed
    if (dialog.allFeaturesInput || dialog.allFeaturesOutput) {
      TableTreeItem item = new TableTreeItem(parentItem, SWT.NONE);
      item.setData(FEAT_TITLE);
      item.setText(NAME_COL, ALL_FEATURES);
      item.setText(INPUT_COL, dialog.allFeaturesInput ? INPUT : "");
      item.setText(OUTPUT_COL, dialog.allFeaturesOutput ? OUTPUT : "");
    }

    List inputsL = new ArrayList();
    List outputsL = new ArrayList();

    for (int i = 0; i < dialog.features.length; i++) {
      String fullName = typeName + ":" + dialog.features[i];
      if (dialog.inputs[i])
        inputsL.add(newFeature(fullName));
      if (dialog.outputs[i])
        outputsL.add(newFeature(fullName));
      // update the GUI
      TableTreeItem item = new TableTreeItem(parentItem, SWT.NONE);
      item.setData(FEAT_TITLE);
      item.setText(NAME_COL, dialog.features[i]);
      item.setText(INPUT_COL, dialog.inputs[i] ? INPUT : "");
      item.setText(OUTPUT_COL, dialog.outputs[i] ? OUTPUT : "");
    }
    parentItem.setExpanded(true);
    tt.getTable().getColumn(NAME_COL).pack();
    tt.setSelection(new TableTreeItem[] { parentItem });
View Full Code Here

  public void enable() {
    addCapabilityButton.setEnabled(true);

    boolean selectOK = tt.getSelectionCount() == 1;
    TableTreeItem item = selectOK ? tt.getSelection()[0] : null;
    int kind = selectOK ? getItemKind(item) : 0;

    addLangButton.setEnabled(selectOK);
    addTypeButton.setEnabled(selectOK);
    addSofaButton.setEnabled(selectOK);
View Full Code Here

      indexImportSection = editor.getIndexesPage().getIndexImportSection();
    super.refresh();
    tt.removeAll();

    // add built-in annotation index
    updateIndexSpec(new TableTreeItem(tt, SWT.NONE), getBuiltInIndexDescription());

    FsIndexDescription[] fsIndexes = getAnalysisEngineMetaData().getFsIndexes();

    if (fsIndexes != null) {
      for (int i = 0; i < fsIndexes.length; i++) {
        updateIndexSpec(new TableTreeItem(tt, SWT.NONE), fsIndexes[i]);
      }
    }
    packTable(tt.getTable());
    enable();
  }
View Full Code Here

    item.setData(ndx);
    removeChildren(item);
    FsIndexKeyDescription[] keys = ndx.getKeys();
    if (null != keys)
      for (int i = 0; i < keys.length; i++) {
        updateKeySpec(new TableTreeItem(item, SWT.NONE), keys[i]);
      }
  }
View Full Code Here

      id.setKeys(dialog.keys);
      id.setKind(dialog.indexKind);

      addFsIndexDescription(id);

      updateIndexSpec(new TableTreeItem(tt, SWT.NONE), id);

      tt.getTable().setSelection(tt.getTable().getItemCount() - 1);
      packTable(tt.getTable());
      setFileDirty();
    } else if (event.widget == addKeyButton) {
      if (notAllowed("Adding an Index"))
        return;
      TableTreeItem parent = tt.getSelection()[0];
      if (null != parent.getParentItem())
        parent = parent.getParentItem();
      if (foolingAroundWithAnnotationIndex(parent))
        return;
      FsIndexDescription fsid = getFsIndexDescriptionFromTableTreeItem(parent);
      AddIndexKeyDialog dialog = new AddIndexKeyDialog(this, fsid.getTypeName(),
              handleDefaultIndexKind(fsid.getKind()), getAlreadyUsedFeatures(fsid));
      FsIndexKeyDescription newKey = addOrEditIndexKey(dialog, null);
      if (null != newKey) {
        addFsIndexKeyDescription(fsid, newKey);
        updateKeySpec(new TableTreeItem(parent, SWT.NONE), newKey);
        parent.setExpanded(true);
        setFileDirty();
      }
    } else if (event.widget == removeButton) {
      TableTreeItem item = tt.getSelection()[0];
      if (foolingAroundWithAnnotationIndex(item))
        return;
      Object o = item.getData();
      if (o instanceof FsIndexDescription) {
        if (Window.CANCEL == Utility.popOkCancel("Confirm Remove",
                "Do you want to remove this index?", MessageDialog.WARNING))
          return;
        removeFsIndexDescription((FsIndexDescription) o);
      } else {
        if (Window.CANCEL == Utility.popOkCancel("Confirm Remove",
                "Do you want to remove this key?", MessageDialog.WARNING))
          return;
        TableTreeItem parent = item.getParentItem();
        FsIndexDescription fsid = getFsIndexDescriptionFromTableTreeItem(parent);
        removeFsIndexKeyDescription(fsid, (FsIndexKeyDescription) o);
      }
      tt.getTable().setSelection(tt.getTable().getSelectionIndex() - 1);
      item.dispose();
      setFileDirty();
    } else if (event.widget == editButton || event.type == SWT.MouseDoubleClick) {
      if (notAllowed("Adding an Index"))
        return;
      if (tt.getSelectionCount() != 1)
        return;
      TableTreeItem item = tt.getSelection()[0];
      if (foolingAroundWithAnnotationIndex(item))
        return;
      Object o = item.getData();
      if (o instanceof FsIndexDescription) {
        FsIndexDescription fsid = (FsIndexDescription) o;
        AddIndexDialog dialog = new AddIndexDialog(this, fsid);
        if (dialog.open() == Window.CANCEL)
          return;

        valueChanged = false;
        fsid.setLabel(setValueChanged(dialog.indexName, fsid.getLabel()));
        fsid.setTypeName(setValueChanged(dialog.indexType, fsid.getTypeName()));
        fsid.setKeys(setValueChangedKeys(dialog.keys, fsid.getKeys()));
        fsid.setKind(setValueChanged(dialog.indexKind, handleDefaultIndexKind(fsid.getKind())));

        updateIndexSpec(item, fsid);

        if (valueChanged) {
          packTable(tt.getTable());
          setFileDirty();
        }
      } else { // editing a key
        if (notAllowed("Adding an Index"))
          return;
        FsIndexKeyDescription key = (FsIndexKeyDescription) o;
        TableTreeItem parent = item.getParentItem();
        FsIndexDescription fsid = getFsIndexDescriptionFromTableTreeItem(parent);
        AddIndexKeyDialog dialog = new AddIndexKeyDialog(this, fsid.getTypeName(),
                handleDefaultIndexKind(fsid.getKind()), getAlreadyUsedFeatures(fsid), key);
        valueChanged = false;
        addOrEditIndexKey(dialog, key);
View Full Code Here

    return false;
  }

  public void enable() {
    boolean selected = tt.getSelectionCount() == 1;
    TableTreeItem item = null;
    TableTreeItem parent = null;
    if (selected) {
      item = tt.getSelection()[0];
      parent = item.getParentItem();
    }
    boolean notBuiltInSelected = (selected && item != tt.getItems()[0]);
    notBuiltInSelected &= !(null != parent && parent == tt.getItems()[0]);

    addIndexButton.setEnabled(true);
    addKeyButton.setEnabled(notBuiltInSelected
            && (null != parent || /* null == parent && */!"bag".equals(item
                    .getText(INDEX_KIND_COL))));
    editButton.setEnabled(notBuiltInSelected);
    removeButton.setEnabled(notBuiltInSelected);
    exportButton.setEnabled(tt.getItemCount() > 1); // always one "built-in"

    upButton.setEnabled(false);
    downButton.setEnabled(false);
    if (selected) {
      if (null != parent && notBuiltInSelected) {
        TableTreeItem firstItem = parent.getItems()[0];
        TableTreeItem lastItem = parent.getItems()[parent.getItems().length - 1];
        upButton.setEnabled(item != firstItem);
        downButton.setEnabled(item != lastItem);
      }
    }

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

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.