use of org.obeonetwork.dsl.cinematic.view.parts.ViewElementPropertiesEditionPart in project InformationSystem by ObeoNetwork.
the class ViewElementViewElementPropertiesEditionComponent 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 ViewElement viewElement = (ViewElement) elt;
final ViewElementPropertiesEditionPart viewElementPart = (ViewElementPropertiesEditionPart) editingPart;
// init values
if (isAccessible(ViewViewsRepository.ViewElement.Properties.description))
viewElementPart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, viewElement.getDescription()));
if (isAccessible(ViewViewsRepository.ViewElement.Properties.name))
viewElementPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, viewElement.getName()));
if (isAccessible(ViewViewsRepository.ViewElement.Properties.widget)) {
// init part
widgetSettings = new EObjectFlatComboSettings(viewElement, ViewPackage.eINSTANCE.getAbstractViewElement_Widget());
viewElementPart.initWidget(widgetSettings);
// set the button mode
viewElementPart.setWidgetButtonMode(ButtonsModeEnum.BROWSE);
}
if (isAccessible(ViewViewsRepository.ViewElement.Properties.actions)) {
actionsSettings = new ReferencesTableSettings(viewElement, ViewPackage.eINSTANCE.getAbstractViewElement_Actions());
viewElementPart.initActions(actionsSettings);
}
if (isAccessible(ViewViewsRepository.ViewElement.Properties.events)) {
eventsSettings = new ReferencesTableSettings(viewElement, ViewPackage.eINSTANCE.getAbstractViewElement_Events());
viewElementPart.initEvents(eventsSettings);
}
if (isAccessible(ViewViewsRepository.ViewElement.Properties.label))
viewElementPart.setLabel(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, viewElement.getLabel()));
if (isAccessible(ViewViewsRepository.ViewElement.Properties.required)) {
viewElementPart.setRequired(viewElement.isRequired());
}
if (isAccessible(ViewViewsRepository.ViewElement.Properties.type)) {
// init part
typeSettings = new EObjectFlatComboSettings(viewElement, ViewPackage.eINSTANCE.getViewElement_Type());
viewElementPart.initType(typeSettings);
// set the button mode
viewElementPart.setTypeButtonMode(ButtonsModeEnum.BROWSE);
}
if (isAccessible(ViewViewsRepository.ViewElement.Properties.widget)) {
viewElementPart.addFilterToWidget(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 Widget);
}
});
// Start of user code for additional businessfilters for widget
// End of user code
}
if (isAccessible(ViewViewsRepository.ViewElement.Properties.actions)) {
viewElementPart.addFilterToActions(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 ViewAction);
}
});
// Start of user code for additional businessfilters for actions
// End of user code
}
if (isAccessible(ViewViewsRepository.ViewElement.Properties.events)) {
viewElementPart.addFilterToEvents(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 ViewEvent);
}
});
// Start of user code for additional businessfilters for events
// End of user code
}
if (isAccessible(ViewViewsRepository.ViewElement.Properties.type)) {
viewElementPart.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 Type);
}
});
// 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);
}
Aggregations