Interface WSEditor

    • Method Detail

      • getCurrentPage

        WSEditorPage getCurrentPage()
        Get access to the current page.
        Returns:
        the current page access. Can be null for pages which do not have special access methods (for example Grid or Design).
        For the Text page this return an implementation of WSTextEditorPage. If the Text page is for an XML Editor, this return an implementation of WSXMLTextEditorPage.
        For the Author page this return an implementation of WSAuthorEditorPage.

        Note that in Reviewer edition only the Author page is available.
      • addPageChangedListener

        void addPageChangedListener​(WSEditorPageChangedListener pageChangedListener)
        Add a listener for page changed events.
        Parameters:
        pageChangedListener - The page changed listener.

        Note that in Reviewer edition only the Author page is available.
        Since:
        12
      • removePageChangedListener

        void removePageChangedListener​(WSEditorPageChangedListener pageChangedListener)
        Remove the listener for page changed events.
        Parameters:
        pageChangedListener - The page changed listener.

        Note that in Reviewer edition only the Author page is available.
        Since:
        12
      • addEditorListener

        void addEditorListener​(WSEditorListener editorListener)
        Add a listener for editor related events.
        Parameters:
        editorListener - The editor listener.
        Since:
        13
      • getEditorListeners

        WSEditorListener[] getEditorListeners()
        Get a list with all editor listeners, never null.
        Returns:
        a list with all registered editor listeners, never null.
        Since:
        16
      • removeEditorListener

        void removeEditorListener​(WSEditorListener editorListener)
        Remove the listener for editor events.
        Parameters:
        editorListener - The editor listener.
        Since:
        13
      • addValidationProblemsFilter

        void addValidationProblemsFilter​(ValidationProblemsFilter validationProblemsFilter)
        Add a filter for problems encountered during validation of the current editor. Validation can be manual or automatic. Automatic validation is done when modifications occur in the XML file.
        Parameters:
        validationProblemsFilter - a filter for problems encountered during validation of the current editor.
        Since:
        13
      • removeValidationProblemsFilter

        void removeValidationProblemsFilter​(ValidationProblemsFilter validationProblemsFilter)
        Remove a filter for problems encountered during validation of the current editor. Validation can be manual or automatic. Automatic validation is done when modifications occur in the XML file.
        Parameters:
        validationProblemsFilter - a filter for problems encountered during validation of the current editor.
        Since:
        13
      • checkValid

        boolean checkValid()
        Check if the current editor is valid, performs manual validation and returns true if the last validation was finished without errors or warnings. For document types which do not support validation, this returns always true. If you want to see the problems reported by the validation process you can add a validation problems filter addValidationProblemsFilter(ValidationProblemsFilter).
        Returns:
        true if right now no error is reported on the editor content.
        Since:
        17.1
      • checkValid

        boolean checkValid​(boolean automatic)
        Check if the current editor is valid, performs manual validation and returns true if the last validation was finished without errors or warnings. For document types which do not support validation, this returns always true. If you want to see the problems reported by the validation process you can add a validation problems filter addValidationProblemsFilter(ValidationProblemsFilter).
        Parameters:
        automatic - true If Oxygen performs automatic validation (identical with the validation performed when the document is modified) or false if Oxygen should perform manual validation (identical to the validation made when you press the Validate toolbar action).
        Returns:
        true if right now no error is reported on the editor content.
        Since:
        18
      • getComponent

        java.lang.Object getComponent()
        Get the internal component (Swing or SWT based) which represents the editor (the editor in its turn has multiple pages, each with its subcomponent). Use of this method is discouraged but it may be useful in some cases like: This can be helpful when you want to set a busy cursor on the entire editor or when you want to get access to the swing JTabbedPane pane where the editor is located.
        Returns:
        for the stand alone version, a javax.swing.JPanel and for the eclipse implementation of org.eclipse.ui.part.EditorPart.
        Since:
        17.1
      • setEditable

        void setEditable​(boolean editable)
        Sets the specified flag to indicate whether or not this opened editor should be editable. This method is not available in the Oxygen Eclipse plugin which relies on the IEditorInput for the information.
        Parameters:
        editable - true if the editor should be editable.
        Since:
        18
      • isEditable

        boolean isEditable()
        Check if the document can be edited. A document can be set as read-only from API, by using the setEditable(boolean) method.
        Returns:
        true if the document is editable.
        Since:
        18
      • getContentType

        java.lang.String getContentType()
        Get the content type of the editor ("text/xml" for XML, "text/css" for CSS, etc).
        Returns:
        the content type. Never null.
        Since:
        22
      • reloadIfChangeOnDiskDetected

        void reloadIfChangeOnDiskDetected()
        If the opened file is local, this method compares the current file timestamp with the previous file timestamp from when the document was opened. If the timestamps differ the document will be reloaded or the user will be asked if the document contains unsaved modifications.
        This method is implemented only for the desktop version of the application.
        Since:
        26.1

        *********************************
        EXPERIMENTAL - Subject to change
        ********************************

        Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.

      • reload

        void reload()
        Reload this opened document from the resource from which it was originally opened. If the document contains unsaved changes, the end user is asked if they want to continue the reload and lose the modifications.
        This method is implemented only for the desktop version of the application.
        Since:
        26.1

        *********************************
        EXPERIMENTAL - Subject to change
        ********************************

        Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.