use of org.obeonetwork.dsl.environment.BindingInfo in project InformationSystem by ObeoNetwork.
the class CinematicBindingServices method createCinematicBindingInfo.
public BindingInfo createCinematicBindingInfo(AbstractViewElement viewElement, EObject boundElement) {
if (boundElement instanceof BoundableElement) {
BoundableElement target = (BoundableElement) boundElement;
BindingRegistry bindingRegistry = getGlobalBindingRegistry(viewElement);
BindingInfo newBindingInfo = EnvironmentFactory.eINSTANCE.createBindingInfo();
newBindingInfo.setLeft(viewElement);
newBindingInfo.setRight(target);
bindingRegistry.getBindingInfos().add(newBindingInfo);
return newBindingInfo;
}
return null;
}
use of org.obeonetwork.dsl.environment.BindingInfo in project InformationSystem by ObeoNetwork.
the class BindingService method getRelatedBindingInfos.
private Collection<BindingInfo> getRelatedBindingInfos(StructuredType structuredType) {
EObjectQuery query = new EObjectQuery(structuredType);
Collection<EObject> targets = new HashSet<EObject>();
targets.addAll(query.getInverseReferences(EnvironmentPackage.Literals.BINDING_INFO__LEFT));
targets.addAll(query.getInverseReferences(EnvironmentPackage.Literals.BINDING_INFO__RIGHT));
Collection<BindingInfo> bindingInfos = new ArrayList<BindingInfo>();
for (EObject target : targets) {
if (target instanceof BindingInfo) {
bindingInfos.add((BindingInfo) target);
}
}
return bindingInfos;
}
use of org.obeonetwork.dsl.environment.BindingInfo in project InformationSystem by ObeoNetwork.
the class BindingService method getAllBindableElements.
public Collection<StructuredType> getAllBindableElements(DSemanticDiagram diagram, StructuredType structuredType) {
// Collect all structured types
Collection<StructuredType> bindableElements = new ArrayList<StructuredType>();
// First get all structured types
bindableElements.addAll(getAllStructuredTypes(structuredType));
// Remove the target element
bindableElements.remove(structuredType);
// Remove elements already bound with the target
for (BindingInfo bindingInfo : getAllBindingInfosOnDiagram(diagram)) {
if (bindingInfo.getLeft() == structuredType) {
bindableElements.remove(bindingInfo.getRight());
}
if (bindingInfo.getRight() == structuredType) {
bindableElements.remove(bindingInfo.getLeft());
}
}
return bindableElements;
}
use of org.obeonetwork.dsl.environment.BindingInfo in project InformationSystem by ObeoNetwork.
the class BindingService method getRelatedBindingInfos.
public Collection<BindingInfo> getRelatedBindingInfos(Namespace namespace) {
// Use of LinkedHashSet to keep order and avoid potential lock/unlock
// loops problems
Set<BindingInfo> results = new LinkedHashSet<BindingInfo>();
for (BindingRegistry bindingRegistry : namespace.getBindingRegistries()) {
results.addAll(bindingRegistry.getBindingInfos());
}
for (Type containedType : namespace.getTypes()) {
if (containedType instanceof StructuredType) {
StructuredType containedStructuredType = (StructuredType) containedType;
results.addAll(getRelatedBindingInfos(containedStructuredType));
}
}
return results;
}
use of org.obeonetwork.dsl.environment.BindingInfo in project InformationSystem by ObeoNetwork.
the class BindingInfoBindingInfoPropertiesEditionComponent 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 BindingInfo bindingInfo = (BindingInfo) elt;
final BindingInfoPropertiesEditionPart bindingInfoPart = (BindingInfoPropertiesEditionPart) editingPart;
// init values
if (isAccessible(EnvironmentViewsRepository.BindingInfo.Properties.left)) {
bindingInfoPart.initLeft(EEFUtils.choiceOfValues(bindingInfo, EnvironmentPackage.eINSTANCE.getBindingInfo_Left()), bindingInfo.getLeft());
}
if (isAccessible(EnvironmentViewsRepository.BindingInfo.Properties.right)) {
bindingInfoPart.initRight(EEFUtils.choiceOfValues(bindingInfo, EnvironmentPackage.eINSTANCE.getBindingInfo_Right()), bindingInfo.getRight());
}
if (isAccessible(EnvironmentViewsRepository.BindingInfo.Properties.description))
bindingInfoPart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, bindingInfo.getDescription()));
// init filters
// Start of user code for additional businessfilters for left
// End of user code
// Start of user code for additional businessfilters for right
// End of user code
// init values for referenced views
// init filters for referenced views
}
setInitializing(false);
}
Aggregations