| /** |
| * |
| * 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 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| * |
| * |
| * This copyright notice shows up in the generated Java code |
| * |
| */ |
| |
| package org.eclipse.osbp.xtext.chart.ui.labeling |
| |
| import com.google.inject.Inject |
| import org.eclipse.osbp.xtext.basic.ui.labeling.BasicDSLLabelProvider |
| import org.eclipse.osbp.xtext.chart.Chart |
| import org.eclipse.osbp.xtext.chart.ChartModel |
| import org.eclipse.osbp.xtext.chart.ChartBar |
| import org.eclipse.osbp.xtext.chart.ChartLine |
| import org.eclipse.osbp.xtext.chart.ChartPie |
| import org.eclipse.osbp.xtext.chart.ChartDonut |
| import org.eclipse.osbp.xtext.chart.ChartBubble |
| import org.eclipse.osbp.xtext.chart.ChartGauge |
| import org.eclipse.osbp.xtext.chart.ChartTree |
| import org.eclipse.osbp.xtext.chart.ChartInterval |
| import org.eclipse.osbp.xtext.chart.ChartRangeElement |
| import org.eclipse.osbp.xtext.chart.ChartSegmentColor |
| import org.eclipse.osbp.xtext.chart.ChartDatamart |
| import org.eclipse.osbp.xtext.chart.ChartAxis |
| import org.eclipse.osbp.xtext.chart.ChartLegend |
| import org.eclipse.osbp.xtext.chart.ChartHighlighter |
| import org.eclipse.osbp.xtext.chart.ChartOption |
| |
| /** |
| * Provides labels for a EObjects. |
| * |
| * see http://www.eclipse.org/Xtext/documentation.html#labelProvider |
| */ |
| class ChartDSLLabelProvider extends BasicDSLLabelProvider { |
| |
| @Inject |
| new(org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider delegate) { |
| super(delegate); |
| } |
| |
| /* ********************************************************************************************** */ |
| /** Provides outline text for Chart-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 150929, gu |
| * @date @D yymmdd, name |
| */ /* ******************************************************************************************* */ |
| override text ( Object o ) { |
| switch (o) { |
| Chart : generateText( o, 'chart' , (o as Chart).name ) |
| ChartBar : generateText( o, 'option bar' ) |
| ChartLine : generateText( o, 'option line' ) |
| ChartPie : generateText( o, 'option pie' ) |
| ChartDonut : generateText( o, 'option donut' ) |
| ChartBubble : generateText( o, 'option bubble') |
| ChartGauge : generateText( o, 'option gauge' ) |
| ChartTree : generateText( o, 'option tree' ) |
| ChartInterval : generateText( o, 'interval' ) |
| ChartSegmentColor : generateText( o, 'segment color', String.format( "RGB(%s)", (o as ChartSegmentColor).rgb ) ) |
| ChartRangeElement : generateText( o, 'range element') |
| ChartDatamart : generateText( o, 'datamart' , (o as ChartDatamart).datamartRef.name ) |
| ChartAxis : generateText( o, 'axis' ) |
| ChartLegend : generateText( o, 'legend' ) |
| ChartHighlighter : generateText( o, 'tooltip' ) |
| default : super.text( o ) |
| } |
| } |
| |
| /* ********************************************************************************************** */ |
| /** Provides outline images for Chart-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 150929, gu |
| * @date @D yymmdd, name |
| */ /* ******************************************************************************************* */ |
| override image ( Object o ) { |
| switch (o) { |
| ChartModel : getInternalImage( 'model.png', super.class) |
| Chart : getInternalImage( 'dsl_chart.png', class) |
| ChartSegmentColor : getColorOutlineImage( (o as ChartSegmentColor).rgb, true ) |
| ChartOption : getInternalImage( 'dsl_option.png', class) |
| ChartInterval : getInternalImage( 'chart_interval.png', class) |
| ChartRangeElement : getInternalImage( 'dsl_range.png', class) |
| ChartDatamart : getInternalImage( 'dsl_datamart.png', class) |
| ChartAxis : getInternalImage( 'chart_axis.png', class) |
| ChartLegend : getInternalImage( 'chart_legend.png', class) |
| ChartHighlighter : getInternalImage( 'chart_tooltip.png', class) |
| default : super.image( o ) |
| } |
| } |
| |
| } |