blob: f9acfd4056ef211b6a1f6392d2c3acd51df03a6d [file] [log] [blame]
/**
*
* 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.RoleEntity
import org.eclipse.osbp.xtext.authorizationdsl.RoleEntityAttribute
import org.eclipse.osbp.xtext.authorizationdsl.RoleEntityReference
import org.eclipse.osbp.xtext.basic.ui.labeling.BasicDSLLabelProvider
import org.eclipse.osbp.xtext.authorizationdsl.RoleBlipUserTask
import org.eclipse.osbp.xtext.authorizationdsl.RoleBlipProcess
/**
* Provides labels for a EObjects.
*
* see http://www.eclipse.org/Xtext/documentation.html#labelProvider
*/
class AuthorizationDSLLabelProvider extends BasicDSLLabelProvider {
@Inject
new(AdapterFactoryLabelProvider delegate) {
super(delegate);
}
/* ********************************************************************************************** */
/** Provides outline text for Authorization-DSL.
*
* Uses common (default) text for package and for import element.
*
* @see BasicDSLLabelProvider.text(Object)
*
* @param o Current outline element
*
* @return String instance.
*
* @since @D 150925, gu
* @date @D yymmdd, name
*/ /* ******************************************************************************************* */
override text ( Object o ) {
switch (o) {
Role : generateText( o, 'role' , (o as Role).name )
RoleEntity : generateText( o, 'role entity' )
RoleBlipProcess : generateText( o, 'role process' )
RoleBlipUserTask : generateText( o, 'role user task' )
RoleEntityAttribute : generateText( o, 'role entity property' )
RoleEntityReference : generateText( o, 'role entity reference' )
default : super.text( o )
}
}
//
// def image(Greeting ele) {
// 'Greeting.gif'
// }
/* ********************************************************************************************** */
/** Provides outline images for Authorization-DSL.
*
* Uses common (default) image for package and for import element.
*
* @see BasicDSLLabelProvider.image(Object)
*
* @param o Current outline element
*
* @return Image instance if requested image file was found, return value of overridden superclass
* method otherwise.
*
* @since @D 150925, gu
* @date @D yymmdd, name
*/ /* ******************************************************************************************* */
override image ( Object o ) {
switch (o) {
AuthorizationModel : getInternalImage( 'model.png', class)
Role : getInternalImage( 'dsl_role.png', class)
RoleEntity : getInternalImage( 'role_entity.png', class)
RoleBlipProcess : getInternalImage( 'dsl_blip.png', class)
RoleEntityAttribute : getInternalImage( 'role_entity_attribute_authorization.png', class)
RoleEntityReference : getInternalImage( 'role_entity_reference_authorization.png', class)
default : super.image( o )
}
}
}