Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2010 itemis AG (http://www.itemis.eu) and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html /
 
 package org.eclipse.xtext.ui.label;
 
import  org.eclipse.core.resources.IProject;
import  org.eclipse.core.resources.IStorage;

Author(s):
Jan Koehnlein - Initial contribution and API
	public Object image(IEObjectDescription element) {
		return image(element.getEClass());
	}
	public Object image(IResourceDescription element) {
		return getImageForURI(element.getURI());
	}

This method is only invoked if the containerEObjectURI of the IReferenceDescription is null, i.e. the reference is owned by an element without any indexed container.

Since:
2.1
	public Object image(IReferenceDescription referenceDescription) {
		if (referenceDescription.getSourceEObjectUri() != null)
			return getImageForURI(referenceDescription.getSourceEObjectUri());
		return null;
	}

Since:
2.1
	protected Object getImageForURI(URI uri) {
		String fileName = uri.lastSegment();
	}
	public Object text(IEObjectDescription element) {
		return element.getQualifiedName() + " - " + element.getEClass().getName();
	}
	public Object text(IResourceDescription element) {
		Iterator<Pair<IStorage, IProject>> storages = .getStorages(element.getURI()).iterator();
		if (storages.hasNext()) {
			IStorage storage = storages.next().getFirst();
			return storage.getFullPath().toString();
		}
		return null;
	}

This method is only invoked if the containerEObjectURI of the IReferenceDescription is null, i.e. the reference is owned by an element without any indexed container.

Since:
2.1
	public Object text(IReferenceDescription referenceDescription) {
		return "<unnamed>";
	}
New to GrepCode? Check out our FAQ X