BehaviorTransitionItemProvider.java
/**
* AADL-BA-FrontEnd
*
* Copyright (c) 2011-2021 TELECOM ParisTech and CNRS
*
* TELECOM ParisTech/LTCI
*
* Authors: see AUTHORS
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the Eclipse Public License as published by Eclipse, either
* version 2.0 of the License, or (at your option) any later version. This
* program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the Eclipse Public License for
* more details. You should have received a copy of the Eclipse Public License
* along with this program. If not, see
* https://www.eclipse.org/legal/epl-2.0/
*/
package org.osate.ba.aadlba.provider;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.osate.ba.aadlba.AadlBaPackage;
import org.osate.ba.aadlba.BehaviorTransition;
/**
* This is the item provider adapter for a {@link org.osate.ba.aadlba.BehaviorTransition} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class BehaviorTransitionItemProvider extends BehaviorNamedElementItemProvider {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BehaviorTransitionItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
addSourceStatePropertyDescriptor(object);
addConditionPropertyDescriptor(object);
addDestinationStatePropertyDescriptor(object);
addActionBlockPropertyDescriptor(object);
addPriorityPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the Source State feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addSourceStatePropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_BehaviorTransition_sourceState_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_BehaviorTransition_sourceState_feature",
"_UI_BehaviorTransition_type"),
AadlBaPackage.Literals.BEHAVIOR_TRANSITION__SOURCE_STATE, true, false, true, null, null, null));
}
/**
* This adds a property descriptor for the Condition feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addConditionPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_BehaviorTransition_condition_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_BehaviorTransition_condition_feature",
"_UI_BehaviorTransition_type"),
AadlBaPackage.Literals.BEHAVIOR_TRANSITION__CONDITION, true, false, true, null, null, null));
}
/**
* This adds a property descriptor for the Destination State feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addDestinationStatePropertyDescriptor(Object object) {
itemPropertyDescriptors.add(createItemPropertyDescriptor(
((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(),
getString("_UI_BehaviorTransition_destinationState_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_BehaviorTransition_destinationState_feature",
"_UI_BehaviorTransition_type"),
AadlBaPackage.Literals.BEHAVIOR_TRANSITION__DESTINATION_STATE, true, false, true, null, null, null));
}
/**
* This adds a property descriptor for the Action Block feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addActionBlockPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_BehaviorTransition_actionBlock_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_BehaviorTransition_actionBlock_feature",
"_UI_BehaviorTransition_type"),
AadlBaPackage.Literals.BEHAVIOR_TRANSITION__ACTION_BLOCK, true, false, true, null, null, null));
}
/**
* This adds a property descriptor for the Priority feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addPriorityPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_BehaviorTransition_priority_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_BehaviorTransition_priority_feature",
"_UI_BehaviorTransition_type"),
AadlBaPackage.Literals.BEHAVIOR_TRANSITION__PRIORITY, true, false, false,
ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null));
}
/**
* This returns BehaviorTransition.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*/
@Override
public Object getImage(Object object) {
String imgFile = BehaviorElementItemProvider.IMG_PATH + "transition_16";
return overlayImage(object, getResourceLocator().getImage(imgFile));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
String label = ((BehaviorTransition) object).getName();
return label == null || label.length() == 0 ? getString("_UI_BehaviorTransition_type")
: getString("_UI_BehaviorTransition_type") + " " + label;
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(BehaviorTransition.class)) {
case AadlBaPackage.BEHAVIOR_TRANSITION__PRIORITY:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
}
}