當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。