| /** |
| * 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.table.ui.labeling; |
| |
| import com.google.inject.Inject; |
| import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; |
| import org.eclipse.osbp.dsl.semantic.dto.LDto; |
| import org.eclipse.osbp.dsl.semantic.entity.LEntityAttribute; |
| import org.eclipse.osbp.infogrid.model.gridsource.CxGridProperty; |
| import org.eclipse.osbp.infogrid.model.gridsource.style.CxGridPropStyle; |
| import org.eclipse.osbp.xtext.basic.ui.labeling.BasicDSLLabelProvider; |
| import org.eclipse.osbp.xtext.cubedsl.CubeLevel; |
| import org.eclipse.osbp.xtext.cubedsl.CubeMeasure; |
| import org.eclipse.osbp.xtext.datamartdsl.AxisEnum; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartColumn; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartDefineDerivedMeasure; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartDefinition; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartDerivedMeasure; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartMeasure; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartProperty; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartSetAggregationFunction; |
| import org.eclipse.osbp.xtext.datamartdsl.SetAggregationEnum; |
| import org.eclipse.osbp.xtext.datamartdsl.TaskQueryColumnEnum; |
| import org.eclipse.osbp.xtext.table.Table; |
| import org.eclipse.osbp.xtext.table.TableAggregation; |
| import org.eclipse.osbp.xtext.table.TableAllColumns; |
| import org.eclipse.osbp.xtext.table.TableAxis; |
| import org.eclipse.osbp.xtext.table.TableBrokerDatamart; |
| import org.eclipse.osbp.xtext.table.TableCellColor; |
| import org.eclipse.osbp.xtext.table.TableColumn; |
| import org.eclipse.osbp.xtext.table.TableDatamart; |
| import org.eclipse.osbp.xtext.table.TableDateDayLookup; |
| import org.eclipse.osbp.xtext.table.TableDerived; |
| import org.eclipse.osbp.xtext.table.TableDtoDatasource; |
| import org.eclipse.osbp.xtext.table.TableEvent; |
| import org.eclipse.osbp.xtext.table.TableFormatter; |
| import org.eclipse.osbp.xtext.table.TableGrid; |
| import org.eclipse.osbp.xtext.table.TableHierarchy; |
| import org.eclipse.osbp.xtext.table.TableIcon; |
| import org.eclipse.osbp.xtext.table.TableInterval; |
| import org.eclipse.osbp.xtext.table.TableLookup; |
| import org.eclipse.osbp.xtext.table.TableMeasure; |
| import org.eclipse.osbp.xtext.table.TableModel; |
| import org.eclipse.osbp.xtext.table.TableNumberLookup; |
| import org.eclipse.osbp.xtext.table.TableOrdinal; |
| import org.eclipse.osbp.xtext.table.TablePackage; |
| import org.eclipse.osbp.xtext.table.TablePreorder; |
| import org.eclipse.osbp.xtext.table.TableProperty; |
| import org.eclipse.osbp.xtext.table.TableStringLookup; |
| import org.eclipse.osbp.xtext.table.TableTable; |
| import org.eclipse.osbp.xtext.table.TableTask; |
| import org.eclipse.osbp.xtext.table.TableTextColor; |
| import org.eclipse.osbp.xtext.table.TableTooltip; |
| import org.eclipse.osbp.xtext.table.TableTrend; |
| import org.eclipse.osbp.xtext.table.TableValue; |
| import org.eclipse.osbp.xtext.table.TrendIconEnum; |
| import org.eclipse.xtend2.lib.StringConcatenation; |
| |
| /** |
| * Provides labels for a EObjects. |
| * |
| * see http://www.eclipse.org/Xtext/documentation.html#labelProvider |
| */ |
| @SuppressWarnings("all") |
| public class TableDSLLabelProvider extends BasicDSLLabelProvider { |
| @Inject |
| public TableDSLLabelProvider(final AdapterFactoryLabelProvider delegate) { |
| super(delegate); |
| } |
| |
| public Object text(final Object o) { |
| Object _switchResult = null; |
| boolean _matched = false; |
| if (!_matched) { |
| if (o instanceof TablePackage) { |
| _matched=true; |
| String _name = ((TablePackage)o).getName(); |
| _switchResult = this.generateText(o, "package", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Table) { |
| _matched=true; |
| String _name = ((Table)o).getName(); |
| _switchResult = this.generateText(o, "table model", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableTable) { |
| _matched=true; |
| TableDatamart _source = ((TableTable)o).getSource(); |
| DatamartDefinition _datamartRef = _source.getDatamartRef(); |
| String _name = _datamartRef.getName(); |
| _switchResult = this.generateText(o, "table", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableGrid) { |
| _matched=true; |
| TableDtoDatasource _source = ((TableGrid)o).getSource(); |
| LDto _dtoSource = _source.getDtoSource(); |
| String _name = _dtoSource.getName(); |
| _switchResult = this.generateText(o, "grid", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableAxis) { |
| _matched=true; |
| AxisEnum _axis = ((TableAxis)o).getAxis(); |
| String _literal = _axis.getLiteral(); |
| _switchResult = this.generateText(o, "axis", _literal); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableDatamart) { |
| _matched=true; |
| DatamartDefinition _datamartRef = ((TableDatamart)o).getDatamartRef(); |
| String _name = _datamartRef.getName(); |
| _switchResult = this.generateText(o, "datamart", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableBrokerDatamart) { |
| _matched=true; |
| DatamartDefinition _datamartDef = ((TableBrokerDatamart)o).getDatamartDef(); |
| String _name = _datamartDef.getName(); |
| _switchResult = this.generateText(o, "datamart", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableEvent) { |
| _matched=true; |
| _switchResult = this.generateText(o, "event"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableValue) { |
| _matched=true; |
| _switchResult = this.generateText(o, "value"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableInterval) { |
| _matched=true; |
| _switchResult = this.generateText(o, "interval"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableFormatter) { |
| _matched=true; |
| String _format = ((TableFormatter)o).getFormat(); |
| _switchResult = this.generateText(o, "formatter", _format); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableTextColor) { |
| _matched=true; |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("textcolor ("); |
| String _rgb = ((TableTextColor)o).getRgb(); |
| _builder.append(_rgb, ""); |
| _builder.append(")"); |
| _switchResult = this.generateText(o, _builder.toString()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableCellColor) { |
| _matched=true; |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("cellcolor ("); |
| String _rgb = ((TableCellColor)o).getRgb(); |
| _builder.append(_rgb, ""); |
| _builder.append(")"); |
| _switchResult = this.generateText(o, _builder.toString()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableIcon) { |
| _matched=true; |
| String _icon = ((TableIcon)o).getIcon(); |
| _switchResult = this.generateText(o, "icon", _icon); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableTooltip) { |
| _matched=true; |
| String _tooltip = ((TableTooltip)o).getTooltip(); |
| _switchResult = this.generateText(o, "tooltip", _tooltip); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableTrend) { |
| _matched=true; |
| TrendIconEnum _icon = ((TableTrend)o).getIcon(); |
| String _string = _icon.toString(); |
| _switchResult = this.generateText(o, "trend", _string); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableProperty) { |
| _matched=true; |
| DatamartProperty _valueRef = ((TableProperty)o).getValueRef(); |
| LEntityAttribute _propertyRef = _valueRef.getPropertyRef(); |
| String _name = _propertyRef.getName(); |
| _switchResult = this.generateText(o, "table property", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableAggregation) { |
| _matched=true; |
| DatamartSetAggregationFunction _valueRef = ((TableAggregation)o).getValueRef(); |
| SetAggregationEnum _aggregation = _valueRef.getAggregation(); |
| String _string = _aggregation.toString(); |
| _switchResult = this.generateText(o, "aggregation", _string); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableHierarchy) { |
| _matched=true; |
| CubeLevel _valueRef = ((TableHierarchy)o).getValueRef(); |
| String _name = _valueRef.getName(); |
| _switchResult = this.generateText(o, "level", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableMeasure) { |
| _matched=true; |
| DatamartMeasure _valueRef = ((TableMeasure)o).getValueRef(); |
| CubeMeasure _measureRef = _valueRef.getMeasureRef(); |
| String _name = _measureRef.getName(); |
| _switchResult = this.generateText(o, "measure", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableDerived) { |
| _matched=true; |
| DatamartDerivedMeasure _valueRef = ((TableDerived)o).getValueRef(); |
| DatamartDefineDerivedMeasure _derivedRef = _valueRef.getDerivedRef(); |
| String _name = _derivedRef.getName(); |
| _switchResult = this.generateText(o, "derived", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableOrdinal) { |
| _matched=true; |
| String _valueRef = ((TableOrdinal)o).getValueRef(); |
| String _string = _valueRef.toString(); |
| _switchResult = this.generateText(o, "ordinal", _string); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableColumn) { |
| _matched=true; |
| DatamartColumn _valueRef = ((TableColumn)o).getValueRef(); |
| TaskQueryColumnEnum _columnRef = _valueRef.getColumnRef(); |
| String _string = _columnRef.toString(); |
| _switchResult = this.generateText(o, "column", _string); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableTask) { |
| _matched=true; |
| _switchResult = this.generateText(o, "task"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableAllColumns) { |
| _matched=true; |
| _switchResult = this.generateText(o, "all columns"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TablePreorder) { |
| _matched=true; |
| _switchResult = this.generateText(o, "pre order"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof CxGridProperty) { |
| _matched=true; |
| _switchResult = this.generateText(o, "grid property"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof CxGridPropStyle) { |
| _matched=true; |
| _switchResult = this.generateText(o, "property style"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableDtoDatasource) { |
| _matched=true; |
| LDto _dtoSource = ((TableDtoDatasource)o).getDtoSource(); |
| String _name = _dtoSource.getName(); |
| _switchResult = this.generateText(o, "dto datasource", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableStringLookup) { |
| _matched=true; |
| String _lookupValue = ((TableStringLookup)o).getLookupValue(); |
| _switchResult = this.generateText(o, "string lookup", _lookupValue); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableNumberLookup) { |
| _matched=true; |
| double _lookupValue = ((TableNumberLookup)o).getLookupValue(); |
| String _string = Double.valueOf(_lookupValue).toString(); |
| _switchResult = this.generateText(o, "number lookup", _string); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableDateDayLookup) { |
| _matched=true; |
| double _lookupValue = ((TableDateDayLookup)o).getLookupValue(); |
| String _string = Double.valueOf(_lookupValue).toString(); |
| _switchResult = this.generateText(o, "date lookup", _string); |
| } |
| } |
| 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 TableModel) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("model.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TablePackage) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("package.gif", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Table) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("dsl_table.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableTable) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("table-table.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableGrid) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("table-grid.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableAxis) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("axis.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableDatamart) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("dsl_datamart.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableBrokerDatamart) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("dsl_datamart.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableEvent) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("event.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableValue) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("value3.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableInterval) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("interval.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableFormatter) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("format.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableTextColor) { |
| _matched=true; |
| String _rgb = ((TableTextColor)o).getRgb(); |
| _switchResult = this.getColorOutlineImage(_rgb, true); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableCellColor) { |
| _matched=true; |
| String _rgb = ((TableCellColor)o).getRgb(); |
| _switchResult = this.getColorOutlineImage(_rgb, true); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableIcon) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("img.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableTooltip) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("tooltip.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableTrend) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("trend.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableProperty) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("properties.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableAggregation) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("aggregate.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableAllColumns) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("column.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableHierarchy) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("level.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableMeasure) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("measure.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableDerived) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("derived.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableTask) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("task.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableColumn) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("column.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableLookup) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("lookup.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TablePreorder) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("pre-order.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof CxGridProperty) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("properties.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof CxGridPropStyle) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("style.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof TableDtoDatasource) { |
| _matched=true; |
| Class<? extends TableDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("datasource.png", _class); |
| } |
| } |
| if (!_matched) { |
| _switchResult = super.image(o); |
| } |
| return _switchResult; |
| } |
| } |