本文整理汇总了Java中org.eclipse.jface.viewers.ITableLabelProvider类的典型用法代码示例。如果您正苦于以下问题:Java ITableLabelProvider类的具体用法?Java ITableLabelProvider怎么用?Java ITableLabelProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITableLabelProvider类属于org.eclipse.jface.viewers包,在下文中一共展示了ITableLabelProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setTableViewer
import org.eclipse.jface.viewers.ITableLabelProvider; //导入依赖的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;
}
示例2: buildColumnSorter
import org.eclipse.jface.viewers.ITableLabelProvider; //导入依赖的package包/类
private ViewerComparator buildColumnSorter(int columnIndex) {
switch (columnIndex) {
case INDEX_ROOT:
return new RootSorter();
case INDEX_RANK:
return new RankSorter();
case INDEX_PREDS:
return new PredecessorCountSorter();
case INDEX_SUCCS:
return new SuccessorCountSorter();
}
// By default, use an alphabetic sort over the column labels.
ITableLabelProvider labelProvider =
(ITableLabelProvider) propViewer.getLabelProvider();
ViewerComparator result = new AlphabeticSorter(
new LabelProviderToString(labelProvider, columnIndex));
return result;
}
示例3: setSortColumn
import org.eclipse.jface.viewers.ITableLabelProvider; //导入依赖的package包/类
private void setSortColumn(
TableColumn column, int colIndex, int direction) {
ITableLabelProvider labelProvider =
(ITableLabelProvider) kindViewer.getLabelProvider();
ViewerComparator sorter = new AlphabeticSorter(
new LabelProviderToString(labelProvider, colIndex));
if (SWT.UP == direction) {
sorter = new InverseSorter(sorter);
}
Table tableControl = (Table) kindViewer.getControl();
kindViewer.setComparator(sorter);
tableControl.setSortColumn(column);
tableControl.setSortDirection(direction);
}
示例4: buildColumnSorter
import org.eclipse.jface.viewers.ITableLabelProvider; //导入依赖的package包/类
private ViewerComparator buildColumnSorter(int colIndex) {
if (INDEX_VISIBLE == colIndex) {
return new BooleanVisibleSorter();
}
if (INDEX_XPOS == colIndex) {
return new PositionSorter(true);
}
if (INDEX_YPOS == colIndex) {
return new PositionSorter(false);
}
// By default, use an alphabetic sort over the column labels.
ITableLabelProvider labelProvider =
(ITableLabelProvider) propViewer.getLabelProvider();
ViewerComparator result = new AlphabeticSorter(
new LabelProviderToString(labelProvider, colIndex));
return result;
}
示例5: compareNormal
import org.eclipse.jface.viewers.ITableLabelProvider; //导入依赖的package包/类
protected int compareNormal(Object e1, Object e2) {
ITableLabelProvider labelProvider = (ITableLabelProvider) viewer.getLabelProvider();
String t1 = labelProvider.getColumnText(e1, colIndex);
String t2 = labelProvider.getColumnText(e2, colIndex);
Boolean isNumber = (Boolean) this.col.getData("isNumber");
if (isNumber != null && isNumber.booleanValue()) {
t1 = ColumnLabelSorter.numonly(t1);
t2 = ColumnLabelSorter.numonly(t2);
double n1 = CastUtil.cdouble(t1);
double n2 = CastUtil.cdouble(t2);
return n1 == n2 ? 0 : (n1 > n2) ? 1 : -1;
} else {
if (t1 == null) t1 = "";
if (t2 == null) t2 = "";
}
return t1.compareTo(t2);
}
示例6: compareColumn
import org.eclipse.jface.viewers.ITableLabelProvider; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private int compareColumn(final Viewer inViewer, final Object inA,
final Object inB, final int inColumnNumber) {
if (inColumnNumber == USER_DELTA_COLUMN) {
return sortUser(inA, inB);
}
final IBaseLabelProvider lBaseLabel = ((TreeViewer) inViewer)
.getLabelProvider();
if (lBaseLabel instanceof ITableLabelProvider) {
final ITableLabelProvider lTableProvider = (ITableLabelProvider) lBaseLabel;
final String lProvider1 = lTableProvider.getColumnText(inA,
inColumnNumber);
final String lProvider2 = lTableProvider.getColumnText(inB,
inColumnNumber);
if (lProvider1 != null && lProvider2 != null) {
return getComparator().compare(lProvider1, lProvider2);
}
}
return 0;
}
示例7: createTableViewer
import org.eclipse.jface.viewers.ITableLabelProvider; //导入依赖的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;
}
示例8: compare
import org.eclipse.jface.viewers.ITableLabelProvider; //导入依赖的package包/类
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
if (viewer instanceof TableViewer) {
IBaseLabelProvider baseLabel = ((TableViewer) viewer).getLabelProvider();
String left = ((ITableLabelProvider) baseLabel).getColumnText(e1, fSortColumn);
String right = ((ITableLabelProvider) baseLabel).getColumnText(e2, fSortColumn);
int sortResult = getComparator().compare(left != null ? left : "", right != null ? right : "");
return sortResult * fSortOrder;
}
return super.compare(viewer, e1, e2);
}
示例9: doCompare
import org.eclipse.jface.viewers.ITableLabelProvider; //导入依赖的package包/类
@Override protected int doCompare(Viewer viewer, Object e1, Object e2) {
logger.trace("e1 = "+e1+" e2 = "+e2);
String l1 = null, l2 = null;
if (false) {
ITableLabelProvider labelProvider = (ITableLabelProvider) ((TableViewer)viewer).getLabelProvider();
l1 = labelProvider.getColumnText(e1, columnIndex);
l2 = labelProvider.getColumnText(e2, columnIndex);
} else {
Table t = ((TableViewer)viewer).getTable();
int r1 = getRowIndex(viewer, e1);
int r2 = getRowIndex(viewer, e2);
if (r1 != -1)
l1 = t.getItem(r1).getText(columnIndex);
if (r2 != -1)
l2 = t.getItem(r2).getText(columnIndex);
}
if (l1 == null && l2 == null)
return 0;
else if (l1 == null && l2 != null)
return -1;
else if (l1 != null && l2 == null)
return 1;
try {
int i1 = Integer.parseInt(l1);
int i2 = Integer.parseInt(l2);
return Integer.compare(i1, i2);
} catch (NumberFormatException e) {
return l1.compareTo(l2);
}
}
示例10: doCompare
import org.eclipse.jface.viewers.ITableLabelProvider; //导入依赖的package包/类
/**
* Overwrite this compare method if text comparison isn't what you need
* @param TableViewer
* @param e1
* @param e2
* @return
*/
protected int doCompare(Viewer TableViewer, Object e1, Object e2) {
ITableLabelProvider lp = ((ITableLabelProvider) viewer
.getLabelProvider());
String t1 = lp.getColumnText(e1, index);
String t2 = lp.getColumnText(e2, index);
return t1.compareTo(t2);
}
示例11: buildColumnSorter
import org.eclipse.jface.viewers.ITableLabelProvider; //导入依赖的package包/类
private ViewerComparator buildColumnSorter(int colIndex) {
// By default, use an alphabetic sort over the column labels.
ITableLabelProvider labelProvider =
(ITableLabelProvider) propViewer.getLabelProvider();
ViewerComparator result = new AlphabeticSorter(
new LabelProviderToString(labelProvider, colIndex));
return result;
}
示例12: buildColumnSorter
import org.eclipse.jface.viewers.ITableLabelProvider; //导入依赖的package包/类
private ViewerComparator buildColumnSorter(int colIndex) {
if (INDEX_VISIBLE == colIndex) {
return new BooleanViewSorter();
}
// By default, use an alphabetic sort over the column labels.
ITableLabelProvider labelProvider =
(ITableLabelProvider) relSetViewer.getLabelProvider();
ViewerComparator result = new AlphabeticSorter(
new LabelProviderToString(labelProvider, colIndex));
return result;
}
示例13: TableFieldEditor
import org.eclipse.jface.viewers.ITableLabelProvider; //导入依赖的package包/类
public TableFieldEditor(String name, String labelText, Composite parent, IStructuredContentProvider contentProvider,
ITableLabelProvider labelProvider, String[] columnHeaders, Object input) {
this.contentProvider = contentProvider;
this.labelProvider = labelProvider;
this.columnHeaders = columnHeaders;
this.input = input;
this.init(name, labelText);
this.createControl(parent);
}
示例14: compare
import org.eclipse.jface.viewers.ITableLabelProvider; //导入依赖的package包/类
public int compare(Viewer viewer, Object e1, Object e2) {
if (viewer instanceof TableViewer) {
TableViewer tableViewer = (TableViewer) viewer;
IBaseLabelProvider baseLabel = tableViewer.getLabelProvider();
if (baseLabel instanceof ITableLabelProvider) {
ITableLabelProvider tableProvider = (ITableLabelProvider) baseLabel;
String e1p = tableProvider.getColumnText(e1, sortColumn);
String e2p = tableProvider.getColumnText(e2, sortColumn);
int result = getComparator().compare(e1p, e2p);
return ascending ? result : (-1) * result;
}
}
return super.compare(viewer, e1, e2);
}
示例15: compareColumn
import org.eclipse.jface.viewers.ITableLabelProvider; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private int compareColumn(final Viewer viewer, final Object a, final Object b, final int columnNumber) {
IBaseLabelProvider baseLabel = ((TreeViewer) viewer).getLabelProvider();
if (baseLabel instanceof ITableLabelProvider) {
ITableLabelProvider tableProvider = (ITableLabelProvider) baseLabel;
String e1p = tableProvider.getColumnText(a, columnNumber);
String e2p = tableProvider.getColumnText(b, columnNumber);
if (e1p != null && e2p != null) {
return getComparator().compare(e1p, e2p);
}
}
return 0;
}