| /** |
| * Copyright (c) 2013, 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 |
| */ |
| package org.eclipse.osbp.xtext.datamartdsl.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.datamartdsl.Addition; |
| import org.eclipse.osbp.xtext.datamartdsl.ConditionalExpression; |
| import org.eclipse.osbp.xtext.datamartdsl.Conjunction; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartAttributeBase; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartAxis; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartColumn; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartCondition; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartCube; |
| 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.DatamartEntity; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartHierarchy; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartMeasure; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartMember; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartModel; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartOrder; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartOwner; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartPackage; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartReference; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartSlicer; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartTask; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartTaskFilter; |
| import org.eclipse.osbp.xtext.datamartdsl.Disjunction; |
| import org.eclipse.osbp.xtext.datamartdsl.Division; |
| import org.eclipse.osbp.xtext.datamartdsl.Expression; |
| import org.eclipse.osbp.xtext.datamartdsl.Multiplication; |
| import org.eclipse.osbp.xtext.datamartdsl.Subtraction; |
| |
| /** |
| * Provides labels for a EObjects. |
| * |
| * see http://www.eclipse.org/Xtext/documentation.html#labelProvider |
| */ |
| @SuppressWarnings("all") |
| public class DatamartDSLLabelProvider extends BasicDSLLabelProvider { |
| @Inject |
| public DatamartDSLLabelProvider(final AdapterFactoryLabelProvider delegate) { |
| super(delegate); |
| } |
| |
| @Override |
| public Object text(final Object o) { |
| Object _switchResult = null; |
| boolean _matched = false; |
| if (o instanceof DatamartPackage) { |
| _matched=true; |
| _switchResult = this.generateText(o, "package", ((DatamartPackage)o).getName()); |
| } |
| if (!_matched) { |
| if (o instanceof DatamartDefinition) { |
| _matched=true; |
| _switchResult = this.generateText(o, "definition", ((DatamartDefinition)o).getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTask) { |
| _matched=true; |
| _switchResult = this.generateText(o, "task", ((DatamartTask)o).getTaskQuery().getLiteral()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartColumn) { |
| _matched=true; |
| _switchResult = this.generateText(o, "column", ((DatamartColumn)o).getColumnRef().getLiteral()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTaskFilter) { |
| _matched=true; |
| _switchResult = this.generateText(o, "task filter", ((DatamartTaskFilter)o).getFilterRef().getLiteral()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartCube) { |
| _matched=true; |
| _switchResult = this.generateText(o, "cube", ((DatamartCube)o).getCubeRef().getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartReference) { |
| _matched=true; |
| _switchResult = this.generateText(o, "reference", ((DatamartReference)o).getRef().getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartEntity) { |
| _matched=true; |
| _switchResult = this.generateText(o, "entity", ((DatamartEntity)o).getEntityRef().getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartOwner) { |
| _matched=true; |
| _switchResult = this.generateText(o, "owner", ((DatamartOwner)o).getJoinRef().getRef().getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartMember) { |
| _matched=true; |
| _switchResult = this.generateText(o, "member", ((DatamartMember)o).getJoinRef().getRef().getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartAttributeBase) { |
| _matched=true; |
| _switchResult = this.generateText(o, "property", ((DatamartAttributeBase)o).getAttributeRef().getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartCondition) { |
| _matched=true; |
| _switchResult = this.generateText(o, "condition"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartOrder) { |
| _matched=true; |
| _switchResult = this.generateText(o, "order"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartDerivedMeasure) { |
| _matched=true; |
| _switchResult = this.generateText(o, "derived measure", ((DatamartDerivedMeasure)o).getDerivedRef().getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartDefineDerivedMeasure) { |
| _matched=true; |
| _switchResult = this.generateText(o, "defined derived measure", ((DatamartDefineDerivedMeasure)o).getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartSlicer) { |
| _matched=true; |
| _switchResult = this.generateText(o, "slicer"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartAxis) { |
| _matched=true; |
| _switchResult = this.generateText(o, "axis"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartMeasure) { |
| _matched=true; |
| _switchResult = this.generateText(o, "measure", ((DatamartMeasure)o).getMeasureRef().getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartHierarchy) { |
| _matched=true; |
| _switchResult = this.generateText(o, "hierarchy", ((DatamartHierarchy)o).getHierarchyRef().getName()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Addition) { |
| _matched=true; |
| _switchResult = this.generateText(o, "addition"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Subtraction) { |
| _matched=true; |
| _switchResult = this.generateText(o, "subtraction"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Multiplication) { |
| _matched=true; |
| _switchResult = this.generateText(o, "multiplication"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Division) { |
| _matched=true; |
| _switchResult = this.generateText(o, "division"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Conjunction) { |
| _matched=true; |
| _switchResult = this.generateText(o, "conjunction"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Disjunction) { |
| _matched=true; |
| _switchResult = this.generateText(o, "disjunction"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof ConditionalExpression) { |
| _matched=true; |
| _switchResult = this.generateText(o, "conditional expression"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Expression) { |
| _matched=true; |
| _switchResult = this.generateText(o, "expression"); |
| } |
| } |
| if (!_matched) { |
| _switchResult = super.text(o); |
| } |
| return _switchResult; |
| } |
| |
| @Override |
| public Object image(final Object o) { |
| Object _switchResult = null; |
| boolean _matched = false; |
| if (o instanceof DatamartModel) { |
| _matched=true; |
| _switchResult = this.getInternalImage("model.png", this.getClass()); |
| } |
| if (!_matched) { |
| if (o instanceof DatamartPackage) { |
| _matched=true; |
| _switchResult = this.getInternalImage("package.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartDefinition) { |
| _matched=true; |
| _switchResult = this.getInternalImage("definition.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTask) { |
| _matched=true; |
| _switchResult = this.getInternalImage("task.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartColumn) { |
| _matched=true; |
| _switchResult = this.getInternalImage("column.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTaskFilter) { |
| _matched=true; |
| _switchResult = this.getInternalImage("taskfilter.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartCube) { |
| _matched=true; |
| _switchResult = this.getInternalImage("dsl_cube.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartReference) { |
| _matched=true; |
| _switchResult = this.getInternalImage("reference.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartEntity) { |
| _matched=true; |
| _switchResult = this.getInternalImage("datamartentity.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartOwner) { |
| _matched=true; |
| _switchResult = this.getInternalImage("owner.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartMember) { |
| _matched=true; |
| _switchResult = this.getInternalImage("member.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartAttributeBase) { |
| _matched=true; |
| _switchResult = this.getInternalImage("datamartproperty.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartCondition) { |
| _matched=true; |
| _switchResult = this.getInternalImage("condition.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartOrder) { |
| _matched=true; |
| _switchResult = this.getInternalImage("order.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartDerivedMeasure) { |
| _matched=true; |
| _switchResult = this.getInternalImage("measure-derived.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartDefineDerivedMeasure) { |
| _matched=true; |
| _switchResult = this.getInternalImage("measure-defined.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartSlicer) { |
| _matched=true; |
| _switchResult = this.getInternalImage("slicer.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartAxis) { |
| _matched=true; |
| _switchResult = this.getInternalImage("axis.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartMeasure) { |
| _matched=true; |
| _switchResult = this.getInternalImage("measure.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartHierarchy) { |
| _matched=true; |
| _switchResult = this.getInternalImage("dsl_hierarchy.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Addition) { |
| _matched=true; |
| _switchResult = this.getInternalImage("math-3-addition.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Subtraction) { |
| _matched=true; |
| _switchResult = this.getInternalImage("math-3-subtraction.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Multiplication) { |
| _matched=true; |
| _switchResult = this.getInternalImage("math-3-multiplication.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Division) { |
| _matched=true; |
| _switchResult = this.getInternalImage("math-3-division.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Conjunction) { |
| _matched=true; |
| _switchResult = this.getInternalImage("math-3-conjunction.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Disjunction) { |
| _matched=true; |
| _switchResult = this.getInternalImage("math-3-disjunction.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof ConditionalExpression) { |
| _matched=true; |
| _switchResult = this.getInternalImage("expression-conditional.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Expression) { |
| _matched=true; |
| _switchResult = this.getInternalImage("expression.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| _switchResult = super.image(o); |
| } |
| return _switchResult; |
| } |
| } |