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


Java ITableLabelProvider.getColumnText方法代码示例

本文整理汇总了Java中org.eclipse.jface.viewers.ITableLabelProvider.getColumnText方法的典型用法代码示例。如果您正苦于以下问题:Java ITableLabelProvider.getColumnText方法的具体用法?Java ITableLabelProvider.getColumnText怎么用?Java ITableLabelProvider.getColumnText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jface.viewers.ITableLabelProvider的用法示例。


在下文中一共展示了ITableLabelProvider.getColumnText方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: compareColumn

import org.eclipse.jface.viewers.ITableLabelProvider; //导入方法依赖的package包/类
private int compareColumn(final Viewer viewer, final Object a, final Object b, final int columnNumber) {
	// if (columnNumber == CATEGORY_COLUMN) {
	// return sortUser(a, b);
	// }
	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,代码行数:16,代码来源:KeysPreferencePage.java

示例8: defaultColumnCompare

import org.eclipse.jface.viewers.ITableLabelProvider; //导入方法依赖的package包/类
/**
 * Performs a default column-wise comparison of two elements. This method is
 * called after checking for any {@link Comparator} set through
 * {@link #setComparator(int, Comparator)}. Subclasses may override. The
 * base class implementation uses this sorter's {@link Collator} to compare
 * the column text for each element provided by the viewer's label provider.
 *
 * @param columnIndex
 *        the index of the column being sorted by
 * @param viewer
 *        the {@link Viewer} we are sorting for
 * @param e1
 *        the first element
 * @param e2
 *        the second element
 * @return a comparison value
 */
protected int defaultColumnCompare(final int columnIndex, final Viewer viewer, final Object e1, final Object e2) {
    final ITableLabelProvider labelProvider = (ITableLabelProvider) ((StructuredViewer) viewer).getLabelProvider();

    String s1 = labelProvider.getColumnText(e1, columnIndex);
    String s2 = labelProvider.getColumnText(e2, columnIndex);

    if (s1 == null) {
        s1 = ""; //$NON-NLS-1$
    }
    if (s2 == null) {
        s2 = ""; //$NON-NLS-1$
    }

    return getCollator().compare(s1, s2);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:33,代码来源:TableViewerSorter.java

示例9: compare

import org.eclipse.jface.viewers.ITableLabelProvider; //导入方法依赖的package包/类
public int compare( Viewer viewer, Object e1, Object e2 )
{
	String name1;
	String name2;

	if ( viewer == null || !( viewer instanceof ContentViewer ) )
	{
		if ( descent )
		{
			name1 = e2.toString( );
			name2 = e1.toString( );
		}
		else
		{
			name1 = e1.toString( );
			name2 = e2.toString( );
		}
	}
	else
	{
		IBaseLabelProvider prov = ( (ContentViewer) viewer ).getLabelProvider( );
		if ( prov instanceof ITableLabelProvider )
		{
			ITableLabelProvider lprov = (ITableLabelProvider) prov;
			if ( second )
			{
				if ( descent )
				{
					name1 = lprov.getColumnText( e2, 1 );
					name2 = lprov.getColumnText( e1, 1 );
				}
				else
				{
					name1 = lprov.getColumnText( e1, 1 );
					name2 = lprov.getColumnText( e2, 1 );
				}
			}
			else
			{
				if ( descent )
				{
					name1 = lprov.getColumnText( e2, 0 );
					name2 = lprov.getColumnText( e1, 0 );
				}
				else
				{
					name1 = lprov.getColumnText( e1, 0 );
					name2 = lprov.getColumnText( e2, 0 );
				}
			}
		}
		else
		{
			if ( descent )
			{
				name1 = e2.toString( );
				name2 = e1.toString( );
			}
			else
			{
				name1 = e1.toString( );
				name2 = e2.toString( );
			}
		}
	}
	if ( name1 == null )
	{
		name1 = ""; //$NON-NLS-1$
	}
	if ( name2 == null )
	{
		name2 = ""; //$NON-NLS-1$
	}

	return collator.compare( name1, name2 );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:77,代码来源:ResourceEditDialog.java


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