| /** |
| * 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.datainterchange.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.datainterchange.DataInterchange; |
| import org.eclipse.osbp.xtext.datainterchange.DataInterchangeBean; |
| import org.eclipse.osbp.xtext.datainterchange.DataInterchangeExpression; |
| import org.eclipse.osbp.xtext.datainterchange.DataInterchangeFileCSV; |
| import org.eclipse.osbp.xtext.datainterchange.DataInterchangeFileEDI; |
| import org.eclipse.osbp.xtext.datainterchange.DataInterchangeFileXML; |
| import org.eclipse.osbp.xtext.datainterchange.DataInterchangeFormat; |
| import org.eclipse.osbp.xtext.datainterchange.DataInterchangeLookup; |
| import org.eclipse.osbp.xtext.datainterchange.DataInterchangeMarkerEntity; |
| import org.eclipse.osbp.xtext.datainterchange.DataInterchangeMarkerPath; |
| import org.eclipse.osbp.xtext.datainterchange.DataInterchangeModel; |
| |
| /** |
| * Provides labels for a EObjects. |
| * |
| * see http://www.eclipse.org/Xtext/documentation.html#labelProvider |
| */ |
| @SuppressWarnings("all") |
| public class DataDSLLabelProvider extends BasicDSLLabelProvider { |
| @Inject |
| public DataDSLLabelProvider(final AdapterFactoryLabelProvider delegate) { |
| super(delegate); |
| } |
| |
| public String generateFormatText(final DataInterchangeFormat outlineFormatElement) { |
| String _xblockexpression = null; |
| { |
| String formatStr = outlineFormatElement.getFormat(); |
| _xblockexpression = this.generateText(outlineFormatElement, "format", formatStr); |
| } |
| return _xblockexpression; |
| } |
| |
| @Override |
| public Object text(final Object o) { |
| Object _switchResult = null; |
| boolean _matched = false; |
| if (o instanceof DataInterchange) { |
| _matched=true; |
| _switchResult = this.generateText(o, "data interchange", ((DataInterchange) o).getName()); |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeFileXML) { |
| _matched=true; |
| _switchResult = this.generateText(o, "XML file", ((DataInterchangeFileXML) o).getFileURL()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeFileCSV) { |
| _matched=true; |
| _switchResult = this.generateText(o, "CSV file", ((DataInterchangeFileCSV) o).getFileURL()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeFileEDI) { |
| _matched=true; |
| _switchResult = this.generateText(o, "EDI file", ((DataInterchangeFileEDI) o).getFileURL()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeBean) { |
| _matched=true; |
| _switchResult = this.generateText(o, "bean"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeExpression) { |
| _matched=true; |
| _switchResult = this.generateText(o, "expression"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeMarkerEntity) { |
| _matched=true; |
| _switchResult = this.generateText(o, "marker entity"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeMarkerPath) { |
| _matched=true; |
| _switchResult = this.generateText(o, "marker path"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeLookup) { |
| _matched=true; |
| _switchResult = this.generateText(o, "lookup"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeFormat) { |
| _matched=true; |
| _switchResult = this.generateFormatText(((DataInterchangeFormat) o)); |
| } |
| } |
| if (!_matched) { |
| _switchResult = super.text(o); |
| } |
| return _switchResult; |
| } |
| |
| @Override |
| public Object image(final Object o) { |
| Object _switchResult = null; |
| boolean _matched = false; |
| if (o instanceof DataInterchangeModel) { |
| _matched=true; |
| _switchResult = this.getInternalImage("model.png", super.getClass()); |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchange) { |
| _matched=true; |
| _switchResult = this.getInternalImage("dsl_datainterchange.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeFileXML) { |
| _matched=true; |
| _switchResult = this.getInternalImage("xml.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeFileCSV) { |
| _matched=true; |
| _switchResult = this.getInternalImage("csv.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeFileEDI) { |
| _matched=true; |
| _switchResult = this.getInternalImage("edi.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeBean) { |
| _matched=true; |
| _switchResult = this.getInternalImage("dsl_entity.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeExpression) { |
| _matched=true; |
| _switchResult = this.getInternalImage("dsl_expression.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeFormat) { |
| _matched=true; |
| _switchResult = this.getInternalImage("dsl_format.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeMarkerEntity) { |
| _matched=true; |
| _switchResult = this.getInternalImage("dsl_entity.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeMarkerPath) { |
| _matched=true; |
| _switchResult = this.getInternalImage("dsl_path.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof DataInterchangeLookup) { |
| _matched=true; |
| _switchResult = this.getInternalImage("data_lookup.gif", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| _switchResult = super.image(o); |
| } |
| return _switchResult; |
| } |
| } |