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