Class ContentSelection

  • All Implemented Interfaces:
    java.lang.AutoCloseable
    Direct Known Subclasses:
    ContentBlock

    public class ContentSelection
    extends java.lang.Object
    implements java.lang.AutoCloseable
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      protected void finalize()  
      @NotNull Rectangle getBox()
      Returns the box that represents the position of this selection.
      @NotNull java.util.EnumSet<ConversionState> getConversionState()
      Returns the current conversion state of this selection, as a set of ConversionState values.
      @Nullable ContentPart getPart()
      Returns the part that contains this selection.
      boolean isClosed()
      Tells whether the close() method has been called.
      boolean isValid()
      Tells whether this selection is still valid.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • isClosed

        public boolean isClosed()
        Tells whether the close() method has been called. Once an object is closed any method will throw IllegalStateException.
        Returns:
        true if this object is closed.
      • getPart

        @Nullable
        public @Nullable ContentPart getPart()
        Returns the part that contains this selection.

        Note: do not close the returned object as it is owned by another entity.

        Returns:
        the content part.
        Throws:
        java.lang.IllegalStateException - when this selection is closed.
        java.lang.IllegalStateException - when selection is invalid.
      • isValid

        public boolean isValid()
        Tells whether this selection is still valid. A selection becomes invalid when it is removed or when the currently edited part changes (see IEditorListener.partChanged(Editor).
        Returns:
        true if this selection is valid.
        Throws:
        java.lang.IllegalStateException - when this selection is closed.
      • getBox

        @NotNull
        public @NotNull Rectangle getBox()
        Returns the box that represents the position of this selection.
        Returns:
        the selection (document coordinates in mm).
        Throws:
        java.lang.IllegalStateException - when this selection is closed.
        java.lang.IllegalStateException - when selection is invalid.
      • getConversionState

        @NotNull
        public @NotNull java.util.EnumSet<ConversionState> getConversionState()
        Returns the current conversion state of this selection, as a set of ConversionState values.
        Returns:
        the conversion state of this selection.
        Throws:
        java.lang.IllegalStateException - when this selection is closed.
        java.lang.IllegalStateException - when selection is invalid.