org.eclipse.jface.viewers.CellLabelProvider Java Examples

The following examples show how to use org.eclipse.jface.viewers.CellLabelProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PeerTable.java    From offspring with MIT License 6 votes vote down vote up
public static CellLabelProvider createLabelProvider(int id, int peerType) {
  switch (id) {
  case COLUMN_HALLMARK_BUTTON:
  case COLUMN_DISCONNECTED:
  case COLUMN_WELLKNOWN:
  case COLUMN_ANNOUNCED_ADDRESS:
  case COLUMN_ADDRESS:
  case COLUMN_WEIGHT:
  case COLUMN_SOFTWARE:
  case COLUMN_DOWNLOADED:
  case COLUMN_UPLOADED:
    return new PeerLabelProvider(peerType);

    /*
     * case COLUMN_DOWNLOADED: case COLUMN_UPLOADED: return new
     * PeerStyledLabelProvider(peerType);
     */
  }
  return null;
}
 
Example #2
Source File: GridViewerSnippet6.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private static GridViewerColumn column(final GridTableViewer v, final CellLabelProvider labelProvider,
		final String columnName) {
	final GridViewerColumn column2 = new GridViewerColumn(v, SWT.NONE);
	column2.setLabelProvider(labelProvider);
	column2.getColumn().setText(columnName);
	column2.getColumn().setWidth(300);
	return column2;
}
 
Example #3
Source File: EventViewTable.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private void createColumns ( final TableViewer table )
{
    final SortListener sortListener = new SortListener ( table );

    for ( final ColumnLabelProviderInformation columnInformation : this.columnInformations )
    {
        final TableViewerColumn fieldColumn = new TableViewerColumn ( table, SWT.NONE );
        fieldColumn.getColumn ().setText ( columnInformation.getLabel () );

        fieldColumn.getColumn ().setWidth ( columnInformation.getInitialSize () );
        fieldColumn.getColumn ().setResizable ( true );
        fieldColumn.getColumn ().setMoveable ( true );

        if ( columnInformation.isSortable () )
        {
            fieldColumn.getColumn ().addSelectionListener ( sortListener );
        }

        final CellLabelProvider labelProvider = columnInformation.createLabelProvider ( this.labelProviderSupport );
        if ( labelProvider != null )
        {
            fieldColumn.setLabelProvider ( labelProvider );
        }
        else
        {
            fieldColumn.setLabelProvider ( new StyledCellLabelProvider () {} );
        }
    }
}
 
Example #4
Source File: ColumnLabelProviderInformation.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public CellLabelProvider createLabelProvider ( final LabelProviderSupport labelProviderSupport )
{
    if ( TYPE_ID.equals ( this.type ) )
    {
        return new IdLabelProvider ();
    }
    else if ( TYPE_SOURCE_TIMESTAMP.equals ( this.type ) )
    {
        return new SourceTimestampLabelProvider ( labelProviderSupport );
    }
    else if ( TYPE_ENTRY_TIMESTAMP.equals ( this.type ) )
    {
        return new EntryTimestampLabelProvider ( labelProviderSupport );
    }
    else if ( TYPE_VARIANT.equals ( this.type ) )
    {
        final String key = this.parameters.get ( "key" );
        final String decorationString = this.parameters.get ( "decoration" );

        Decoration decoration;
        if ( decorationString == null || decorationString.isEmpty () )
        {
            decoration = null;
        }
        else
        {
            decoration = Decoration.valueOf ( decorationString );
        }

        return new VariantLabelProvider ( key, labelProviderSupport, decoration );
    }
    return null;
}
 
Example #5
Source File: BreadcrumbViewer.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
protected void doUpdateItem(Widget widget, Object element, boolean fullMap) {
  if (widget instanceof BreadcrumbItem) {
    final BreadcrumbItem item = (BreadcrumbItem) widget;

    // remember element we are showing
    if (fullMap) {
      associate(element, item);
    } else {
      Object data = item.getData();
      if (data != null) {
        unmapElement(data, item);
      }
      item.setData(element);
      mapElement(element, item);
    }

    BreadcrumbViewerRow row = new BreadcrumbViewerRow(this, item);
    ViewerCell cell = row.getCell(0);

    ((CellLabelProvider) getLabelProvider()).update(cell);

    item.refreshArrow();

    if (fToolTipLabelProvider != null) {
      item.setToolTip(fToolTipLabelProvider.getText(item.getData()));
    } else {
      item.setToolTip(cell.getText());
    }
  }
}
 
Example #6
Source File: BreadcrumbViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void doUpdateItem(Widget widget, Object element, boolean fullMap) {
	if (widget instanceof BreadcrumbItem) {
		final BreadcrumbItem item= (BreadcrumbItem) widget;

		// remember element we are showing
		if (fullMap) {
			associate(element, item);
		} else {
			Object data= item.getData();
			if (data != null) {
				unmapElement(data, item);
			}
			item.setData(element);
			mapElement(element, item);
		}

		BreadcrumbViewerRow row= new BreadcrumbViewerRow(this, item);
		ViewerCell cell= row.getCell(0);

		((CellLabelProvider) getLabelProvider()).update(cell);

		item.refreshArrow();

		if (fToolTipLabelProvider != null) {
			item.setToolTip(fToolTipLabelProvider.getText(item.getData()));
		} else {
			item.setToolTip(cell.getText());
		}
	}
}
 
