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