org.eclipse.jdt.internal.ui.viewsupport.ColoringLabelProvider Java Examples

The following examples show how to use org.eclipse.jdt.internal.ui.viewsupport.ColoringLabelProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NLSSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void configureTableViewer(TableViewer viewer) {
	viewer.setComparator(new ViewerComparator() {
		@Override
		public int category(Object element) {
			if (element instanceof FileEntry) {
				return 0;
			} else {
				return 1;
			}
		}
	});
	viewer.setLabelProvider(new ColoringLabelProvider(new NLSSearchResultLabelProvider2(this)));
	fContentProvider= new TextSearchTableContentProvider();
	viewer.setContentProvider(fContentProvider);
}
 
Example #2
Source File: CallHierarchyLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public StyledString getStyledText(Object element) {
	if (isNormalMethodWrapper(element)) {
		MethodWrapper wrapper= (MethodWrapper)element;
		String decorated= getElementLabel(wrapper);
		
		StyledString styledLabel= super.getStyledText(wrapper.getMember());
		StyledString styledDecorated= StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.COUNTER_STYLER, styledLabel);
		if (isSpecialConstructorNode(wrapper)) {
			decorated= Messages.format(CallHierarchyMessages.CallHierarchyLabelProvider_constructor_label, decorated);
			styledDecorated= StyledCellLabelProvider.styleDecoratedString(decorated, ColoringLabelProvider.INHERITED_STYLER, styledDecorated);
		}
		return styledDecorated;
	}
	
	String specialLabel= getSpecialLabel(element);
	Styler styler= element instanceof RealCallers ? ColoringLabelProvider.INHERITED_STYLER : null;
	return new StyledString(specialLabel, styler);
}
 
Example #3
Source File: CallHierarchyViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @param parent the parent composite
 * @param part the call hierarchy view part
 */
CallHierarchyViewer(Composite parent, CallHierarchyViewPart part) {
    super(new Tree(parent, SWT.MULTI));

    fPart = part;

    getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
    setUseHashlookup(true);
    setAutoExpandLevel(2);
    fContentProvider = new CallHierarchyContentProvider(fPart);
    setContentProvider(fContentProvider);
    setLabelProvider(new ColoringLabelProvider(new CallHierarchyLabelProvider()));


    clearViewer();
}
 
Example #4
Source File: OccurrencesSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void configureTableViewer(TableViewer viewer) {
	viewer.setComparator(new ViewerComparator() {
		@Override
		public int compare(Viewer v, Object e1, Object e2) {
			JavaElementLine jel1= (JavaElementLine) e1;
			JavaElementLine jel2= (JavaElementLine) e2;
			return jel1.getLineNumber() - jel2.getLineNumber();
		}
	});
	viewer.setLabelProvider(new ColoringLabelProvider(new OccurrencesSearchLabelProvider(this)));
	fContentProvider= new TextSearchTableContentProvider();
	viewer.setContentProvider(fContentProvider);
}
 
Example #5
Source File: JavaOutlineInformationControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected TreeViewer createTreeViewer(Composite parent, int style) {
	Tree tree= new Tree(parent, SWT.SINGLE | (style & ~SWT.MULTI));
	GridData gd= new GridData(GridData.FILL_BOTH);
	gd.heightHint= tree.getItemHeight() * 12;
	tree.setLayoutData(gd);

	final TreeViewer treeViewer= new OutlineTreeViewer(tree);

	// Hard-coded filters
	treeViewer.addFilter(new NamePatternFilter());
	treeViewer.addFilter(new MemberFilter());

	fInnerLabelProvider= new OutlineLabelProvider();
	fInnerLabelProvider.addLabelDecorator(new ProblemsLabelDecorator(null));
	IDecoratorManager decoratorMgr= PlatformUI.getWorkbench().getDecoratorManager();
	if (decoratorMgr.getEnabled("org.eclipse.jdt.ui.override.decorator")) //$NON-NLS-1$
		fInnerLabelProvider.addLabelDecorator(new OverrideIndicatorLabelDecorator(null));

	treeViewer.setLabelProvider(new ColoringLabelProvider(fInnerLabelProvider));

	fLexicalSortingAction= new LexicalSortingAction(treeViewer);
	fSortByDefiningTypeAction= new SortByDefiningTypeAction(treeViewer);
	fShowOnlyMainTypeAction= new ShowOnlyMainTypeAction(treeViewer);
	fCategoryFilterActionGroup= new CategoryFilterActionGroup(treeViewer, getId(), getInputForCategories());

	fOutlineContentProvider= new OutlineContentProvider(false);
	treeViewer.setContentProvider(fOutlineContentProvider);
	fOutlineSorter= new OutlineSorter();
	treeViewer.setComparator(fOutlineSorter);
	treeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);


	treeViewer.getTree().addKeyListener(getKeyAdapter());

	return treeViewer;
}
 
Example #6
Source File: SARLOutlineTreeProvider.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Compute the text for the given JVM constructor, which is usually a inherited constructor.
 *
 * @param modelElement the model
 * @return the text.
 */
protected CharSequence _text(JvmConstructor modelElement) {
	if (this.labelProvider instanceof IStyledLabelProvider) {
		final StyledString str = ((IStyledLabelProvider) this.labelProvider).getStyledText(modelElement);
		str.setStyle(0, str.length(), ColoringLabelProvider.INHERITED_STYLER);
		return str;
	}
	return this.labelProvider.getText(modelElement);
}