当前位置: 首页>>代码示例>>Java>>正文


Java ITableLabelProvider类代码示例

本文整理汇总了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;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:23,代码来源:ELTOperationClassDialog.java

示例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;
}
 
开发者ID:google,项目名称:depan,代码行数:20,代码来源:NodeStatsTableControl.java

示例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);
}
 
开发者ID:google,项目名称:depan,代码行数:17,代码来源:NodeKindTableControl.java

示例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;
}
 
开发者ID:google,项目名称:depan,代码行数:19,代码来源:NodeDisplayTableControl.java

示例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);
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:18,代码来源:TreeLabelSorter.java

示例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;
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:21,代码来源:RelationsKeysPreferencePage.java

示例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;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:40,代码来源:ELTSWTWidgets.java

示例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);
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:15,代码来源:ColumnViewerComparator.java

示例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);	
	}
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:35,代码来源:DefaultTableColumnViewerSorter.java

示例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);
}
 
开发者ID:kwin,项目名称:cppcheclipse,代码行数:15,代码来源:TableEditor.java

示例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;
  }
 
开发者ID:google,项目名称:depan,代码行数:10,代码来源:EdgeDisplayTableControl.java

示例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;
}
 
开发者ID:google,项目名称:depan,代码行数:13,代码来源:RelationSetTableControl.java

示例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);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:10,代码来源:TableFieldEditor.java

示例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);
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:16,代码来源:LocalizeDialog.java

示例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;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:14,代码来源:LanguageCodesPreferencePage.java


注:本文中的org.eclipse.jface.viewers.ITableLabelProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。