Search in sources :

Example 1 with BaseEditPart

use of org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart in project webtools.sourceediting by eclipse.

the class ConnectableEditPart method activateConnection.

protected void activateConnection() {
    if (connectionFigures == null) {
        connectionFigures = new ArrayList();
    }
    for (Iterator i = getChildren().iterator(); i.hasNext(); ) {
        Object o = i.next();
        if (o instanceof BaseEditPart) {
            BaseEditPart g = (BaseEditPart) o;
            ReferenceConnection figure = createConnectionFigure(g);
            connectionFigures.add(figure);
            figure.setPoints(figure.getPoints());
            getLayer(LayerConstants.CONNECTION_LAYER).add(figure);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) BaseEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart)

Example 2 with BaseEditPart

use of org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart in project webtools.sourceediting by eclipse.

the class GraphNodeDragTracker method performAdditionalSelection.

protected void performAdditionalSelection() {
    EditPartViewer viewer = getCurrentViewer();
    // like-edit part figures from other parents, should be unselected.
    if (getCurrentInput().isShiftKeyDown()) {
        // This list contains the fields
        List list = editPart.getParent().getChildren();
        // Get the index of the current selection
        int currentIndex = list.indexOf(editPart);
        // List of all the currently selected edit parts
        List currentSelected = viewer.getSelectedEditParts();
        int size = currentSelected.size();
        if (size > 0) {
            Object lastSelected = currentSelected.get(size - 1);
            if (lastSelected instanceof BaseEditPart) {
                // Here, we determine the upper and lower limit of the indices
                int lowerIndex = -1, upperIndex = -1;
                int lastSelectedIndex = list.indexOf(lastSelected);
                if (lastSelectedIndex >= 0 && lastSelectedIndex < currentIndex) {
                    lowerIndex = lastSelectedIndex;
                    upperIndex = currentIndex;
                } else if (lastSelectedIndex >= 0 && lastSelectedIndex > currentIndex) {
                    lowerIndex = currentIndex;
                    upperIndex = lastSelectedIndex;
                }
                if (lowerIndex >= 0 && upperIndex >= 0) {
                    for (int i = lowerIndex; i < upperIndex; i++) {
                        viewer.appendSelection((EditPart) list.get(i));
                    }
                }
            }
        }
    }
}
Also used : EditPartViewer(org.eclipse.gef.EditPartViewer) BaseEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart) List(java.util.List)

Aggregations

BaseEditPart (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart)2 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 EditPartViewer (org.eclipse.gef.EditPartViewer)1