Class ComboContentAdapter

    • Constructor Detail

      • ComboContentAdapter

        public ComboContentAdapter()
    • Method Detail

      • setControlContents

        public void setControlContents​(Control control,
                                       String text,
                                       int cursorPosition)
        Description copied from interface: IControlContentAdapter
        Set the contents of the specified control to the specified text. Must not be null.
        Specified by:
        setControlContents in interface IControlContentAdapter
        Parameters:
        control - the control whose contents are to be set (replaced).
        text - the String specifying the new control content.
        cursorPosition - the zero-based index representing the desired cursor position in the control's contents after the contents are set.
      • insertControlContents

        public void insertControlContents​(Control control,
                                          String text,
                                          int cursorPosition)
        Description copied from interface: IControlContentAdapter
        Insert the specified contents into the control's current contents. Must not be null.
        Specified by:
        insertControlContents in interface IControlContentAdapter
        Parameters:
        control - the control whose contents are to be altered.
        text - the String to be inserted into the control contents.
        cursorPosition - the zero-based index representing the desired cursor position within the inserted contents after the insertion is made.
      • getCursorPosition

        public int getCursorPosition​(Control control)
        Description copied from interface: IControlContentAdapter
        Get the current cursor position in the control. The position is specified as a zero-based index into the string. Valid ranges are from 0 to N, where N is the size of the contents string. A value of N indicates that the cursor is at the end of the contents.
        Specified by:
        getCursorPosition in interface IControlContentAdapter
        Parameters:
        control - the control whose position is to be retrieved.
        Returns:
        the zero-based index representing the cursor position in the control's contents.
      • getInsertionBounds

        public Rectangle getInsertionBounds​(Control control)
        Description copied from interface: IControlContentAdapter
        Get the bounds (in pixels) of the insertion point for the control content. This is a rectangle, in coordinates relative to the control, where the insertion point is displayed. If the implementer does not have an insertion point, or cannot determine the location of the insertion point, it is appropriate to return the bounds of the entire control. This value may be used to position a content proposal popup.
        Specified by:
        getInsertionBounds in interface IControlContentAdapter
        Parameters:
        control - the control whose offset is to be retrieved.
        Returns:
        the pixel width representing the distance between the edge of the control and the insertion point.
      • setCursorPosition

        public void setCursorPosition​(Control control,
                                      int index)
        Description copied from interface: IControlContentAdapter
        Set the current cursor position in the control. The position is specified as a zero-based index into the string. Valid ranges are from 0 to N, where N is the size of the contents string. A value of N indicates that the cursor is at the end of the contents.
        Specified by:
        setCursorPosition in interface IControlContentAdapter
        Parameters:
        control - the control whose cursor position is to be set.
        index - the zero-based index representing the cursor position in the control's contents.
      • getSelection

        public Point getSelection​(Control control)
        Description copied from interface: IControlContentAdapter2
        Get the current selection range in the control. The x coordinate of the returned point is the position of the first selected character and the y coordinate of the returned point is the position of the last selected character. The positions are specified as a zero-based index into the string. Valid ranges are from 0 to N, where N is the size of the contents string. A value of N indicates that the last character is in the selection.
        Specified by:
        getSelection in interface IControlContentAdapter2
        Parameters:
        control - the control whose position is to be retrieved.
        Returns:
        a point representing the selection start and end
        Since:
        3.4
        See Also:
        IControlContentAdapter2.getSelection(org.eclipse.swt.widgets.Control)
      • setSelection

        public void setSelection​(Control control,
                                 Point range)
        Description copied from interface: IControlContentAdapter2
        Set the current selection range in the control. The x coordinate of the provided point is the position of the first selected character and the y coordinate of the point is the position of the last selected character. The positions are specified as a zero-based index into the string. Valid ranges are from 0 to N, where N is the size of the contents string. A value of N indicates that the last character is in the selection. If the x and y coordinates are the same, then there is no selection.
        Specified by:
        setSelection in interface IControlContentAdapter2
        Parameters:
        control - the control whose position is to be retrieved.
        range - a point representing the selection start and end
        Since:
        3.4
        See Also:
        IControlContentAdapter2.setSelection(org.eclipse.swt.widgets.Control, org.eclipse.swt.graphics.Point)