Example #7
Source File: GridTableViewer.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public void setRowHeaderLabelProvider(
		CellLabelProvider rowHeaderLabelProvider) {
	this.rowHeaderLabelProvider = rowHeaderLabelProvider;
}
 
Example #8
Source File: VariableAndOptionPage.java    From M2Doc with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Creates the {@link Generation#getOptions() options} {@link TableViewer}.
 * 
 * @param gen
 *            the {@link Generation}
 * @param composite
 *            the container {@link Composite}
 * @param factory
 *            the {@link AdapterFactory}
 * @param provider
 *            the {@link ITemplateCustomPropertiesProvider}
 * @return the created {@link TableViewer}
 */
private TableViewer createVariablesTable(final Generation gen, Composite composite, AdapterFactory factory,
        ITemplateCustomPropertiesProvider provider) {
    composite.setLayout(new GridLayout(2, false));
    TableViewer res = new TableViewer(composite, SWT.MULTI);
    Table table = res.getTable();
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    res.getTable().setHeaderVisible(true);
    TableViewerColumn nameColumn = new TableViewerColumn(res, composite.getStyle());
    nameColumn.getColumn().setText("Variable name");
    nameColumn.getColumn().setWidth(WIDTH);
    TableViewerColumn valueColumn = new TableViewerColumn(res, composite.getStyle());
    valueColumn.getColumn().setText("Variable value");
    valueColumn.getColumn().setWidth(WIDTH);
    res.setContentProvider(new IStructuredContentProvider() {

        @Override
        public Object[] getElements(Object inputElement) {
            return ((Generation) inputElement).getDefinitions().toArray();
        }

        @Override
        public void dispose() {
            // nothing to do here
        }

        @Override
        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
            // nothing to do here
        }

    });
    nameColumn.setLabelProvider(new CellLabelProvider() {
        @Override
        public void update(ViewerCell cell) {
            final Definition definition = (Definition) cell.getElement();
            cell.setText(definition.getKey());
        }
    });
    valueColumn.setLabelProvider(new VariableValueCellLabelProvider(factory));

    res.setInput(gen);

    return res;
}
 
Example #9
Source File: BlockTable.java    From offspring with MIT License 4 votes vote down vote up
public static CellLabelProvider createLabelProvider(int id) {
  return new BlockLabelProvider();
}
 
Example #10
Source File: SellOrderTable.java    From offspring with MIT License 4 votes vote down vote up
public static CellLabelProvider createLabelProvider(int id) {
  return new SellOrderLabelProvider();
}
 
Example #11
Source File: BuyOrderTable.java    From offspring with MIT License 4 votes vote down vote up
public static CellLabelProvider createLabelProvider(int id) {
  return new BuyOrderLabelProvider();
}
 
Example #12
Source File: GridTableViewer.java    From tmxeditor8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Label provider used by calculate the row header text
 * 
 * @param rowHeaderLabelProvider
 *            the provider
 */
public void setRowHeaderLabelProvider(
		CellLabelProvider rowHeaderLabelProvider) {
	this.rowHeaderLabelProvider = rowHeaderLabelProvider;
}
 
Example #13
Source File: GridTreeViewer.java    From tmxeditor8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Label provider used by calculate the row header text
 * 
 * @param rowHeaderLabelProvider
 *            the provider
 */
public void setRowHeaderLabelProvider(
		CellLabelProvider rowHeaderLabelProvider) {
	this.rowHeaderLabelProvider = rowHeaderLabelProvider;
}
 
Example #14
Source File: GridTableViewer.java    From translationstudio8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Label provider used by calculate the row header text
 * 
 * @param rowHeaderLabelProvider
 *            the provider
 */
public void setRowHeaderLabelProvider(
		CellLabelProvider rowHeaderLabelProvider) {
	this.rowHeaderLabelProvider = rowHeaderLabelProvider;
}
 
Example #15
Source File: GridTreeViewer.java    From translationstudio8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Label provider used by calculate the row header text
 * 
 * @param rowHeaderLabelProvider
 *            the provider
 */
public void setRowHeaderLabelProvider(
		CellLabelProvider rowHeaderLabelProvider) {
	this.rowHeaderLabelProvider = rowHeaderLabelProvider;
}
 
Example #16
Source File: GridTableViewer.java    From nebula with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Label provider used by calculate the row header text
 *
 * @param rowHeaderLabelProvider
 *            the provider
 */
public void setRowHeaderLabelProvider(CellLabelProvider rowHeaderLabelProvider) {
    this.rowHeaderLabelProvider = rowHeaderLabelProvider;
}
 
Example #17
Source File: GridTreeViewer.java    From nebula with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Label provider used by calculate the row header text
 * 
 * @param rowHeaderLabelProvider
 *            the provider
 */
public void setRowHeaderLabelProvider(
		CellLabelProvider rowHeaderLabelProvider) {
	this.rowHeaderLabelProvider = rowHeaderLabelProvider;
}