Search in sources :

Example 1 with DBoundElement

use of org.obeonetwork.dsl.environment.bindingdialect.DBoundElement in project InformationSystem by ObeoNetwork.

the class BindingTreeEditor method createPartControl.

/**
 * {@inheritDoc}
 *
 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
 */
@Override
public void createPartControl(Composite parent) {
    setUpUndoRedoActionHandler();
    sashForm = new SashForm(parent, SWT.VERTICAL);
    sashForm.setSashWidth(3);
    parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    editorManager = new BindingTreeEditorManager(getEditingDomain(), accessor);
    BindingTreeSemanticSupport treeSemanticSupport = new BindingTreeSemanticSupport(getBindingInfo(), editorManager);
    treeMapper = new BindingTreeMapper(sashForm, treeSemanticSupport);
    getSite().setSelectionProvider(treeMapper);
    treeMapper.getLeftTreeViewer().addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            if (event.getSelection() instanceof StructuredSelection) {
                StructuredSelection strSelection = (StructuredSelection) event.getSelection();
                @SuppressWarnings("unchecked") Collection<DBoundElement> selectedElements = (Collection<DBoundElement>) strSelection.toList();
                populateLTRMappingDetails(selectedElements);
            }
        }
    });
    treeMapper.getRightTreeViewer().addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            if (event.getSelection() instanceof StructuredSelection) {
                StructuredSelection strSelection = (StructuredSelection) event.getSelection();
                @SuppressWarnings("unchecked") Collection<DBoundElement> selectedElements = (Collection<DBoundElement>) strSelection.toList();
                populateRTLMappingDetails(selectedElements);
            }
        }
    });
    TreeDataProvider treeDataProvider = new TreeDataProvider(getBindingInfo());
    DBoundElement left = treeDataProvider.getLeftRoot();
    DBoundElement right = treeDataProvider.getRightRoot();
    List<DBindingEdge> edges = treeDataProvider.getEdges();
    treeMapper.setInput(new TreeRoot(left), new TreeRoot(right), edges);
    createBindingGroupDetails(sashForm);
    grpDetailsLTR.setText(getBindingDetailsLabel(left, right));
    grpDetailsRTL.setText(getBindingDetailsLabel(right, left));
    sashForm.setWeights(new int[] { 70, 30 });
    // Expand the first levels on the two trees
    treeMapper.getLeftTreeViewer().expandToLevel(2);
    treeMapper.getRightTreeViewer().expandToLevel(2);
    revealBoundElements(edges);
}
Also used : ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) BindingTreeMapper(org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.BindingTreeMapper) DBindingEdge(org.obeonetwork.dsl.environment.bindingdialect.DBindingEdge) DBoundElement(org.obeonetwork.dsl.environment.bindingdialect.DBoundElement) SashForm(org.eclipse.swt.custom.SashForm) TreeDataProvider(org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.provider.TreeDataProvider) GridData(org.eclipse.swt.layout.GridData) TreeRoot(org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.TreeRoot) Collection(java.util.Collection) BindingTreeSemanticSupport(org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.BindingTreeSemanticSupport)

Example 2 with DBoundElement

use of org.obeonetwork.dsl.environment.bindingdialect.DBoundElement in project InformationSystem by ObeoNetwork.

the class BindingTreeEditor method doRefresh.

public void doRefresh() {
    TreeDataProvider treeDataProvider = new TreeDataProvider(getBindingInfo());
    DBoundElement left = treeDataProvider.getLeftRoot();
    DBoundElement right = treeDataProvider.getRightRoot();
    List<DBindingEdge> edges = treeDataProvider.getEdges();
    treeMapper.setInput(new TreeRoot(left), new TreeRoot(right), edges);
    treeMapper.refresh();
    treeMapper.getLeftTreeViewer().expandToLevel(2);
    treeMapper.getRightTreeViewer().expandToLevel(2);
}
Also used : TreeDataProvider(org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.provider.TreeDataProvider) TreeRoot(org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.TreeRoot) DBindingEdge(org.obeonetwork.dsl.environment.bindingdialect.DBindingEdge) DBoundElement(org.obeonetwork.dsl.environment.bindingdialect.DBoundElement)

