本文整理汇总了Java中org.eclipse.jface.viewers.TableViewer.setContentProvider方法的典型用法代码示例。如果您正苦于以下问题:Java TableViewer.setContentProvider方法的具体用法?Java TableViewer.setContentProvider怎么用?Java TableViewer.setContentProvider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.viewers.TableViewer
的用法示例。
在下文中一共展示了TableViewer.setContentProvider方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createPartControl
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
/**
* Create contents of the view part.
* @param parent
*/
public void createPartControl(Composite parent) {
viewer = new TableViewer(parent, SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE);
viewer.getTable().setLinesVisible(true);
viewer.getTable().setHeaderVisible(true);
viewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
createColumns(viewer, "Name", "Value", "Type");
viewer.setContentProvider(new ScannableContentProvider(cservice));
try {
viewer.setInput(getMonitors());
} catch (Exception e) {
logger.error("Cannot find selected monitors");
}
}
示例4: 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;
}
示例5: 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 () ;
}
示例6: 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();
}
}
示例7: setTableViewer
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
public TableViewer setTableViewer(TableViewer tableViewer, Composite composite, String[] prop,
IStructuredContentProvider iStructuredContentProvider, ITableLabelProvider iTableLabelProvider) {
tableViewer.setContentProvider(iStructuredContentProvider);
tableViewer.setColumnProperties(prop);
tableViewerTable = tableViewer.getTable();
tableViewerTable.setVisible(true);
tableViewerTable.setLinesVisible(true);
tableViewerTable.setHeaderVisible(true);
createTableColumns(tableViewerTable, prop);
editors = createCellEditorList(tableViewerTable, prop.length);
tableViewer.setCellEditors(editors);
TableViewerEditor.create(tableViewer, new ColumnViewerEditorActivationStrategy(tableViewer),
ColumnViewerEditor.KEYBOARD_ACTIVATION | ColumnViewerEditor.TABBING_HORIZONTAL
| ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.TABBING_VERTICAL);
return tableViewer;
}
示例8: setTableViewer
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
public TableViewer setTableViewer(TableViewer tableViewer, Composite composite, String[] prop,
IStructuredContentProvider iStructuredContentProvider) {
tableViewer.setContentProvider(iStructuredContentProvider);
tableViewer.setColumnProperties(prop);
tableViewerTable = tableViewer.getTable();
tableViewerTable.setVisible(true);
tableViewerTable.setLinesVisible(true);
tableViewerTable.setHeaderVisible(true);
createTableColumns(tableViewerTable, prop);
editors = createCellEditorList(tableViewerTable, prop.length);
tableViewer.setCellEditors(editors);
TableViewerEditor.create(tableViewer, new ColumnViewerEditorActivationStrategy(tableViewer),
ColumnViewerEditor.KEYBOARD_ACTIVATION | ColumnViewerEditor.TABBING_HORIZONTAL
| ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.TABBING_VERTICAL);
return tableViewer;
}
示例9: createSourceTable
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
private void createSourceTable(SashForm sashForm) {
avaliableFieldTableViewer = new TableViewer(sashForm, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
table_1 = avaliableFieldTableViewer.getTable();
table_1.setLinesVisible(true);
table_1.setHeaderVisible(true);
avaliableFieldTableViewer.setContentProvider(new IStructuredContentProvider() {
@Override
public Object[] getElements(Object inputElement) {
return ((List) inputElement).toArray();
}
});
avaliableFieldTableViewer.setInput(schemaFields);
TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(avaliableFieldTableViewer, SWT.NONE);
TableColumn tblclmnNewColumn_2 = tableViewerColumn_2.getColumn();
tblclmnNewColumn_2.setWidth(196);
tblclmnNewColumn_2.setText(Messages.AVAILABLE_FIELDS_HEADER);
tableViewerColumn_2.setLabelProvider(new ColumnLabelProvider());
attachDragListener();
}
示例10: createPartControl
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
@Override
public void createPartControl(Composite parent) {
viewer = new TableViewer(parent, SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE);
viewer.getTable().setLinesVisible(true);
viewer.getTable().setHeaderVisible(false);
viewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
createColumns(viewer, "", "Name");
try {
this.dservice = ServiceHolder.getEventService().createRemoteService(getUri(), IRunnableDeviceService.class);
viewer.setContentProvider(new DetectorContentProvider(dservice));
} catch (Exception e) {
logger.error("Cannot create content provider", e);
}
viewer.setInput(new Object());
selectionProvider = new DelegatingSelectionProvider(viewer);
getSite().setSelectionProvider(selectionProvider);
createActions();
initializeToolBar();
initializeMenu();
}
示例11: createDialogArea
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
// create a composite with standard margins and spacing
Composite composite = (Composite)super.createDialogArea(parent);
composite.setLayout(new GridLayout(1, false));
final CLabel warning = new CLabel(composite, SWT.LEFT);
warning.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
warning.setImage(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/error.png").createImage());
warning.setText("Expert queue configuration parameters, please use with caution.");
TableViewer viewer = new TableViewer(composite, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
viewer.setUseHashlookup(true);
viewer.getTable().setHeaderVisible(true);
viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
createColumns(viewer);
viewer.setContentProvider(createContentProvider());
viewer.setInput(props);
final Button adv = new Button(composite, SWT.PUSH);
adv.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
adv.setText("Advanced...");
adv.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(getShell(), "org.dawnsci.commandserver.ui.activemqPage", null, null);
if (pref != null) pref.open();
}
});
return composite;
}
示例12: createViewer
import org.eclipse.jface.viewers.TableViewer; //导入方法依赖的package包/类
private void createViewer(Composite parent) {
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER | SWT.CHECK | SWT.READ_ONLY | SWT.PUSH);
createColumns(parent, viewer);
final Table table = viewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
viewer.getTable().addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(org.eclipse.swt.widgets.Event event) {
if (highlightNodes.getSelection())
highlightNodesOnGraph(highlightNodes.getSelection());
}
});
viewer.setContentProvider(new ArrayContentProvider());
viewer.setInput(this.units);
getSite().setSelectionProvider(viewer);
GridData gridData = new GridData();
gridData.verticalAlignment = GridData.FILL;
gridData.horizontalSpan = 2;
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
viewer.getControl().setLayoutData(gridData);
Hashtable<String, Object> properties = new Hashtable<>();
String[] topics = new String[] { DataModel.EA_TOPIC_DATA_SELECTION, DataModel.EA_TOPIC_DATA_UNIT_CHANGED, DataModel.EA_TOPIC_DATA_VIEW_REFRESH };
properties.put(EventConstants.EVENT_TOPIC, topics);
ServiceUtil.registerService(EventHandler.class, this, properties);
}
示例13: 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;
}
示例14: 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();
}
示例15: 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;
}