blob: af19106272e778e5779fc8f481ee1ad30978e274 [file] [log] [blame]
/**
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* 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
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
*
* This copyright notice shows up in the generated Java code
*/
package org.eclipse.osbp.xtext.menu.ui.labeling;
import com.google.inject.Inject;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.osbp.xtext.basic.ui.labeling.BasicDSLLabelProvider;
import org.eclipse.osbp.xtext.menu.MenuEntry;
import org.eclipse.osbp.xtext.menu.MenuModel;
/**
* Provides labels for a EObjects.
*
* see http://www.eclipse.org/Xtext/documentation.html#labelProvider
*/
@SuppressWarnings("all")
public class MenuDslLabelProvider extends BasicDSLLabelProvider {
@Inject
public MenuDslLabelProvider(final AdapterFactoryLabelProvider delegate) {
super(delegate);
}
public Object text(final Object o) {
Object _switchResult = null;
boolean _matched = false;
if (!_matched) {
if (o instanceof MenuEntry) {
_matched=true;
String _entryid = ((MenuEntry) o).getEntryid();
_switchResult = this.generateText(o, "entry", _entryid);
}
}
if (!_matched) {
_switchResult = super.text(o);
}
return _switchResult;
}
public Object image(final Object o) {
Object _switchResult = null;
boolean _matched = false;
if (!_matched) {
if (o instanceof MenuModel) {
_matched=true;
Class<? extends MenuDslLabelProvider> _class = this.getClass();
_switchResult = this.getInternalImage("model.png", _class);
}
}
if (!_matched) {
if (o instanceof MenuEntry) {
_matched=true;
Class<? extends MenuDslLabelProvider> _class = this.getClass();
_switchResult = this.getInternalImage("dsl_menu.png", _class);
}
}
if (!_matched) {
_switchResult = super.image(o);
}
return _switchResult;
}
}