Interface WSEditorBase

    • Method Detail

      • getEncodingForSerialization

        java.lang.String getEncodingForSerialization()
        Get the Java character encoding of this editor's content.

        In Eclipse, this method will return the encoding detected when opening the editor, and it will not be aware of encoding changes until the editor is re-opened.
        Returns:
        the Java encoding of the content. May be null if couldn't be detected.
        Since:
        19.1
      • getEditorLocation

        java.net.URL getEditorLocation()
        Get the URL representing the editor location.
        Returns:
        The editor location. It cannot be null.
      • save

        void save()
        Saves the editor content.
      • saveAs

        void saveAs​(java.net.URL location)
        Saves the editor content to a new location. This method is not implemented in the Oxygen Eclipse plugin.
        Parameters:
        location - The new editor location.
        Since:
        13
      • close

        boolean close​(boolean askForSave)
        Closes the current editor.

        If the editor has unsaved content and askForSave is true, the user will be given the opportunity to save it.

        Parameters:
        askForSave - true to save the editor contents if required, and false to discard any unsaved changes.
        Returns:
        true if the editor was successfully closed, and false if the editor is still open
      • setModified

        void setModified​(boolean modified)
        Set the modified status of the editor document.

        For SWT the result of this method is guaranteed only when working exclusively with the author page. If the text page contains modifications (and is marked as dirty) this method is unable to change its state to unmodified.

        For Web Author, can be used to mark the document as clean and to make sure that the clean state is properly identified after a series of undo/redo operations. This method has some limitations:

        • It does not automatically update the client-side editor dirty status.
        • It does nothing if invoked during a "compound edit" (see AuthorDocumentController.beginCompoundEdit()). Note that a "compound edit" is created automatically when invoking an AuthorOperation that does not extend AuthorOperationWithCustomUndoBehavior.
        • it does nothing if invoked with false.
        Parameters:
        modified - true if the document in the current editor contains unsaved modifications.
      • isNewDocument

        boolean isNewDocument()
        This method can be used to determine if the document from the editor was ever saved.
        Returns:
        true if the document in the current editor is new.
      • createContentReader

        java.io.Reader createContentReader()
        Create a reader over the whole editor's content (exactly the XML content which gets saved on disk). The unsaved changes are included. If for the Author page change tracking highlights are present, they are also included as processing instructions.
        Returns:
        The content reader.In normal circumstances the reader should not be null.
        See Also:
        for the processing instruction names
      • createContentInputStream

        java.io.InputStream createContentInputStream()
                                              throws java.io.IOException
        Create a properly encoded input stream reader over the whole editor's content (exactly the XML content which gets saved on disk). The unsaved changes are included. If for the Author page change tracking highlights are present, they are also included as processing instructions.
        Returns:
        An input stream over the XML contents.In normal circumstances the input stream should not be null.
        Throws:
        java.io.IOException - If an I/O exception occurs.
        Since:
        15.2
        See Also:
        for the processing instruction names
      • reloadContent

        void reloadContent​(java.io.Reader reader)
        Update the whole content of the editor with the one taken from the reader. This will lose undo history and any modifications the editor may have.
        Parameters:
        reader - The reader provided by the extension.
      • reloadContent

        void reloadContent​(java.io.Reader reader,
                           boolean discardUndoableEdits)
        Update the whole content of the editor with the one taken from the reader. This will lose any modifications the editor may have unless discardUndoableEdits is false in which case you will be able to UNDO the editor to the content prior to the reload.
        Parameters:
        reader - The reader provided by the extension.
        discardUndoableEdits - true to lose undo history.
        Since:
        13.2
      • setEditorTabText

        void setEditorTabText​(java.lang.String tabText)
        Set the text which appears on the editor's tab, by default it is the loaded file name. Set it with the value NULL to reset the tab title to the default value (the loaded file name).
        Parameters:
        tabText - the text which appears on the editor's tab, by default it is the loaded file name. NULL to reset the tab title to the default value (the loaded file name).
        Since:
        12.1
      • setEditorTabTooltipText

        void setEditorTabTooltipText​(java.lang.String tabTooltip)
        Set the tooltip text for the editor's tab, by default it is the loaded file path. Set it with the value NULL to reset the tab title to the default value (the loaded file path).
        Parameters:
        tabTooltip - the tooltip for the editor's tab, by default it is the loaded file path. NULL to reset the tab tooltip to the default value (the loaded file path).
        Since:
        12.1
      • getDocumentTypeInformation

        DocumentTypeInformation getDocumentTypeInformation()
        Get information about the current document type configuration used to edit the XML document.
        Returns:
        information about the current document type configuration used to edit the XML document or null if no document type configuration is matched or the editor does not have an XML content type.
        Since:
        16.1