| /** |
| * 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.functionlibrarydsl.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.functionlibrarydsl.FunctionConvertToModel; |
| import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionConvertToPresentation; |
| import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryConverterGroup; |
| import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryFunction; |
| import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryGroup; |
| import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryModel; |
| import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryParameter; |
| import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryRate; |
| import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryRating; |
| import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryRatingItem; |
| import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryTest; |
| import org.eclipse.xtext.common.types.JvmParameterizedTypeReference; |
| import org.eclipse.xtext.xbase.XExpression; |
| |
| /** |
| * Provides labels for a EObjects. |
| * |
| * see http://www.eclipse.org/Xtext/documentation.html#labelProvider |
| */ |
| @SuppressWarnings("all") |
| public class FunctionLibraryDslLabelProvider extends BasicDSLLabelProvider { |
| @Inject |
| public FunctionLibraryDslLabelProvider(final AdapterFactoryLabelProvider delegate) { |
| super(delegate); |
| } |
| |
| public Object text(final Object o) { |
| Object _switchResult = null; |
| boolean _matched = false; |
| if (!_matched) { |
| if (o instanceof FunctionLibraryConverterGroup) { |
| _matched=true; |
| String _name = ((FunctionLibraryConverterGroup)o).getName(); |
| _switchResult = this.generateText(o, "converter group", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof FunctionLibraryGroup) { |
| _matched=true; |
| String _name = ((FunctionLibraryGroup)o).getName(); |
| _switchResult = this.generateText(o, "group", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof FunctionLibraryRating) { |
| _matched=true; |
| String _name = ((FunctionLibraryRating)o).getName(); |
| _switchResult = this.generateText(o, "rating", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof FunctionLibraryFunction) { |
| _matched=true; |
| String _name = ((FunctionLibraryFunction)o).getName(); |
| _switchResult = this.generateText(o, "function", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof FunctionLibraryTest) { |
| _matched=true; |
| String _name = ((FunctionLibraryTest)o).getName(); |
| _switchResult = this.generateText(o, "test", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof FunctionLibraryRate) { |
| _matched=true; |
| String _name = ((FunctionLibraryRate)o).getName(); |
| _switchResult = this.generateText(o, "rate", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof FunctionLibraryParameter) { |
| _matched=true; |
| String _name = ((FunctionLibraryParameter)o).getName(); |
| _switchResult = this.generateText(o, "params", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof FunctionLibraryRatingItem) { |
| _matched=true; |
| String _name = ((FunctionLibraryRatingItem)o).getName(); |
| _switchResult = this.generateText(o, "rating item", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof JvmParameterizedTypeReference) { |
| _matched=true; |
| String _simpleName = ((JvmParameterizedTypeReference) o).getSimpleName(); |
| _switchResult = this.generateText(o, "type reference", _simpleName); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof XExpression) { |
| _matched=true; |
| _switchResult = this.generateText(o, "expression"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof FunctionConvertToModel) { |
| _matched=true; |
| _switchResult = "model converter"; |
| } |
| } |
| if (!_matched) { |
| if (o instanceof FunctionConvertToPresentation) { |
| _matched=true; |
| _switchResult = "presentation converter"; |
| } |
| } |
| 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 FunctionLibraryModel) { |
| _matched=true; |
| Class<? extends FunctionLibraryDslLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("model.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof FunctionLibraryGroup) { |
| _matched=true; |
| Class<? extends FunctionLibraryDslLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("group.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof FunctionLibraryFunction) { |
| _matched=true; |
| Class<? extends FunctionLibraryDslLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("function2.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof FunctionLibraryTest) { |
| _matched=true; |
| Class<? extends FunctionLibraryDslLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("testrun3.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof FunctionLibraryRate) { |
| _matched=true; |
| Class<? extends FunctionLibraryDslLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("enum-object.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof FunctionLibraryParameter) { |
| _matched=true; |
| Class<? extends FunctionLibraryDslLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("params.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof XExpression) { |
| _matched=true; |
| Class<? extends FunctionLibraryDslLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("expression.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof JvmParameterizedTypeReference) { |
| _matched=true; |
| Class<? extends FunctionLibraryDslLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("reference.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof FunctionConvertToModel) { |
| _matched=true; |
| Class<? extends FunctionLibraryDslLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("converter.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof FunctionConvertToPresentation) { |
| _matched=true; |
| Class<? extends FunctionLibraryDslLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("converter.png", _class); |
| } |
| } |
| if (!_matched) { |
| _switchResult = super.image(o); |
| } |
| return _switchResult; |
| } |
| } |