Interface WSEditor
-
- All Superinterfaces:
EditorPageConstants
,ModifiedStatusProvider
,ScenarioInvoker
,TransformationScenarioInvoker
,ValidationScenarioInvoker
,WSEditorBase
@API(type=NOT_EXTENDABLE, src=PUBLIC) public interface WSEditor extends WSEditorBase, EditorPageConstants
Provides access to methods related to the editor actions and information.- Since:
- 11.2
-
-
Field Summary
-
Fields inherited from interface ro.sync.exml.editor.EditorPageConstants
HIGHLIGHT_CLASS_DEBUGGER_CONTEXT, PAGE_AUTHOR, PAGE_DESIGN, PAGE_DITA_MAP, PAGE_GRID, PAGE_TEXT, PAGE_UNKNOWN
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addEditorListener(WSEditorListener editorListener)
Add a listener for editor related events.void
addPageChangedListener(WSEditorPageChangedListener pageChangedListener)
Add a listener for page changed events.void
addValidationProblemsFilter(ValidationProblemsFilter validationProblemsFilter)
Add a filter for problems encountered during validation of the current editor.void
changePage(java.lang.String pageID)
Change the current selected page in the editor.boolean
checkValid()
Check if the current editor is valid, performs manual validation and returnstrue
if the last validation was finished without errors or warnings.boolean
checkValid(boolean automatic)
Check if the current editor is valid, performs manual validation and returnstrue
if the last validation was finished without errors or warnings.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).java.lang.String
getContentType()
Get the content type of the editor ("text/xml" for XML, "text/css" for CSS, etc).WSEditorPage
getCurrentPage()
Get access to the current page.java.lang.String
getCurrentPageID()
Get the ID of the current page.WSEditorListener[]
getEditorListeners()
Get a list with all editor listeners, nevernull
.boolean
isEditable()
Check if the document can be edited.void
reload()
Reload this opened document from the resource from which it was originally opened.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.void
removeEditorListener(WSEditorListener editorListener)
Remove the listener for editor events.void
removePageChangedListener(WSEditorPageChangedListener pageChangedListener)
Remove the listener for page changed events.void
removeValidationProblemsFilter(ValidationProblemsFilter validationProblemsFilter)
Remove a filter for problems encountered during validation of the current editor.void
setEditable(boolean editable)
Sets the specified flag to indicate whether or not this opened editor should be editable.-
Methods inherited from interface ro.sync.exml.workspace.api.base.ModifiedStatusProvider
isModified
-
Methods inherited from interface ro.sync.exml.workspace.api.editor.transformation.TransformationScenarioInvoker
runTransformationScenario, runTransformationScenarios, stopCurrentTransformationScenario
-
Methods inherited from interface ro.sync.exml.workspace.api.editor.validation.ValidationScenarioInvoker
runValidationScenarios
-
Methods inherited from interface ro.sync.exml.workspace.api.editor.WSEditorBase
close, createContentInputStream, createContentReader, getDocumentTypeInformation, getEditorLocation, getEncodingForSerialization, isNewDocument, reloadContent, reloadContent, save, saveAs, setEditorTabText, setEditorTabTooltipText, setModified
-
-
-
-
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 ofWSTextEditorPage
. If the Text page is for an XML Editor, this return an implementation ofWSXMLTextEditorPage
.
For the Author page this return an implementation ofWSAuthorEditorPage
.
Note that in Reviewer edition only the Author page is available.
-
getCurrentPageID
java.lang.String getCurrentPageID()
Get the ID of the current page.- Returns:
- The ID of the page, one of the constant fields:
EditorPageConstants.PAGE_TEXT
,EditorPageConstants.PAGE_AUTHOR
,EditorPageConstants.PAGE_GRID
,EditorPageConstants.PAGE_DESIGN
,EditorPageConstants.PAGE_DITA_MAP
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, nevernull
.- 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
-
changePage
void changePage(java.lang.String pageID)
Change the current selected page in the editor. This does not affect editors opened in the DITA Maps Manager. If problems occur during the page switch or the page ID is not recognized the page will be switched to Text and the operation is aborted.
Note that in Reviewer edition only the Author page is available.- Parameters:
pageID
- The ID of the page, one of the constant fields:EditorPageConstants.PAGE_TEXT
,EditorPageConstants.PAGE_AUTHOR
,EditorPageConstants.PAGE_GRID
,EditorPageConstants.PAGE_DESIGN
- 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 returnstrue
if the last validation was finished without errors or warnings. For document types which do not support validation, this returns alwaystrue
. If you want to see the problems reported by the validation process you can add a validation problems filteraddValidationProblemsFilter(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 returnstrue
if the last validation was finished without errors or warnings. For document types which do not support validation, this returns alwaystrue
. If you want to see the problems reported by the validation process you can add a validation problems filteraddValidationProblemsFilter(ValidationProblemsFilter)
.- Parameters:
automatic
-true
If Oxygen performs automatic validation (identical with the validation performed when the document is modified) orfalse
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 thesetEditable(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.
-
-