| /** |
| * |
| * 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 |
| */ |
| class MenuDslLabelProvider extends BasicDSLLabelProvider { |
| |
| @Inject |
| new(AdapterFactoryLabelProvider delegate) { |
| super(delegate); |
| } |
| |
| /* ********************************************************************************************** */ |
| /** Provides outline text for Menu-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) { |
| MenuEntry : generateText( o, 'entry' , (o as MenuEntry ).entryid ) |
| default : super.text( o ) |
| } |
| } |
| |
| /* ********************************************************************************************** */ |
| /** Provides outline images for Menu-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) { |
| MenuModel : getInternalImage( 'model.png', class) |
| MenuEntry : getInternalImage( 'dsl_menu.png', class) |
| default : super.image( o ) |
| } |
| } |
| } |