| /** |
| * |
| * 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.* |
| 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 |
| */ |
| class FunctionLibraryDslLabelProvider extends BasicDSLLabelProvider { |
| |
| @Inject |
| new(AdapterFactoryLabelProvider delegate) { |
| super(delegate); |
| } |
| |
| /* ********************************************************************************************** */ |
| /** Provides outline text for FunctionLibrary-DSL. |
| * |
| * Uses common (default) text for package and for import element. |
| * |
| * @see BasicDSLLabelProvider.text(Object) |
| * |
| * @param o Current outline element |
| * |
| * @return String instance. |
| * |
| * @since @D 151007, gu |
| * @date @D yymmdd, name |
| */ /* ******************************************************************************************* */ |
| override text ( Object o ) { |
| switch (o) { |
| FunctionLibraryConverterGroup : generateText( o, 'converter group', o.name ) |
| FunctionLibraryGroup : generateText( o, 'group' , o.name ) |
| FunctionLibraryRating : generateText( o, 'rating' , o.name ) |
| FunctionLibraryFunction : generateText( o, 'function' , o.name ) |
| FunctionLibraryTest : generateText( o, 'test' , o.name ) |
| FunctionLibraryRate : generateText( o, 'rate' , o.name ) |
| FunctionLibraryParameter : generateText( o, 'params' , o.name ) |
| FunctionLibraryRatingItem : generateText( o, 'rating item' , o.name ) |
| JvmParameterizedTypeReference : generateText( o, 'type reference' , (o as JvmParameterizedTypeReference ).simpleName ) |
| XExpression : generateText( o, 'expression' ) |
| FunctionConvertToModel : 'model converter' |
| FunctionConvertToPresentation : 'presentation converter' |
| // FunctionLibraryRatingItem : '' |
| default : super.text( o ) |
| } |
| } |
| |
| |
| /* ********************************************************************************************** */ |
| /** Provides outline images for FunctionLibrary-DSL. |
| * |
| * Uses common (default) image for package and for import element. |
| * |
| * @see BasicDSLLabelProvider.image(Object) |
| * |
| * @param o Current outline element |
| * |
| * @return Image instance if requested image file was found, return value of overridden superclass |
| * method otherwise. |
| * |
| * @since @D 151007, gu |
| * @date @D yymmdd, name |
| */ /* ******************************************************************************************* */ |
| override image ( Object o ) { |
| switch (o) { |
| FunctionLibraryModel : getInternalImage( 'model.png' , class ) |
| FunctionLibraryGroup : getInternalImage( 'group.png' , class ) |
| // FunctionLibraryGroup : getInternalImage( 'dsl_functionlibrary.png', class ) |
| FunctionLibraryFunction : getInternalImage( 'function2.png' , class ) |
| FunctionLibraryTest : getInternalImage( 'testrun3.png' , class ) |
| FunctionLibraryRate : getInternalImage( 'enum-object.png', class ) |
| FunctionLibraryParameter : getInternalImage( 'params.png' , class ) |
| XExpression : getInternalImage( 'expression.png' , class ) |
| JvmParameterizedTypeReference : getInternalImage( 'reference.png' , class ) |
| FunctionConvertToModel : getInternalImage( 'converter.png' , class ) |
| FunctionConvertToPresentation : getInternalImage( 'converter.png' , class ) |
| default : super.image( o ) |
| } |
| } |
| } |