use of org.obeonetwork.dsl.environment.ObeoDSMObject in project InformationSystem by ObeoNetwork.
the class CustomRiskPropertiesEditionComponent method initPart.
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
* org.eclipse.emf.ecore.resource.ResourceSet)
*/
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
setInitializing(true);
if (editingPart != null && key == partKey) {
editingPart.setContext(elt, allResource);
final ObeoDSMObject obeoDSMObject = (ObeoDSMObject) elt;
final Risk riskObject = getRiskObject(obeoDSMObject);
final RiskPropertiesEditionPart riskPart = (RiskPropertiesEditionPart) editingPart;
// init values
if (riskObject != null) {
if (benefitsSettings.getSignificantObject() != null && isAccessible(GraalextensionsViewsRepository.Risk.Properties.benefits)) {
riskPart.initBenefits(EEFUtils.choiceOfValues(benefitsSettings.getSignificantObject(), GraalExtensionsPackage.eINSTANCE.getRisk_Benefits()), (Enumerator) benefitsSettings.getValue());
}
if (drawbacksSettings.getSignificantObject() != null && isAccessible(GraalextensionsViewsRepository.Risk.Properties.drawbacks)) {
riskPart.initDrawbacks(EEFUtils.choiceOfValues(drawbacksSettings.getSignificantObject(), GraalExtensionsPackage.eINSTANCE.getRisk_Drawbacks()), (Enumerator) drawbacksSettings.getValue());
}
if (riskSettings.getSignificantObject() != null && isAccessible(GraalextensionsViewsRepository.Risk.Properties.risk_)) {
riskPart.initRisk(EEFUtils.choiceOfValues(riskSettings.getSignificantObject(), GraalExtensionsPackage.eINSTANCE.getRisk_Risk()), (Enumerator) riskSettings.getValue());
}
} else {
riskPart.initBenefits(BenefitsLevel.values(), BenefitsLevel.UNDEFINED);
riskPart.initDrawbacks(DrawbacksLevel.values(), DrawbacksLevel.UNDEFINED);
riskPart.initRisk(RiskLevel.values(), RiskLevel.UNDEFINED);
}
// init filters
// init values for referenced views
// init filters for referenced views
}
setInitializing(false);
}
use of org.obeonetwork.dsl.environment.ObeoDSMObject in project InformationSystem by ObeoNetwork.
the class CustomRiskPropertiesEditionComponent method createRiskObject.
private Risk createRiskObject(EObject element) {
if (element instanceof ObeoDSMObject) {
ObeoDSMObject obeoDSMObject = (ObeoDSMObject) element;
MetaDataContainer container = obeoDSMObject.getMetadatas();
if (container == null) {
container = EnvironmentFactory.eINSTANCE.createMetaDataContainer();
obeoDSMObject.setMetadatas(container);
}
Risk newRisk = GraalExtensionsFactory.eINSTANCE.createRisk();
container.getMetadatas().add(newRisk);
return newRisk;
}
return null;
}
use of org.obeonetwork.dsl.environment.ObeoDSMObject in project InformationSystem by ObeoNetwork.
the class CustomEEFEditorSettings method getOrCreateSignificantObject.
public EObject getOrCreateSignificantObject() {
EObject object = getSignificantObject();
if (object == null) {
if (getSource() instanceof ObeoDSMObject) {
ObeoDSMObject source = (ObeoDSMObject) getSource();
EditingDomain domain = context.getEditingDomain();
if (source.getMetadatas() == null) {
// Create MetaDataContainer
MetaDataContainer mdContainer = EnvironmentFactory.eINSTANCE.createMetaDataContainer();
domain.getCommandStack().execute(SetCommand.create(domain, source, EnvironmentPackage.eINSTANCE.getObeoDSMObject_Metadatas(), mdContainer));
}
// Create Risk
Risk risk = GraalExtensionsFactory.eINSTANCE.createRisk();
domain.getCommandStack().execute(AddCommand.create(domain, source.getMetadatas(), EnvironmentPackage.eINSTANCE.getMetaDataContainer_Metadatas(), risk));
significantObject = getSignificantObject();
return significantObject;
}
}
return object;
}
use of org.obeonetwork.dsl.environment.ObeoDSMObject in project InformationSystem by ObeoNetwork.
the class ParticipantParticipantPropertiesEditionComponent method initPart.
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
* org.eclipse.emf.ecore.resource.ResourceSet)
*/
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
setInitializing(true);
if (editingPart != null && key == partKey) {
editingPart.setContext(elt, allResource);
final Participant participant = (Participant) elt;
final ParticipantPropertiesEditionPart participantPart = (ParticipantPropertiesEditionPart) editingPart;
// init values
if (isAccessible(InteractionViewsRepository.Participant.Properties.name))
participantPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, participant.getName()));
if (isAccessible(InteractionViewsRepository.Participant.Properties.type)) {
// init part
typeSettings = new EObjectFlatComboSettings(participant, InteractionPackage.eINSTANCE.getParticipant_Type());
participantPart.initType(typeSettings);
// set the button mode
participantPart.setTypeButtonMode(ButtonsModeEnum.BROWSE);
}
if (isAccessible(InteractionViewsRepository.Participant.Properties.description))
participantPart.setDescription(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, participant.getDescription()));
if (isAccessible(InteractionViewsRepository.Participant.Properties.type)) {
participantPart.addFilterToType(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
// $NON-NLS-1$
return (element instanceof String && element.equals("")) || (element instanceof ObeoDSMObject);
}
});
// Start of user code for additional businessfilters for type
// End of user code
}
// init values for referenced views
// init filters for referenced views
}
setInitializing(false);
}
use of org.obeonetwork.dsl.environment.ObeoDSMObject in project InformationSystem by ObeoNetwork.
the class StateMachineParentSelectionContentProvider method getElements.
@Override
public Object[] getElements(Object object) {
if (object instanceof Object[]) {
List<Object> elements = new ArrayList<Object>();
for (Object input : (Object[]) object) {
elements.addAll(Arrays.asList(getElements(input)));
}
return elements.toArray();
} else {
List<Object> result = new ArrayList<Object>();
Object[] elements = super.getElements(object);
for (Object element : elements) {
if (element instanceof ObeoDSMObject && !(element instanceof Behaviour)) {
result.add(element);
}
}
return result.toArray();
}
}
Aggregations