blob: 543173a79b1e72a6f1054f8f0037d98cb25e5473 [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 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.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.osbp.xtext.basic.ui.labeling.BasicDSLLabelProvider;
import org.eclipse.osbp.xtext.chart.Chart;
import org.eclipse.osbp.xtext.chart.ChartAxis;
import org.eclipse.osbp.xtext.chart.ChartBar;
import org.eclipse.osbp.xtext.chart.ChartBubble;
import org.eclipse.osbp.xtext.chart.ChartDatamart;
import org.eclipse.osbp.xtext.chart.ChartDonut;
import org.eclipse.osbp.xtext.chart.ChartGauge;
import org.eclipse.osbp.xtext.chart.ChartHighlighter;
import org.eclipse.osbp.xtext.chart.ChartInterval;
import org.eclipse.osbp.xtext.chart.ChartLegend;
import org.eclipse.osbp.xtext.chart.ChartLine;
import org.eclipse.osbp.xtext.chart.ChartModel;
import org.eclipse.osbp.xtext.chart.ChartOption;
import org.eclipse.osbp.xtext.chart.ChartPie;
import org.eclipse.osbp.xtext.chart.ChartRangeElement;
import org.eclipse.osbp.xtext.chart.ChartSegmentColor;
import org.eclipse.osbp.xtext.chart.ChartTree;
/**
* Provides labels for a EObjects.
*
* see http://www.eclipse.org/Xtext/documentation.html#labelProvider
*/
@SuppressWarnings("all")
public class ChartDSLLabelProvider extends BasicDSLLabelProvider {
@Inject
public ChartDSLLabelProvider(final AdapterFactoryLabelProvider delegate) {
super(delegate);
}
@Override
public Object text(final Object o) {
Object _switchResult = null;
boolean _matched = false;
if (o instanceof Chart) {
_matched=true;
_switchResult = this.generateText(o, "chart", ((Chart) o).getName());
}
if (!_matched) {
if (o instanceof ChartBar) {
_matched=true;
_switchResult = this.generateText(o, "option bar");
}
}
if (!_matched) {
if (o instanceof ChartLine) {
_matched=true;
_switchResult = this.generateText(o, "option line");
}
}
if (!_matched) {
if (o instanceof ChartPie) {
_matched=true;
_switchResult = this.generateText(o, "option pie");
}
}
if (!_matched) {
if (o instanceof ChartDonut) {
_matched=true;
_switchResult = this.generateText(o, "option donut");
}
}
if (!_matched) {
if (o instanceof ChartBubble) {
_matched=true;
_switchResult = this.generateText(o, "option bubble");
}
}
if (!_matched) {
if (o instanceof ChartGauge) {
_matched=true;
_switchResult = this.generateText(o, "option gauge");
}
}
if (!_matched) {
if (o instanceof ChartTree) {
_matched=true;
_switchResult = this.generateText(o, "option tree");
}
}
if (!_matched) {
if (o instanceof ChartInterval) {
_matched=true;
_switchResult = this.generateText(o, "interval");
}
}
if (!_matched) {
if (o instanceof ChartSegmentColor) {
_matched=true;
_switchResult = this.generateText(o, "segment color", String.format("RGB(%s)", ((ChartSegmentColor) o).getRgb()));
}
}
if (!_matched) {
if (o instanceof ChartRangeElement) {
_matched=true;
_switchResult = this.generateText(o, "range element");
}
}
if (!_matched) {
if (o instanceof ChartDatamart) {
_matched=true;
_switchResult = this.generateText(o, "datamart", ((ChartDatamart) o).getDatamartRef().getName());
}
}
if (!_matched) {
if (o instanceof ChartAxis) {
_matched=true;
_switchResult = this.generateText(o, "axis");
}
}
if (!_matched) {
if (o instanceof ChartLegend) {
_matched=true;
_switchResult = this.generateText(o, "legend");
}
}
if (!_matched) {
if (o instanceof ChartHighlighter) {
_matched=true;
_switchResult = this.generateText(o, "tooltip");
}
}
if (!_matched) {
_switchResult = super.text(o);
}
return _switchResult;
}
@Override
public Object image(final Object o) {
Object _switchResult = null;
boolean _matched = false;
if (o instanceof ChartModel) {
_matched=true;
_switchResult = this.getInternalImage("model.png", super.getClass());
}
if (!_matched) {
if (o instanceof Chart) {
_matched=true;
_switchResult = this.getInternalImage("dsl_chart.png", this.getClass());
}
}
if (!_matched) {
if (o instanceof ChartSegmentColor) {
_matched=true;
_switchResult = this.getColorOutlineImage(((ChartSegmentColor) o).getRgb(), true);
}
}
if (!_matched) {
if (o instanceof ChartOption) {
_matched=true;
_switchResult = this.getInternalImage("dsl_option.png", this.getClass());
}
}
if (!_matched) {
if (o instanceof ChartInterval) {
_matched=true;
_switchResult = this.getInternalImage("chart_interval.png", this.getClass());
}
}
if (!_matched) {
if (o instanceof ChartRangeElement) {
_matched=true;
_switchResult = this.getInternalImage("dsl_range.png", this.getClass());
}
}
if (!_matched) {
if (o instanceof ChartDatamart) {
_matched=true;
_switchResult = this.getInternalImage("dsl_datamart.png", this.getClass());
}
}
if (!_matched) {
if (o instanceof ChartAxis) {
_matched=true;
_switchResult = this.getInternalImage("chart_axis.png", this.getClass());
}
}
if (!_matched) {
if (o instanceof ChartLegend) {
_matched=true;
_switchResult = this.getInternalImage("chart_legend.png", this.getClass());
}
}
if (!_matched) {
if (o instanceof ChartHighlighter) {
_matched=true;
_switchResult = this.getInternalImage("chart_tooltip.png", this.getClass());
}
}
if (!_matched) {
_switchResult = super.image(o);
}
return _switchResult;
}
}