Example 3 with DBoundElement

use of org.obeonetwork.dsl.environment.bindingdialect.DBoundElement in project InformationSystem by ObeoNetwork.

the class CreateMappingCommand method getGlobalPath.

private List<BoundableElement> getGlobalPath(DBoundElement boundElement) {
    List<BoundableElement> globalPath = new ArrayList<BoundableElement>();
    DBoundElement current = boundElement;
    while (current != null) {
        if (current.getTarget() instanceof BoundableElement) {
            globalPath.add((BoundableElement) current.getTarget());
        }
        current = current.getParent();
    }
    Collections.reverse(globalPath);
    return globalPath;
}
Also used : BoundableElement(org.obeonetwork.dsl.environment.BoundableElement) ArrayList(java.util.ArrayList) DBoundElement(org.obeonetwork.dsl.environment.bindingdialect.DBoundElement)

Example 4 with DBoundElement

use of org.obeonetwork.dsl.environment.bindingdialect.DBoundElement in project InformationSystem by ObeoNetwork.

the class DBoundElementContentProvider method getChildren.

public Object[] getChildren(final Object parentElement) {
    if (parentElement instanceof DBoundElement) {
        DBoundElement boundElement = (DBoundElement) parentElement;
        if (boundElement.getChildren().isEmpty()) {
            List<DBoundElement> children = new ArrayList<DBoundElement>();
            EObject[] delegatedChildren = getDelegatedChildren(boundElement.getTarget());
            for (EObject object : delegatedChildren) {
                DBoundElement childBoundElement = BindingdialectFactory.eINSTANCE.createDBoundElement();
                // bindingEditor.getBoundElements().add(childBoundElement);
                childBoundElement.setParent(boundElement);
                childBoundElement.setTarget(object);
                children.add(childBoundElement);
            }
            boundElement.getChildren().clear();
            boundElement.getChildren().addAll(children);
        }
        return boundElement.getChildren().toArray();
    }
    return null;
}
Also used : EObject(org.eclipse.emf.ecore.EObject) ArrayList(java.util.ArrayList) DBoundElement(org.obeonetwork.dsl.environment.bindingdialect.DBoundElement)

Example 5 with DBoundElement

use of org.obeonetwork.dsl.environment.bindingdialect.DBoundElement in project InformationSystem by ObeoNetwork.

the class DBindingEdgeImpl method basicSetLeft.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetLeft(DBoundElement newLeft, NotificationChain msgs) {
    DBoundElement oldLeft = left;
    left = newLeft;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, BindingdialectPackage.DBINDING_EDGE__LEFT, oldLeft, newLeft);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) DBoundElement(org.obeonetwork.dsl.environment.bindingdialect.DBoundElement)

Aggregations

DBoundElement (org.obeonetwork.dsl.environment.bindingdialect.DBoundElement)11 ArrayList (java.util.ArrayList)5 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)3 BoundableElement (org.obeonetwork.dsl.environment.BoundableElement)3 TreeRoot (org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.TreeRoot)3 DBindingEdge (org.obeonetwork.dsl.environment.bindingdialect.DBindingEdge)3 TreeDataProvider (org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.provider.TreeDataProvider)2 Collection (java.util.Collection)1 EObject (org.eclipse.emf.ecore.EObject)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 SashForm (org.eclipse.swt.custom.SashForm)1 GridData (org.eclipse.swt.layout.GridData)1 BindingElement (org.obeonetwork.dsl.environment.BindingElement)1 BindingReference (org.obeonetwork.dsl.environment.BindingReference)1 BindingTreeMapper (org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.BindingTreeMapper)1 BindingTreeSemanticSupport (org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.BindingTreeSemanticSupport)1 CreateMappingsCommand (org.obeonetwork.dsl.environment.binding.dialect.ui.treemapper.commands.CreateMappingsCommand)1