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


Java IBaseLabelProvider类代码示例

本文整理汇总了Java中org.eclipse.jface.viewers.IBaseLabelProvider的典型用法代码示例。如果您正苦于以下问题:Java IBaseLabelProvider类的具体用法?Java IBaseLabelProvider怎么用?Java IBaseLabelProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: run

import org.eclipse.jface.viewers.IBaseLabelProvider; //导入依赖的package包/类
@Override
public void run() {
	Shell shell = getActiveWorkbenchShell();
	if (shell == null || fViewer == null) return;

	IBaseLabelProvider labelProvider = fViewer.getLabelProvider();
	String lineDelim = System.getProperty("line.separator"); //$NON-NLS-1$
	StringBuffer buf = new StringBuffer();
	Iterator<?> iter = getSelection();
	while (iter.hasNext()) {
		if (buf.length() > 0) {
			buf.append(lineDelim);
		}
		buf.append(getText(labelProvider, iter.next()));
	}

	if (buf.length() > 0) {
		copyToClipboard(buf.toString(), shell);
	}
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:21,代码来源:CopyToClipboardAction.java

示例2: getLabel

import org.eclipse.jface.viewers.IBaseLabelProvider; //导入依赖的package包/类
private String getLabel(final Viewer viewer, final Object e1) {
	String name1;
	if (viewer == null || !(viewer instanceof ContentViewer)) {
		name1 = e1.toString();
	} else {
		final IBaseLabelProvider prov = ((ContentViewer) viewer).getLabelProvider();
		if (prov instanceof ILabelProvider) {
			final ILabelProvider lprov = (ILabelProvider) prov;
			name1 = lprov.getText(e1);
		} else {
			name1 = e1.toString();
		}
	}
	if (name1 == null) {
		name1 = "";//$NON-NLS-1$
	}
	return name1;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:19,代码来源:FileFolderSorter.java

示例3: getPostQualifiedLabelProvider

import org.eclipse.jface.viewers.IBaseLabelProvider; //导入依赖的package包/类
public static IBaseLabelProvider getPostQualifiedLabelProvider() {
	return new DelegatingStyledCellLabelProvider(new JavaElementLabelProvider(
			JavaElementLabelProvider.SHOW_POST_QUALIFIED | JavaElementLabelProvider.SHOW_SMALL_ICONS)) {
		@Override
		protected StyledString getStyledText(Object element) {
			String nameWithQualifier = getStyledStringProvider().getStyledText(element).getString() + " ";
			int separatorIndex = nameWithQualifier.indexOf('-');

			if (separatorIndex == -1)
				return new StyledString(nameWithQualifier);

			StyledString name = new StyledString(nameWithQualifier.substring(0, separatorIndex));
			String qualifier = nameWithQualifier.substring(separatorIndex);
			return name.append(new StyledString(qualifier, StyledString.QUALIFIER_STYLER));
		};
	};
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:18,代码来源:WizardUtils.java

示例4: updateDayViewerFonts

import org.eclipse.jface.viewers.IBaseLabelProvider; //导入依赖的package包/类
private void updateDayViewerFonts() {
	Font font = getDaysTreeFont(true);
	for (DayViewer dayViewer : dayViewers) {
		MergeTreeViewer treeViewer = dayViewer.getTreeTableViewer();
		treeViewer.getTree().setFont(font);
		MergeTotalComposite totalComposite = (MergeTotalComposite)dayViewer.getTotalViewer().getControl();
		totalComposite.getTable().setFont(font);
		IBaseLabelProvider labelProvider = treeViewer.getLabelProvider();
		if (labelProvider instanceof MergeTreeLabelProvider) {
			MergeTreeLabelProvider mergeTreeLabelProvider = (MergeTreeLabelProvider)labelProvider;
			mergeTreeLabelProvider.setLabelFontSize(getDaysTreeFontSize());
			mergeTreeLabelProvider.updateFonts();
		}
		treeViewer.refresh(true);
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:17,代码来源:DaysComposite.java

示例5: getNonJavaElementLabel

import org.eclipse.jface.viewers.IBaseLabelProvider; //导入依赖的package包/类
private String getNonJavaElementLabel(Viewer viewer, Object element) {
	// try to use the workbench adapter for non - java resources or if not available, use the viewers label provider
	if (element instanceof IResource) {
		return ((IResource) element).getName();
	}
	if (element instanceof IStorage) {
		return ((IStorage) element).getName();
	}
	if (element instanceof IAdaptable) {
		IWorkbenchAdapter adapter= (IWorkbenchAdapter) ((IAdaptable) element).getAdapter(IWorkbenchAdapter.class);
		if (adapter != null) {
			return adapter.getLabel(element);
		}
	}
	if (viewer instanceof ContentViewer) {
		IBaseLabelProvider prov = ((ContentViewer) viewer).getLabelProvider();
		if (prov instanceof ILabelProvider) {
			return ((ILabelProvider) prov).getText(element);
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:JavaElementComparator.java

示例6: compare

import org.eclipse.jface.viewers.IBaseLabelProvider; //导入依赖的package包/类
@Override
public int compare(Viewer viewer, Object e1, Object e2) {

       int cat1 = category(e1);
       int cat2 = category(e2);

       if (cat1 != cat2)
           return cat1 - cat2;

       if (cat1 == ATTRIBUTE || cat1 == CONTAINER_ENTRY) {
       	return 0; // do not sort attributes or container entries
       }

	if (viewer instanceof ContentViewer) {
		IBaseLabelProvider prov = ((ContentViewer) viewer).getLabelProvider();
           if (prov instanceof ILabelProvider) {
               ILabelProvider lprov = (ILabelProvider) prov;
               String name1 = lprov.getText(e1);
               String name2 = lprov.getText(e2);
               return getComparator().compare(name1, name2);
           }
	}
	return 0;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:CPListElementSorter.java

示例7: compare

import org.eclipse.jface.viewers.IBaseLabelProvider; //导入依赖的package包/类
public int compare( Viewer viewer, Object e1, Object e2 )
{
	IBaseLabelProvider provider = null;
	if ( viewer instanceof TreeViewer )
	{
		provider =( ( TreeViewer )viewer ).getLabelProvider( );
	}
	if ( provider != null && provider instanceof SampleReportsExplorerProvider )
	{
		if( ( ( SampleReportsExplorerProvider )provider ).getText( e1 ).equals( "Contribute Samples" ) ) //$NON-NLS-1$
		{
			return 1;
		}
		else if ( ( ( SampleReportsExplorerProvider )provider ).getText( e2 ).equals( "Contribute Samples" ) ) //$NON-NLS-1$
		{
			return -1;
		}
	}
	return 0;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:21,代码来源:SampleReportsSorter.java

示例8: getLabel

import org.eclipse.jface.viewers.IBaseLabelProvider; //导入依赖的package包/类
private String getLabel(Viewer viewer, Object e1) {
	String name1;
	if (viewer == null || !(viewer instanceof ContentViewer)) {
		name1 = e1.toString();
	} else {
		IBaseLabelProvider prov = ((ContentViewer) viewer).getLabelProvider();
		if (prov instanceof ILabelProvider) {
			ILabelProvider lprov = (ILabelProvider) prov;
			name1 = lprov.getText(e1);
		} else {
			name1 = e1.toString();
		}
	}
	if (name1 == null) {
		name1 = ""; //$NON-NLS-1$
	}
	return name1;
}
 
开发者ID:sopeco,项目名称:DynamicSpotter,代码行数:19,代码来源:FixedOrderViewerComparator.java

示例9: compareColumn

import org.eclipse.jface.viewers.IBaseLabelProvider; //导入依赖的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

示例10: getLabel

import org.eclipse.jface.viewers.IBaseLabelProvider; //导入依赖的package包/类
private String getLabel(Viewer viewer, Object e1) {
	if (viewer == null || !(viewer instanceof ContentViewer))
		return e1.toString();
	IBaseLabelProvider prov = ((ContentViewer) viewer).getLabelProvider();
	if (prov instanceof ILabelProvider) {
		ILabelProvider lprov = (ILabelProvider) prov;
		String label = lprov.getText(e1);
		if (label == null)
			return "";
		String changed = RepositoryLabel.CHANGED_STATE;
		if (label.startsWith(changed))
			return label.substring(changed.length());
		return label;
	}
	return e1.toString();
}
 
开发者ID:GreenDelta,项目名称:olca-app,代码行数:17,代码来源:NavigationSorter.java

示例11: createViewer

import org.eclipse.jface.viewers.IBaseLabelProvider; //导入依赖的package包/类
public static TreeViewer createViewer(Composite parent, String[] headers, IBaseLabelProvider label) {
	TreeViewer viewer = new TreeViewer(parent, SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL | SWT.MULTI);
	Tree tree = viewer.getTree();
	boolean hasColumns = headers != null && headers.length > 0;
	tree.setLinesVisible(hasColumns);
	tree.setHeaderVisible(hasColumns);
	if (hasColumns) {
		createColumns(viewer, headers, label);
	}
	if (label != null) {
		viewer.setLabelProvider(label);
	}
	GridData data = UI.gridData(tree, true, true);
	data.minimumHeight = 150;
	return viewer;
}
 
开发者ID:GreenDelta,项目名称:olca-app,代码行数:17,代码来源:Trees.java

示例12: createViewer

import org.eclipse.jface.viewers.IBaseLabelProvider; //导入依赖的package包/类
/**
 * Creates a default table viewer with the given properties. The properties
 * are also used to create columns where each column label is the respective
 * property of this column. The viewer is configured in the following way:
 * <ul>
 * <li>content provider = {@link ArrayContentProvider}
 * <li>lines and header are visible
 * <li>grid data with horizontal and vertical fill
 * 
 */
public static TableViewer createViewer(Composite parent, String[] properties, IBaseLabelProvider labelProvider) {
	TableViewer viewer = new TableViewer(parent, SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL | SWT.MULTI);
	viewer.setContentProvider(new ArrayContentProvider());
	boolean hasColumns = properties != null && properties.length > 0;
	Table table = viewer.getTable();
	table.setLinesVisible(hasColumns);
	table.setHeaderVisible(hasColumns);
	if (hasColumns) {
		createColumns(viewer, properties, labelProvider);
	}
	if (labelProvider != null) {
		viewer.setLabelProvider(labelProvider);
	}
	GridData data = UI.gridData(table, true, true);
	data.minimumHeight = 120;
	return viewer;
}
 
开发者ID:GreenDelta,项目名称:olca-app,代码行数:28,代码来源:Tables.java

示例13: getLabelProvider

import org.eclipse.jface.viewers.IBaseLabelProvider; //导入依赖的package包/类
protected IBaseLabelProvider getLabelProvider() {
	return new LabelProvider() {
		@Override
		public String getText(Object element) {
			return ((IEditCommand) element).getLabel();
		} 
	};
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:9,代码来源:SchemaHistoryView.java

示例14: compare

import org.eclipse.jface.viewers.IBaseLabelProvider; //导入依赖的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

示例15: refreshTFSLabelDecorator

import org.eclipse.jface.viewers.IBaseLabelProvider; //导入依赖的package包/类
/**
 * Refreshes labels for the entire workspace on the workbench's active
 * {@link TFSLabelDecorator} (if there is one).
 *
 * @throws CoreException
 *         if there was an error collecting folder contents from a given
 *         resource
 */
public static void refreshTFSLabelDecorator() {
    final IBaseLabelProvider decorator =
        PlatformUI.getWorkbench().getDecoratorManager().getBaseLabelProvider(TFSLabelDecorator.DECORATOR_ID);

    // It's possible the decorator is not yet available
    if (decorator == null || decorator instanceof TFSLabelDecorator == false) {
        log.debug("Couldn't find TFSLabelDecorator for refresh"); //$NON-NLS-1$
        return;
    }

    ((TFSLabelDecorator) decorator).refresh();
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:21,代码来源:TFSLabelDecorator.java


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