/*
 * generated by Xtext 2.12.0
 */
package org.etsi.mts.tdl.ui.labeling;

import com.google.inject.Inject;

import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider;
import org.etsi.mts.tdl.Element;
import org.etsi.mts.tdl.Extension;

/**
 * Provides labels for EObjects.
 * 
 * See
 * https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#label-provider
 */
public class TDLan2LabelProvider extends DefaultEObjectLabelProvider {

	@Inject
	public TDLan2LabelProvider(AdapterFactoryLabelProvider delegate) {
		super(delegate);
	}

	String text(Element element) {
		if (element.getName() != null) {
			return element.eClass().getName()+" : "+element.getName();
		} else if (element instanceof Extension) {
			return element.eClass().getName()+" : "+((Extension) element).getExtending().getName();
		}
		return element.eClass().getName();
	}

	// Labels and icons can be computed like this:

	// String text(Greeting ele) {
	// return "A greeting to " + ele.getName();
	// }
	//
	// String image(Greeting ele) {
	// return "Greeting.gif";
	// }
}
