| /** |
| * 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 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 |
| */ |
| 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.dsl.semantic.entity.LEntity; |
| import org.eclipse.osbp.dsl.semantic.entity.LEntityAttribute; |
| import org.eclipse.osbp.dsl.semantic.entity.LEntityReference; |
| import org.eclipse.osbp.xtext.authorizationdsl.Role; |
| import org.eclipse.osbp.xtext.basic.ui.labeling.BasicDSLLabelProvider; |
| import org.eclipse.osbp.xtext.cubedsl.CubeHierarchy; |
| import org.eclipse.osbp.xtext.cubedsl.CubeMeasure; |
| import org.eclipse.osbp.xtext.cubedsl.CubeType; |
| 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.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.DatamartProperty; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartReference; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartRole; |
| 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; |
| import org.eclipse.osbp.xtext.datamartdsl.TaskFilterEnum; |
| import org.eclipse.osbp.xtext.datamartdsl.TaskQueryColumnEnum; |
| import org.eclipse.osbp.xtext.datamartdsl.TaskQueryTopicEnum; |
| |
| /** |
| * 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); |
| } |
| |
| public Object text(final Object o) { |
| Object _switchResult = null; |
| boolean _matched = false; |
| if (!_matched) { |
| if (o instanceof DatamartPackage) { |
| _matched=true; |
| String _name = ((DatamartPackage)o).getName(); |
| _switchResult = this.generateText(o, "package", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartDefinition) { |
| _matched=true; |
| String _name = ((DatamartDefinition)o).getName(); |
| _switchResult = this.generateText(o, "definition", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartRole) { |
| _matched=true; |
| Role _assignedRole = ((DatamartRole)o).getAssignedRole(); |
| String _name = _assignedRole.getName(); |
| _switchResult = this.generateText(o, "role", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTask) { |
| _matched=true; |
| TaskQueryTopicEnum _taskQuery = ((DatamartTask)o).getTaskQuery(); |
| String _literal = _taskQuery.getLiteral(); |
| _switchResult = this.generateText(o, "task", _literal); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartColumn) { |
| _matched=true; |
| TaskQueryColumnEnum _columnRef = ((DatamartColumn)o).getColumnRef(); |
| String _literal = _columnRef.getLiteral(); |
| _switchResult = this.generateText(o, "column", _literal); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTaskFilter) { |
| _matched=true; |
| TaskFilterEnum _filterRef = ((DatamartTaskFilter)o).getFilterRef(); |
| String _literal = _filterRef.getLiteral(); |
| _switchResult = this.generateText(o, "task filter", _literal); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartCube) { |
| _matched=true; |
| CubeType _cubeRef = ((DatamartCube)o).getCubeRef(); |
| String _name = _cubeRef.getName(); |
| _switchResult = this.generateText(o, "cube", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartReference) { |
| _matched=true; |
| LEntityReference _ref = ((DatamartReference)o).getRef(); |
| String _name = _ref.getName(); |
| _switchResult = this.generateText(o, "reference", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartEntity) { |
| _matched=true; |
| LEntity _entityRef = ((DatamartEntity)o).getEntityRef(); |
| String _name = _entityRef.getName(); |
| _switchResult = this.generateText(o, "entity", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartOwner) { |
| _matched=true; |
| DatamartReference _joinRef = ((DatamartOwner)o).getJoinRef(); |
| LEntityReference _ref = _joinRef.getRef(); |
| String _name = _ref.getName(); |
| _switchResult = this.generateText(o, "owner", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartMember) { |
| _matched=true; |
| DatamartReference _joinRef = ((DatamartMember)o).getJoinRef(); |
| LEntityReference _ref = _joinRef.getRef(); |
| String _name = _ref.getName(); |
| _switchResult = this.generateText(o, "member", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartProperty) { |
| _matched=true; |
| LEntityAttribute _propertyRef = ((DatamartProperty)o).getPropertyRef(); |
| String _name = _propertyRef.getName(); |
| _switchResult = this.generateText(o, "property", _name); |
| } |
| } |
| 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; |
| DatamartDefineDerivedMeasure _derivedRef = ((DatamartDerivedMeasure)o).getDerivedRef(); |
| String _name = _derivedRef.getName(); |
| _switchResult = this.generateText(o, "derived measure", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartDefineDerivedMeasure) { |
| _matched=true; |
| String _name = ((DatamartDefineDerivedMeasure)o).getName(); |
| _switchResult = this.generateText(o, "defined derived measure", _name); |
| } |
| } |
| 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; |
| CubeMeasure _measureRef = ((DatamartMeasure)o).getMeasureRef(); |
| String _name = _measureRef.getName(); |
| _switchResult = this.generateText(o, "measure", _name); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartHierarchy) { |
| _matched=true; |
| CubeHierarchy _hierarchyRef = ((DatamartHierarchy)o).getHierarchyRef(); |
| String _name = _hierarchyRef.getName(); |
| _switchResult = this.generateText(o, "hierarchy", _name); |
| } |
| } |
| 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; |
| } |
| |
| public Object image(final Object o) { |
| Object _switchResult = null; |
| boolean _matched = false; |
| if (!_matched) { |
| if (o instanceof DatamartModel) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("model.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartPackage) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("package.gif", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartDefinition) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("definition.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartRole) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("role.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTask) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("task.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartColumn) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("column.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartTaskFilter) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("taskfilter.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartCube) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("dsl_cube.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartReference) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("reference.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartEntity) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("datamartentity.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartOwner) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("owner.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartMember) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("member.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartProperty) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("datamartproperty.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartCondition) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("condition.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartOrder) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("order.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartDerivedMeasure) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("measure-derived.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartDefineDerivedMeasure) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("measure-defined.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartSlicer) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("slicer.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartAxis) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("axis.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartMeasure) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("measure.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DatamartHierarchy) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("dsl_hierarchy.gif", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Addition) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("math-3-addition.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Subtraction) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("math-3-subtraction.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Multiplication) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("math-3-multiplication.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Division) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("math-3-division.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Conjunction) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("math-3-conjunction.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Disjunction) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("math-3-disjunction.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof ConditionalExpression) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("expression-conditional.png", _class); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof Expression) { |
| _matched=true; |
| Class<? extends DatamartDSLLabelProvider> _class = this.getClass(); |
| _switchResult = this.getInternalImage("expression.png", _class); |
| } |
| } |
| if (!_matched) { |
| _switchResult = super.image(o); |
| } |
| return _switchResult; |
| } |
| } |