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.emf.edit.ui.provider.AdapterFactoryLabelProvider;

Author(s):
Jan Koehnlein - Initial contribution and API
		super();
	}
	public DefaultEObjectLabelProvider(AdapterFactoryLabelProvider delegate) {
		super(delegate);
	}
	protected Object doGetText(Object element) {
		Object text = super.doGetText(element);
		if(text != null) {
			return text;
		}
		if(element instanceof EObject) {
			EObject eObject = (EObjectelement;
			EStructuralFeature labelFeature = getLabelFeature(eObject.eClass());
			if(labelFeature != null) {
				return eObject.eGet(labelFeature);
			}
		}
		return null;
	}
		EAttribute result = null;
		for (EAttribute eAttribute : eClass.getEAllAttributes()) {
			if (!eAttribute.isMany() && eAttribute.getEType().getInstanceClass() != FeatureMap.Entry.class) {
				if ("name".equalsIgnoreCase(eAttribute.getName())) {
					result = eAttribute;
					break;
else if (result == null) {
					result = eAttribute;
else if (eAttribute.getEAttributeType().getInstanceClass() == String.class
						&& result.getEAttributeType().getInstanceClass() != String.class) {
					result = eAttribute;
				}
			}
		}
		return result;
	}
New to GrepCode? Check out our FAQ X