Class NonResizableEditPolicy

  • All Implemented Interfaces:
    IAdaptable, EditPolicy, RequestConstants
    Direct Known Subclasses:
    ResizableEditPolicy

    public class NonResizableEditPolicy
    extends SelectionHandlesEditPolicy
    Provide support for selecting and positioning a non-resizable editpart. Selection is indicated via four square handles at each corner of the editpart's figure, and a rectangular handle that outlines the editpart with a 1-pixel black line. All of these handles return DragEditPartsTrackers, which allows the current selection to be dragged.

    During feedback, a rectangle filled using XOR and outlined with dashes is drawn. Subclasses can tailor the feedback.

    • Constructor Detail

      • NonResizableEditPolicy

        public NonResizableEditPolicy()
    • Method Detail

      • createDragSourceFeedbackFigure

        protected org.eclipse.draw2d.IFigure createDragSourceFeedbackFigure()
        Creates the figure used for feedback.
        Returns:
        the new feedback figure
      • createDragHandle

        protected void createDragHandle​(java.util.List handles,
                                        int direction)
        Creates a 'resize'/'drag' handle, which uses a DragEditPartsTracker in case isDragAllowed() returns true, and a SelectEditPartTracker otherwise.
        Parameters:
        handles - The list of handles to add the resize handle to
        direction - A position constant indicating the direction to create the handle for
        Since:
        3.7
      • createMoveHandle

        protected void createMoveHandle​(java.util.List handles)
        Creates a 'move' handle, which uses a DragEditPartsTracker in case isDragAllowed() returns true, and a SelectEditPartTracker otherwise.
        Parameters:
        handles - The list of handles to add the move handle to.
        Since:
        3.7
      • eraseChangeBoundsFeedback

        protected void eraseChangeBoundsFeedback​(ChangeBoundsRequest request)
        Erases drag feedback. This method called whenever an erase feedback request is received of the appropriate type.
        Parameters:
        request - the request
      • getDragSourceFeedbackFigure

        protected org.eclipse.draw2d.IFigure getDragSourceFeedbackFigure()
        Lazily creates and returns the feedback figure used during drags.
        Returns:
        the feedback figure
      • getAlignCommand

        protected Command getAlignCommand​(AlignmentRequest request)
        Returns the command contribution to an alignment request
        Parameters:
        request - the alignment request
        Returns:
        the contribution to the alignment
      • getInitialFeedbackBounds

        protected org.eclipse.draw2d.geometry.Rectangle getInitialFeedbackBounds()
        Returns the bounds of the host's figure by reference to be used to calculate the initial location of the feedback. The returned Rectangle should not be modified. Uses handle bounds if available.
        Returns:
        the host figure's bounding Rectangle
      • getMoveCommand

        protected Command getMoveCommand​(ChangeBoundsRequest request)
        Returns the command contribution to a change bounds request. The implementation actually redispatches the request to the host's parent editpart as a RequestConstants.REQ_MOVE_CHILDREN request. The parent's contribution is returned.
        Parameters:
        request - the change bounds request
        Returns:
        the command contribution to the request
      • getOrphanCommand

        protected Command getOrphanCommand​(Request req)
        Subclasses may override to contribute to the orphan request. By default, null is returned to indicate no participation. Orphan requests are not forwarded to the host's parent here. That is done in ComponentEditPolicy. So, if the host has a component editpolicy, then the parent will already have a chance to contribute.
        Parameters:
        req - the orphan request
        Returns:
        null by default
      • isDragAllowed

        public boolean isDragAllowed()
        Returns true if this EditPolicy allows its EditPart to be dragged.
        Returns:
        true if the EditPart can be dragged.
      • setDragAllowed

        public void setDragAllowed​(boolean isDragAllowed)
        Sets the dragability of the EditPolicy to the given value. If the value is false, the EditPolicy should not allow its EditPart to be dragged.
        Parameters:
        isDragAllowed - whether or not the EditPolicy can be dragged.
      • showChangeBoundsFeedback

        protected void showChangeBoundsFeedback​(ChangeBoundsRequest request)
        Shows or updates feedback for a change bounds request.
        Parameters:
        request - the request