| /** |
| * 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.authorizationdsl.ui.labeling; |
| |
| import com.google.inject.Inject; |
| import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; |
| import org.eclipse.osbp.xtext.authorizationdsl.AuthorizationModel; |
| import org.eclipse.osbp.xtext.authorizationdsl.Role; |
| import org.eclipse.osbp.xtext.authorizationdsl.RoleBlipProcess; |
| import org.eclipse.osbp.xtext.authorizationdsl.RoleBlipUserTask; |
| import org.eclipse.osbp.xtext.authorizationdsl.RoleEntity; |
| import org.eclipse.osbp.xtext.authorizationdsl.RoleEntityAttribute; |
| import org.eclipse.osbp.xtext.authorizationdsl.RoleEntityReference; |
| import org.eclipse.osbp.xtext.basic.ui.labeling.BasicDSLLabelProvider; |
| |
| /** |
| * Provides labels for a EObjects. |
| * |
| * see http://www.eclipse.org/Xtext/documentation.html#labelProvider |
| */ |
| @SuppressWarnings("all") |
| public class AuthorizationDSLLabelProvider extends BasicDSLLabelProvider { |
| @Inject |
| public AuthorizationDSLLabelProvider(final AdapterFactoryLabelProvider delegate) { |
| super(delegate); |
| } |
| |
| @Override |
| public Object text(final Object o) { |
| Object _switchResult = null; |
| boolean _matched = false; |
| if (o instanceof Role) { |
| _matched=true; |
| _switchResult = this.generateText(o, "role", ((Role) o).getName()); |
| } |
| if (!_matched) { |
| if (o instanceof RoleEntity) { |
| _matched=true; |
| _switchResult = this.generateText(o, "role entity"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof RoleBlipProcess) { |
| _matched=true; |
| _switchResult = this.generateText(o, "role process"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof RoleBlipUserTask) { |
| _matched=true; |
| _switchResult = this.generateText(o, "role user task"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof RoleEntityAttribute) { |
| _matched=true; |
| _switchResult = this.generateText(o, "role entity property"); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof RoleEntityReference) { |
| _matched=true; |
| _switchResult = this.generateText(o, "role entity reference"); |
| } |
| } |
| if (!_matched) { |
| _switchResult = super.text(o); |
| } |
| return _switchResult; |
| } |
| |
| @Override |
| public Object image(final Object o) { |
| Object _switchResult = null; |
| boolean _matched = false; |
| if (o instanceof AuthorizationModel) { |
| _matched=true; |
| _switchResult = this.getInternalImage("model.png", this.getClass()); |
| } |
| if (!_matched) { |
| if (o instanceof Role) { |
| _matched=true; |
| _switchResult = this.getInternalImage("dsl_role.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof RoleEntity) { |
| _matched=true; |
| _switchResult = this.getInternalImage("role_entity.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof RoleBlipProcess) { |
| _matched=true; |
| _switchResult = this.getInternalImage("dsl_blip.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof RoleEntityAttribute) { |
| _matched=true; |
| _switchResult = this.getInternalImage("role_entity_attribute_authorization.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| if (o instanceof RoleEntityReference) { |
| _matched=true; |
| _switchResult = this.getInternalImage("role_entity_reference_authorization.png", this.getClass()); |
| } |
| } |
| if (!_matched) { |
| _switchResult = super.image(o); |
| } |
| return _switchResult; |
| } |
| } |