本文整理汇总了Java中org.eclipse.jface.viewers.TableViewer.setLabelProvider方法的典型用法代码示例。如果您正苦于以下问题:Java TableViewer.setLabelProvider方法的具体用法?Java TableViewer.setLabelProvider怎么用?Java TableViewer.setLabelProvider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.viewers.TableViewer
的用法示例。
在下文中一共展示了TableViewer.setLabelProvider方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTableViewer
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
private void createTableViewer() {
ArrayEditor arrayEditor = ((ArrayEditor) cellEditor);
tableViewer = new TableViewer(table);
tableViewer.setUseHashlookup(true);
tableViewer.setColumnProperties(arrayEditor.columnNames);
// Assign the cell editors to the viewer
CellEditor[] editors = arrayEditor.getColumnEditors(table);
tableViewer.setCellEditors(editors);
// Set the cell modifier for the viewer
tableViewer.setCellModifier(new ArrayEditorCellModifier(this, tableViewer));
// Set the label provider for the viewer
tableViewer.setLabelProvider(new ArrayEditorLabelProvider(cellEditor.getStyle()));
// Set the content provider
tableViewer.setContentProvider(new ArrayEditorContentProvider());
}
示例2: createTableViewer
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
private void createTableViewer() {
TableEditor tableEditor = ((TableEditor) cellEditor);
tableViewer = new TableViewer(table);
tableViewer.setUseHashlookup(true);
tableViewer.setColumnProperties(tableEditor.columnNames);
// Assign the cell editors to the viewer
CellEditor[] editors = tableEditor.getColumnEditors(table);
tableViewer.setCellEditors(editors);
// Set the cell modifier for the viewer
tableViewer.setCellModifier(new TableEditorCellModifier(this, tableViewer));
// Set the label provider for the viewer
tableViewer.setLabelProvider(new TableEditorLabelProvider());
// Set the content provider
tableViewer.setContentProvider(new TableEditorContentProvider());
}
示例3: createDialogArea
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent)
{
Composite dialogArea = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(dialogArea, SWT.NONE);
createMessageArea(composite);
listViewer = new TableViewer(composite, SWT.TOP | SWT.BORDER);
GridData data = new GridData(GridData.FILL_BOTH);
data.widthHint = 400;
data.heightHint = 400;
listViewer.getTable().setLayoutData(data);
listViewer.setLabelProvider(WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider());
listViewer.setContentProvider(new JarProjectContentProvider(null));
listViewer.setComparator(new ViewerComparator());
listViewer.setInput(ResourcesPlugin.getWorkspace());
applyDialogFont(composite);
listViewer.setSelection(new StructuredSelection(initialSelection));
GridLayoutFactory.fillDefaults().generateLayout(composite);
return dialogArea;
}
示例4: createPartControl
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
/**
* This is a callback that will allow us
* to create the viewer and initialize it.
*/
public void createPartControl(Composite parent) {
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
setColumnsName(viewer);
viewer.setContentProvider(new ExecutionContentProvider());
viewer.setLabelProvider(new ViewLabelProvider());
viewer.setComparator(new PerformanceStatsViewerSorter());
viewer.getTable().setData(PERFORMANCE_VIEW_WIDGET_ID,PERFORMANCE_VIEW_TABLE);
getSite().setSelectionProvider(viewer);
makeActions();
hookContextMenu();
contributeToActionBars();
load () ;
}
示例5: createControl
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
/**
* Create contents of the wizard.
*
* @param parent
*/
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
setControl(container);
container.setLayout(new GridLayout(1, false));
TableViewer tableViewer = new TableViewer(container, SWT.BORDER | SWT.FULL_SELECTION);
table = tableViewer.getTable();
table.setLinesVisible(true);
table.setHeaderVisible(true);
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
tableViewer.setContentProvider(ArrayContentProvider.getInstance());
tableViewer.setInput(candidateList);
tableViewer.setLabelProvider(new MarkerColumn());
// auto size columns
TableColumn[] columns = tableViewer.getTable().getColumns();
for (int i = 0; i < columns.length; i++) {
columns[i].pack();
}
}
示例6: createTableControl
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
private void createTableControl(Composite container) {
tableViewer = new TableViewer(container, SWT.FULL_SELECTION | SWT.BORDER);
String[] columnIndex = new String[] { "主键", "外键", "列名", "名称", "类型", "不能为空", "是否唯一" };
Integer[] columnWidth = new Integer[] { 40, 40, 120, 120, 120, 80, 80 };
Integer[] columnAlign = new Integer[] { SWT.CENTER, SWT.CENTER, SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.CENTER, SWT.CENTER };
for (int i = 0; i < columnIndex.length; i++) {
TableViewerColumn choice = new TableViewerColumn(tableViewer, SWT.BORDER);
choice.getColumn().setText(columnIndex[i]);
choice.getColumn().setWidth(columnWidth[i]);
choice.getColumn().setAlignment(columnAlign[i]);
}
tableViewer.getTable().setHeaderVisible(true);
tableViewer.getTable().setLinesVisible(true);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 4;
tableViewer.getTable().setLayoutData(gd);
tableViewer.setContentProvider(new ArrayContentProvider());
tableViewer.setLabelProvider(new TableColumnLabelProvider());
tableViewer.setInput(model.getColumns());
}
示例7: createContents
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
@Override
protected Control createContents(Composite parent)
{
Composite composite = new Composite(parent, SWT.NONE);
initialize();
createDescriptionLabel(composite);
listViewer = new TableViewer(composite, SWT.TOP | SWT.BORDER);
if( !project.isOpen() )
listViewer.getControl().setEnabled(false);
listViewer.setLabelProvider(WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider());
listViewer.setContentProvider(new JarProjectContentProvider(project));
listViewer.setComparator(new ViewerComparator());
listViewer.setInput(project.getWorkspace());
String regName = getPreferenceStore().getString(JPFClasspathPlugin.PREF_REGISTRY_NAME);
if( !regName.isEmpty() )
{
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
listViewer.setSelection(new StructuredSelection(root.getProject(regName)));
}
listViewer.addSelectionChangedListener(new ISelectionChangedListener()
{
@Override
public void selectionChanged(SelectionChangedEvent event)
{
modified = true;
}
});
applyDialogFont(composite);
GridLayoutFactory.fillDefaults().generateLayout(composite);
return composite;
}
示例8: attachWidget
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
@Override
public void attachWidget(Composite container) {
TableViewer tableViewer = new TableViewer(container, SWT.BORDER|SWT.CENTER | SWT.MULTI | SWT.FULL_SELECTION |SWT.H_SCROLL |SWT.V_SCROLL|SWT.RESIZE);
tableViewer.setContentProvider(iStructuredContentProvider);
tableViewer.setLabelProvider(iTableLabelProvider);
jfaceWidgets = tableViewer;
widget = tableViewer.getTable();
}
示例9: createTableViewer
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
public TableViewer createTableViewer(Composite composite, String[] prop,
int[] bounds, int columnWidth,
IStructuredContentProvider iStructuredContentProvider,
ITableLabelProvider iTableLabelProvider) {
final TableViewer tableViewer = new TableViewer(composite, SWT.BORDER
| SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);
Table table = tableViewer.getTable();
table.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
tableViewer.setContentProvider(iStructuredContentProvider);
tableViewer.setLabelProvider(iTableLabelProvider);
tableViewer.setColumnProperties(prop);
tableViewer.getTable().addTraverseListener(new TraverseListener() {
@Override
public void keyTraversed(TraverseEvent e) {
if (e.keyCode == SWT.ARROW_UP) {
e.doit = false;
} else if (e.keyCode == SWT.ARROW_DOWN) {
e.doit = false;
} else if (e.keyCode == SWT.TRAVERSE_ARROW_NEXT) {
e.doit = false;
} else if (e.keyCode == SWT.TRAVERSE_ARROW_PREVIOUS) {
e.doit = false;
}
}
});
table.setVisible(true);
table.setLinesVisible(true);
table.setHeaderVisible(true);
/*
* createTableColumns(table,prop, columnWidth); CellEditor[] editors
* =createCellEditorList(table,1); tableViewer.setCellEditors(editors);
*/
return tableViewer;
}
示例10: createInputFieldTable
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
private void createInputFieldTable(Composite container) {
Composite inputFieldComposite = new Composite(container, SWT.NONE);
inputFieldComposite.setLayout(new GridLayout(2, false));
GridData gd_composite = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
gd_composite.widthHint = 250;
inputFieldComposite.setLayoutData(gd_composite);
new Label(inputFieldComposite, SWT.NONE);
inputFieldTableViewer = new TableViewer(inputFieldComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
setTableViewer(inputFieldTableViewer, inputFieldComposite, new String[] { Messages.OPERATIONAL_SYSTEM_FIELD },
new TableContentProvider());
inputFieldTableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
DragDropUtility.INSTANCE.applyDragFromTableViewer(inputFieldTableViewer.getTable());
inputFieldTableViewer.setLabelProvider(new InputFieldColumnLabelProvider());
inputFieldTableViewer.setInput(transformMapping.getInputFields());
addControlListener(inputFieldTableViewer.getTable());
inputFieldTableViewer.getControl().addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent e)
{
TransformMappingFeatureUtility.INSTANCE.highlightInputAndOutputFields(null,
inputFieldTableViewer,outputFieldViewer,null,null);
}
});
}
示例11: createTargetTable
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
private void createTargetTable(Composite container) {
targetTableViewer = new TableViewer(container, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
targetTable = targetTableViewer.getTable();
GridData gd_table_1 = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2);
gd_table_1.heightHint = 401;
if(OSValidator.isMac()){
gd_table_1.widthHint = 363;
}else{
gd_table_1.widthHint = 352;
}
targetTable.setLayoutData(gd_table_1);
attachTargetTableListeners();
targetTableViewer.setContentProvider(new SecondaryColumnKeysContentProvider());
targetTableViewer.setLabelProvider(new SecondaryColumnKeysLabelProvider());
targetTableViewer.setInput(propertyList);
TableColumn targetTableColumnFieldName = new TableColumn(targetTable, SWT.LEFT);
targetTableColumnFieldName.setText(COLUMNNAME); //$NON-NLS-1$
TableColumn targetTableColumnSortOrder = new TableColumn(targetTable, SWT.LEFT_TO_RIGHT);
targetTableColumnSortOrder.setText(SORTORDER); //$NON-NLS-1$
for (int i = 0, n = targetTable.getColumnCount(); i < n; i++) {
targetTable.getColumn(i).pack();
}
targetTableColumnFieldName.setWidth(175);
if(OSValidator.isMac()){
targetTableColumnSortOrder.setWidth(128);
}else{
targetTableColumnSortOrder.setWidth(116);
}
targetTable.setHeaderVisible(true);
targetTable.setLinesVisible(true);
// enables the tab functionality
TableViewerEditor.create(targetTableViewer, new ColumnViewerEditorActivationStrategy(targetTableViewer),
ColumnViewerEditor.KEYBOARD_ACTIVATION | ColumnViewerEditor.TABBING_HORIZONTAL
| ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.TABBING_VERTICAL);
final CellEditor propertyNameeditor = new TextCellEditor(targetTable);
ComboBoxViewerCellEditor propertyValueeditor = new ComboBoxViewerCellEditor(targetTable, SWT.READ_ONLY);
propertyValueeditor.setContentProvider(new ArrayContentProvider());
propertyValueeditor.setLabelProvider(new LabelProvider());
propertyValueeditor.setInput(new String[] { Constants.ASCENDING_SORT_ORDER, Constants.DESCENDING_SORT_ORDER, Constants.NONE_SORT_ORDER });
CellEditor[] editors = new CellEditor[] { propertyNameeditor, propertyValueeditor };
propertyNameeditor.setValidator(createNameEditorValidator(Messages.EmptyColumnNotification));
propertyValueeditor.setValidator(createValueEditorValidator(Messages.EmptySortOrderNotification));
targetTableViewer.setColumnProperties(PROPS);
targetTableViewer.setCellModifier(new SecondaryColumnKeysWidgetCellModifier(targetTableViewer));
targetTableViewer.setCellEditors(editors);
loadProperties(targetTableViewer);
if (propertyList.size() != 0) {
deleteButton.setEnabled(true);
}
if (propertyList.size() >= 2) {
upButton.setEnabled(true);
downButton.setEnabled(true);
}
dropTarget = new DropTarget(targetTable, DND.DROP_MOVE);
dropTarget.setTransfer(new Transfer[] { TextTransfer.getInstance() });
dropTarget.addDropListener(new DropTargetAdapter() {
public void drop(DropTargetEvent event) {
for (String fieldName : getformatedData((String) event.data))
addNewProperty(targetTableViewer, fieldName);
enableControlButtons();
}
});
}
示例12: createTableViewer
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
/**
* Creates the table viewer.
*
* @param tableViewer
* the table viewer
* @param iStructuredContentProvider
* the i structured content provider
* @param iTableLabelProvider
* the i table label provider
* @return the table viewer
*/
public static TableViewer createTableViewer( TableViewer tableViewer,IStructuredContentProvider iStructuredContentProvider,ITableLabelProvider iTableLabelProvider){
tableViewer.setContentProvider(iStructuredContentProvider);
tableViewer.setLabelProvider(iTableLabelProvider);
return tableViewer;
}