本文整理汇总了Java中org.eclipse.jface.viewers.TreeViewerColumn.setLabelProvider方法的典型用法代码示例。如果您正苦于以下问题:Java TreeViewerColumn.setLabelProvider方法的具体用法?Java TreeViewerColumn.setLabelProvider怎么用?Java TreeViewerColumn.setLabelProvider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.viewers.TreeViewerColumn
的用法示例。
在下文中一共展示了TreeViewerColumn.setLabelProvider方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createColumn3
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void createColumn3()
{
TreeColumn column = new TreeColumn(_viewer.getTree(), SWT.LEFT);
// column.setText("Step");
TreeViewerColumn viewerColumn = new TreeViewerColumn(_viewer, column);
viewerColumn.setLabelProvider(
new ColumnLabelProvider()
{
@Override
public String getText(Object element)
{
String result = "";
if (element instanceof IExecutionEngine)
{
IExecutionEngine engine = (IExecutionEngine)element;
result = String.format("%d", engine.getEngineStatus().getNbLogicalStepRun());
}
return result;
}
});
}
示例2: createColumns
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void createColumns(TreeViewer viewer) {
viewer.setColumnProperties(new String[] { "Name", "Value"});
ColumnViewerToolTipSupport.enableFor(viewer);
TreeViewerColumn nameColumn = new TreeViewerColumn(viewer, SWT.LEFT, 0);
nameColumn.getColumn().setText("Name");
nameColumn.getColumn().setWidth(200);
nameColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
INamedNode node = (INamedNode)element;
return node.getDisplayName();
}
});
nameColumn.setEditingSupport(new NameEditingSupport(this));
TreeViewerColumn valueColumn = new TreeViewerColumn(viewer, SWT.LEFT, 1);
valueColumn.getColumn().setText("Value");
valueColumn.getColumn().setWidth(300);
valueColumn.setLabelProvider(new DelegatingStyledCellLabelProvider(new ControlValueLabelProvider(cservice, this)));
valueColumn.setEditingSupport(new ControlEditingSupport(viewer, cservice, controlViewerMode));
}
示例3: createColumn
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private TreeViewerColumn createColumn(final Property<?> property) {
TreeViewerColumn column1 = new TreeViewerColumn(viewer, property.getRange().equals(String.class) ? SWT.LEFT : SWT.RIGHT);
column1.setLabelProvider(new DelegatingStyledCellLabelProvider(new TermLabelProvider(property, viewerConfig)));
column1.getColumn().setMoveable(true);
column1.getColumn().setData(property);
column1.getColumn().setText(property.getPropertyName());
column1.getColumn().setToolTipText(String.format("%s%n%s", property.getPropertyName(), property.getDescription()));
if(property instanceof TermProperty && property.isNumeric()) {
column1.getColumn().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
/*
* Good link to Sort examples
*
* http://www.programcreek.com/java-api-examples/index.php?api=org.eclipse.jface.viewers.TreeViewerColumn
*/
updateSortingProperty(property);
}
});
}
layout.setColumnData(column1.getColumn(), getRecommendedSize(property));
return column1;
}
示例4: addAliasColumn
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void addAliasColumn(String namespace) {
TreeViewerColumn aliasColumn = new TreeViewerColumn(commandsTreeTable, SWT.NONE);
aliasColumn.getColumn().setText(namespace);
aliasColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
CommandInfo cmd = (CommandInfo) element;
if (cmd.getAbstract()) {
// show a blank line if the command is abstract
return "";
}
List<NamedObjectId> aliases = cmd.getAliasList();
for (NamedObjectId aliase : aliases) {
if (aliase.getNamespace().equals(namespace))
return aliase.getName();
}
return "";
}
});
tcl.setColumnData(aliasColumn.getColumn(), new ColumnPixelData(COLUMN_WIDTH));
}
示例5: defineColumn_Date
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void defineColumn_Date(final TreeColumnLayout treeLayout) {
final TreeViewerColumn tvc = new TreeViewerColumn(_tourViewer, SWT.LEAD);
tvc.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Object element = cell.getElement();
if (element instanceof TVIWizardCompareYear) {
cell.setText(((TVIWizardCompareYear) element).treeColumn);
} else if (element instanceof TVIWizardCompareMonth) {
cell.setText(((TVIWizardCompareMonth) element).treeColumn);
} else if (element instanceof TVIWizardCompareTour) {
cell.setText(((TVIWizardCompareTour) element).treeColumn);
} else {
cell.setText(UI.EMPTY_STRING);
}
}
});
final TreeColumn tc = tvc.getColumn();
tc.setText(Messages.tourCatalog_wizard_Column_tour);
treeLayout.setColumnData(tc, new ColumnPixelData(convertWidthInCharsToPixels(20)));
}
示例6: postConstruct
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
@PostConstruct
public void postConstruct(Composite parent) {
ResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);
TreeViewer viewer = new TreeViewer(parent);
viewer.setContentProvider(new TreeContentProvider());
viewer.getTree().setHeaderVisible(true);
viewer.getTree().setLinesVisible(true);
viewer.getTree().setFont(resourceManager.createFont(FontDescriptor.createFrom("Arial", 32, SWT.ITALIC)));
TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, SWT.NONE);
viewerColumn.getColumn().setWidth(300);
viewerColumn.getColumn().setText("Names");
viewerColumn.setLabelProvider(new ColumnLabelProvider());
viewer.setInput(new String[] { "Simon Scholz", "Lars Vogel", "Dirk Fauth", "Wim Jongman", "Tom Schindl" });
GridLayoutFactory.fillDefaults().generateLayout(parent);
}
示例7: createPluginColumns
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void createPluginColumns(IPluginModelBase pm)
{
// Add columns in the tree one column per selected plugin.
// Create the first column for the key
TreeViewerColumn col = new TreeViewerColumn(tv, SWT.NONE);
TreeColumn swtCol = col.getColumn();
swtCol.setText(getColumnName(pm));
swtCol.setAlignment(SWT.CENTER);
PluginDataProvider labelProvider = new PluginDataProvider();
labelProvider.setPlugin(pm);
col.setLabelProvider(labelProvider);
swtCol.setToolTipText(pm.getBundleDescription().getName());
swtCol.pack();
columnsCache.put(pm, col);
}
示例8: createColumns
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void createColumns() {
TreeViewerColumn propertyColumn = new TreeViewerColumn(treeViewer, SWT.None);
propertyColumn.getColumn().setText("Test Spec");
propertyColumn.getColumn().setWidth(400);
// propertyColumn.setLabelProvider(new AnalysisResultLabelProvider(Column.PROPERTY, treeViewer));
propertyColumn.setLabelProvider(new TestCaseGeneratorResultLabelProvider(Column.PROPERTY, treeViewer));
TreeViewerColumn resultColumn = new TreeViewerColumn(treeViewer, SWT.None);
resultColumn.getColumn().setText("Result");
// resultColumn.setLabelProvider(new AnalysisResultLabelProvider(Column.RESULT));
resultColumn.setLabelProvider(new TestCaseGeneratorResultLabelProvider(Column.RESULT));
TreeColumnLayout layout = new TreeColumnLayout();
composite.setLayout(layout);
layout.setColumnData(propertyColumn.getColumn(), new ColumnWeightData(2));
layout.setColumnData(resultColumn.getColumn(), new ColumnWeightData(1));
}
示例9: initCols
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void initCols() {
for (ColConfig cf : COLUMNS) {
TreeViewerColumn column = new TreeViewerColumn(treeViewer, SWT.SINGLE);
column.getColumn().setText(cf.name);
column.getColumn().setWidth(cf.colSize);
column.setLabelProvider(new KwsTreeLabelProvider());
}
}
示例10: createColumns
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
protected void createColumns(final Tree tree) {
TableLayout layout = new TableLayout();
tree.setLayout(layout);
tree.setHeaderVisible(true);
for (int i = 0; i < 4; i++) {
if (i == 1) {
layout.addColumnData(new ColumnPixelData(100, true));
} else {
layout.addColumnData(new ColumnPixelData(300, true));
}
TreeColumn column = new TreeColumn(tree, SWT.NONE, i);
if (i == 0) {
column.setText("Resource");
}
if (i == 1) {
column.setText("Project");
}
if (i == 2) {
column.setText("Possible Targets");
}
if (i == 3) {
column.setText("Targets");
}
column.setResizable(true);
TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, column);
viewerColumn
.setLabelProvider(new ResourceChangesColumnLabelProvider(i));
}
}
示例11: defineColumn_AltitudeUp
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void defineColumn_AltitudeUp(final TreeColumnLayout treeLayout) {
final TreeViewerColumn tvc = new TreeViewerColumn(_tourViewer, SWT.TRAIL);
tvc.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Object element = cell.getElement();
if (element instanceof TVIWizardCompareTour) {
final TVIWizardCompareTour tourItem = (TVIWizardCompareTour) element;
final long value = (long) (tourItem.colAltitudeUp / net.tourbook.ui.UI.UNIT_VALUE_ALTITUDE);
cell.setText(Long.toString(value));
} else {
cell.setText(UI.EMPTY_STRING);
}
}
});
final TreeColumn tc = tvc.getColumn();
tc.setText(UI.UNIT_LABEL_ALTITUDE);
tc.setToolTipText(Messages.tourCatalog_wizard_Column_altitude_up_tooltip);
treeLayout.setColumnData(tc, new ColumnWeightData(10));
}
示例12: defineColumn_Distance
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void defineColumn_Distance(final TreeColumnLayout treeLayout) {
final TreeViewerColumn tvc = new TreeViewerColumn(_tourViewer, SWT.TRAIL);
tvc.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Object element = cell.getElement();
if (element instanceof TVIWizardCompareTour) {
final TVIWizardCompareTour tourItem = (TVIWizardCompareTour) element;
final float distance = (tourItem.colDistance) / (1000 * net.tourbook.ui.UI.UNIT_VALUE_DISTANCE);
cell.setText(_nf1.format(distance));
} else {
cell.setText(UI.EMPTY_STRING);
}
}
});
final TreeColumn tc = tvc.getColumn();
tc.setText(UI.UNIT_LABEL_DISTANCE);
tc.setToolTipText(Messages.tourCatalog_wizard_Column_distance_tooltip);
treeLayout.setColumnData(tc, new ColumnWeightData(10));
}
示例13: defineColumn_RecordingTime
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void defineColumn_RecordingTime(final TreeColumnLayout treeLayout) {
final TreeViewerColumn tvc = new TreeViewerColumn(_tourViewer, SWT.TRAIL);
tvc.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final Object element = cell.getElement();
if (element instanceof TVIWizardCompareTour) {
final TVIWizardCompareTour tourItem = (TVIWizardCompareTour) element;
final long recordingTime = tourItem.colRecordingTime;
cell.setText(String.format(//
Messages.Format_hhmm,
(recordingTime / 3600),
((recordingTime % 3600) / 60)));
} else {
cell.setText(UI.EMPTY_STRING);
}
}
});
final TreeColumn tc = tvc.getColumn();
tc.setText(Messages.tourCatalog_wizard_Column_h);
tc.setToolTipText(Messages.tourCatalog_wizard_Column_h_tooltip);
treeLayout.setColumnData(tc, new ColumnWeightData(10));
}
示例14: loadViewer
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
private void loadViewer() {
viewer = new TreeViewer(myParent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
viewer.getTree().setHeaderVisible(true);
viewer.getTree().setLinesVisible(true);
TreeViewerColumn column0 = new TreeViewerColumn(viewer, SWT.LEFT);
column0.getColumn().setText("Module");
column0.getColumn().setWidth(200);
column0.setLabelProvider(new PathLabelProvider());
TreeViewerColumn column00 = new TreeViewerColumn(viewer, SWT.LEFT);
column00.getColumn().setText("Total function coverage");
column00.getColumn().setWidth(150);
column00.setLabelProvider(new TotalLabelProvider());
TreeViewerColumn column1 = new TreeViewerColumn(viewer, SWT.LEFT);
column1.getColumn().setText("Mapping Coverage");
column1.getColumn().setWidth(130);
column1.setLabelProvider(new MappingLabelProvider());
TreeViewerColumn column2 = new TreeViewerColumn(viewer, SWT.LEFT);
column2.getColumn().setText("Helper Coverage");
column2.getColumn().setWidth(130);
column2.setLabelProvider(new HelperLabelProvider());
TreeViewerColumn column3 = new TreeViewerColumn(viewer, SWT.LEFT);
column3.getColumn().setText("Constructor Coverage");
column3.getColumn().setWidth(130);
column3.setLabelProvider(new ConstructorLabelProvider());
TreeViewerColumn column4 = new TreeViewerColumn(viewer, SWT.LEFT);
column4.getColumn().setText("Estimated Expression Coverage");
column4.getColumn().setWidth(200);
column4.setLabelProvider(new ExpressionLabelProvider());
viewer.setContentProvider(new ViewContentProvider());
viewer.addDoubleClickListener(new TransformationClickListener());
}
示例15: createProductEditorTableColumns
import org.eclipse.jface.viewers.TreeViewerColumn; //导入方法依赖的package包/类
/**
* Method creates the columns for the product table.
*/
private void createProductEditorTableColumns() {
String[] titles = getColumnTitles();
int[] bounds = getColumnWidths();
for (int i = 0; i < titles.length; i++) {
TreeViewerColumn column = new TreeViewerColumn(this, SWT.NONE);
column.setLabelProvider(createColumnLabelProvider());
column.getColumn().setText(titles[i]);
column.getColumn().setWidth(bounds[i]);
column.getColumn().setResizable(true);
column.getColumn().setMoveable(true);
if (1 == i) {
column.setEditingSupport(new ConfigurationCellEditor(this, ColumnType.VALUE));
}
if (2 == i) {
column.setEditingSupport(new ConfigurationCellEditor(this, ColumnType.EXTEND));
}
if (3 == i) {
column.setEditingSupport(new ConfigurationCellEditor(this, ColumnType.REMOVE));
}
if (4 == i) {
column.setEditingSupport(new ConfigurationCellEditor(this, ColumnType.FREEZE));
}
}
Tree table = this.getTree();
table.setHeaderVisible(true);
table.setLinesVisible(true);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
/*
* Show scroll bars of parent composite only if less then approx. 3 rows are shown in the table
* Otherwise the scroll bars of the table are used.
*/
data.heightHint = 60;
table.setLayoutData(data);
}