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


Java ILabelProvider类代码示例

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


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

示例1: DecoratingColumLabelProvider

import org.eclipse.jface.viewers.ILabelProvider; //导入依赖的package包/类
/**
 * Constructor.
 * 
 * @param labelProvider
 *            the {@link ILabelProvider} to decorate
 * @param labelDecorator
 *            the {@link ILabelDecorator} adding decoration
 */
public DecoratingColumLabelProvider(ILabelProvider labelProvider, ILabelDecorator labelDecorator) {
	this.labelProvider = labelProvider;
	if (labelProvider instanceof IFontProvider) {
		this.fontProvider = (IFontProvider)labelProvider;
	} else {
		this.fontProvider = null;
	}
	if (labelProvider instanceof IColorProvider) {
		this.colorProvider = (IColorProvider)labelProvider;
	} else {
		this.colorProvider = null;
	}

	this.labelDecorator = labelDecorator;
	if (labelDecorator instanceof CellLabelProvider) {
		this.cellLabelProvider = (CellLabelProvider)labelDecorator;
	} else {
		this.cellLabelProvider = null;
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:29,代码来源:DecoratingColumLabelProvider.java

示例2: SelectAnyEObjectDialog

import org.eclipse.jface.viewers.ILabelProvider; //导入依赖的package包/类
public SelectAnyEObjectDialog(Shell parent, ResourceSet resourceSet, ILabelProvider renderer) {
	super(parent, renderer);
	_searchedResourceSet = resourceSet;
	ArrayList<EObject> all = new ArrayList<EObject>();
	EcoreUtil.resolveAll(resourceSet);
	for (Resource r : _searchedResourceSet.getResources())
	{
		for (TreeIterator<EObject> iterator = r.getAllContents(); iterator.hasNext();) {
			EObject o =  iterator.next();
			if(select(o)) all.add(o);
		}
	}
	
	Object[] elements = all.toArray();
	this.setElements(elements);
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:17,代码来源:SelectAnyEObjectDialog.java

示例3: chooseGW4EProject

import org.eclipse.jface.viewers.ILabelProvider; //导入依赖的package包/类
public static IJavaProject chooseGW4EProject(IJavaProject javaProject) {
	Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
	IJavaProject[] projects = getGW4EProjects();
	ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
	ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, labelProvider);
	dialog.setTitle(MessageUtil.getString("projectdialog_title"));
	dialog.setMessage(MessageUtil.getString("projectdialog_message"));
	dialog.setElements(projects);

	if (javaProject != null) {
		dialog.setInitialSelections(new Object[] { javaProject });
	}
	if (dialog.open() == Window.OK) {
		return (IJavaProject) dialog.getFirstResult();
	}
	return null;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:18,代码来源:GraphWalkerContextManager.java

示例4: getDetailLabelProvider

import org.eclipse.jface.viewers.ILabelProvider; //导入依赖的package包/类
/**
 * Creates a label provider for the detail section below the list<br>
 * The label provider prints out the name of operation definition and the module the operation is defined in 
 */
private ILabelProvider getDetailLabelProvider()
{
    return new LabelProvider() {
        public String getText(Object element)
        {
            if (element instanceof OpDefNode)
            {
                OpDefNode node = (OpDefNode) element;

                return node.getSource().getName().toString()
                        + ((node.getSource().getOriginallyDefinedInModuleNode() != null) ? " : "
                                + node.getSource().getOriginallyDefinedInModuleNode().getName().toString() : "");
            }
            return super.getText(element);
        }
    };
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:22,代码来源:FilteredDefinitionSelectionDialog.java

示例5: getListLabelProvider

import org.eclipse.jface.viewers.ILabelProvider; //导入依赖的package包/类
/**
 * Creates label provider for the elements in the list
 */
private ILabelProvider getListLabelProvider()
{
    return new LabelProvider() {
        public String getText(Object element)
        {
            if (element instanceof OpDefNode)
            {
                OpDefNode node = (OpDefNode) element;
                if (node.getSource() == node)
                {
                    return node.getName().toString();
                } else
                {
                    return node.getSource().getName().toString() + " ["
                            + node.getSource().getOriginallyDefinedInModuleNode().getName().toString() + "]";
                }
            }
            return super.getText(element);
        }
    };
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:25,代码来源:FilteredDefinitionSelectionDialog.java

示例6: select

import org.eclipse.jface.viewers.ILabelProvider; //导入依赖的package包/类
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
	// Element passes the filter if the string matcher is undefined or
	// the
	// viewer is not a tree viewer
	if ((stringMatcher == null) || !(viewer instanceof TreeViewer)) {
		return true;
	}
	TreeViewer aTreeViewer = (TreeViewer) viewer;
	// Match the pattern against the label of the given element
	String matchName = ((ILabelProvider) aTreeViewer.getLabelProvider()).getText(element);
	// Element passes the filter if it matches the pattern
	if ((matchName != null) && stringMatcher.match(matchName)) {
		return true;
	}
	// Determine whether the element has children that pass the filter
	return hasUnfilteredChild(aTreeViewer, element);
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:19,代码来源:AbstractInformationControl.java

示例7: XtextEObjectSearchDialog

import org.eclipse.jface.viewers.ILabelProvider; //导入依赖的package包/类
public XtextEObjectSearchDialog(Shell parent, IXtextEObjectSearch searchEngine, ILabelProvider labelProvider) {
	super(parent);
	this.searchEngine = searchEngine;
	this.labelProvider = labelProvider;
	setTitle(Messages.XtextEObjectSearchDialog_TableLabelDialogTitle);
	setMessage(Messages.XtextEObjectSearchDialog_TableLabelSearchControlLabel);
	setAddCancelButton(true);
	// super class needs an IStructuredContentProvider so we register this dummy and 
	// register the lazy one later
	setContentProvider(new IStructuredContentProvider() {
		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
		}

		public void dispose() {
		}

		public Object[] getElements(Object inputElement) {
			return null;
		}
	});
	setLabelProvider(labelProvider);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:23,代码来源:XtextEObjectSearchDialog.java

示例8: ProjectSelectionDialog

import org.eclipse.jface.viewers.ILabelProvider; //导入依赖的package包/类
public ProjectSelectionDialog(Shell parentShell, Object input,
		IStructuredContentProvider contentProvider,
		ILabelProvider labelProvider, String message, String unifiedDiff) {
	super(parentShell);
	this.unifiedDiff = unifiedDiff;
	featureController.getFeatures(VariantSyncPlugin.getDefault()
			.getSupportProjectList());
	setTitle(WorkbenchMessages.ListSelection_title);
	inputElement = input;
	projectSelectionDiaglog = this;
	this.projectContentProvider = contentProvider;
	this.featureContentProvider = new FeatureListViewerContentProvider();
	this.projectLabelProvider = labelProvider;
	this.featureLabelProvider = new LabelProvider();
	if (message != null) {
		setMessage(message);
	} else {
		setMessage(WorkbenchMessages.ListSelection_message);
	}
}
 
开发者ID:1Tristan,项目名称:VariantSync,代码行数:21,代码来源:ProjectSelectionDialog.java

示例9: getImage

import org.eclipse.jface.viewers.ILabelProvider; //导入依赖的package包/类
public Image getImage(Object element)
{
	List<ILabelProvider> providers = this.getProcessors();
	Image result = null;

	for (ILabelProvider provider : providers)
	{
		result = provider.getImage(element);

		if (result != null)
		{
			break;
		}
	}

	return result;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:18,代码来源:IndexViewLabelProvider.java

示例10: setUpBrowseProjectDialog

import org.eclipse.jface.viewers.ILabelProvider; //导入依赖的package包/类
private void setUpBrowseProjectDialog() {
  ILabelProvider projectLabelProvider = new BrowseProjectLabelProvider();

  IJavaProject[] javaProjects = javaProjectHelper.getJavaProjects();

  ElementListSelectionDialog dialog =
      new ElementListSelectionDialog(getControl().getShell(), projectLabelProvider);
  dialog.setMessage("Choose a project to run testability on:");

  if (javaProjects != null) {
    dialog.setElements(javaProjects);
  }

  if (dialog.open() == Window.OK) {
    IJavaProject project = (IJavaProject) dialog.getFirstResult();
    projectText.setText(project.getElementName());
    setTabDirty();
  }
}
 
开发者ID:mhevery,项目名称:testability-explorer,代码行数:20,代码来源:TestabilityLaunchConfigurationTab.java

示例11: compare

import org.eclipse.jface.viewers.ILabelProvider; //导入依赖的package包/类
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
    ILabelProvider lprov = (ILabelProvider) ((ContentViewer) viewer).getLabelProvider();
    String name1 = lprov.getText(e1);
    String name2 = lprov.getText(e2);
    if (name1 == null) {
        name1 = "";
    }
    if (name2 == null) {
        name2 = "";
    }
    if (name1.length() > 0 && name2.length() > 0) {
        char char1 = name1.charAt(name1.length() - 1);
        char char2 = name2.charAt(name2.length() - 1);
        if (char1 == '*' && char1 != char2) {
            return -1;
        }
        if (char2 == '*' && char2 != char1) {
            return 1;
        }
    }
    return name1.compareTo(name2);
}
 
开发者ID:iloveeclipse,项目名称:datahierarchy,代码行数:24,代码来源:FilterListEditor.java

示例12: TreeListDialogField

import org.eclipse.jface.viewers.ILabelProvider; //导入依赖的package包/类
/**
 * @param adapter Can be <code>null</code>.
 */
public TreeListDialogField(ITreeListAdapter adapter, String[] buttonLabels,
        ILabelProvider lprovider) {
    super();
    fTreeAdapter = adapter;

    fLabelProvider = lprovider;
    fTreeViewerAdapter = new TreeViewerAdapter();

    fElements = new ArrayList(10);

    fButtonLabels = buttonLabels;
    if (fButtonLabels != null) {
        int nButtons = fButtonLabels.length;
        fButtonsEnabled = new boolean[nButtons];
        for (int i = 0; i < nButtons; i++) {
            fButtonsEnabled[i] = true;
        }
    }

    fRemoveButtonIndex = -1;
    fUpButtonIndex = -1;
    fDownButtonIndex = -1;
}
 
开发者ID:iloveeclipse,项目名称:filesync4eclipse,代码行数:27,代码来源:TreeListDialogField.java

示例13: select

import org.eclipse.jface.viewers.ILabelProvider; //导入依赖的package包/类
public boolean select(Viewer viewer, Object parentElement,
        Object element) {

    if (pattern == null || !(viewer instanceof TableViewer)) {
        return true;
    }
    TableViewer tableViewer = (TableViewer) viewer;

    String matchName = ((ILabelProvider) tableViewer.getLabelProvider())
            .getText(element);

    if(matchName == null) {
        return false;
    }
    // A dirty editor's label will start with dirty prefix, this prefix
    // should not be taken in consideration when matching with a pattern
    String prefix = PartTab.DIRTY_PREFIX;
    if (matchName.startsWith(prefix)) {
        matchName = matchName.substring(prefix.length());
    }
    return matchName != null && matches(pattern, matchName);
}
 
开发者ID:iloveeclipse,项目名称:skin4eclipse,代码行数:23,代码来源:NamePatternFilter.java

示例14: createDialogArea

import org.eclipse.jface.viewers.ILabelProvider; //导入依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
	CustomElementSelectionForm form = new CustomElementSelectionForm(parent, SWT.FILL);
	form.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

	TreeViewer v = form.getTreeViewer();
	for (ViewerFilter filter : filters) {
		v.addFilter(filter);
	}
	this.treeViewer = v;

	WorkbenchContentProvider contentProvider = new WorkbenchContentProvider();
	ILabelProvider labelProvider = new WorkbenchLabelProvider();

	this.treeViewer.setContentProvider(contentProvider);
	this.treeViewer.setLabelProvider(labelProvider);

	this.treeViewer.setComparator(new ViewerComparator());

	this.treeViewer.setAutoExpandLevel(this.getAutoExpandLevel());

	form.setElementLabel(this.elementLabel);

	this.elementNameInput = form.getElementInput();

	form.getElementInput().addPropertyChangeListener(new PropertyChangeListener() {

		@Override
		public void propertyChange(PropertyChangeEvent evt) {
			if (evt.getPropertyName().equals(SuffixText.TEXT_PROPERTY) ||
					evt.getPropertyName().equals(SuffixText.SUFFIX_PROPERTY)) {
				validateElementInput();
				elementInputChanged();
			}

		}
	});
	return form;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:40,代码来源:CustomElementSelectionDialog.java

示例15: SelectMainMethodDialog

import org.eclipse.jface.viewers.ILabelProvider; //导入依赖的package包/类
/**
 * Create a selection dialog displaying all available methods with @main
 * from elements in 'aspects' weaving 'modelElem'.
 * If 'modelElem' is null, selection dialog displays all @main.
 */
public SelectMainMethodDialog(Set<Class<?>> aspects, EObject modelElem, ILabelProvider renderer) {
	super(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), renderer);
	_aspects = aspects;
	
	if(aspects != null)
		update(modelElem);
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:13,代码来源:SelectMainMethodDialog.java


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