Interface WSEditorBase
- All Superinterfaces:
ModifiedStatusProvider
,ScenarioInvoker
,TransformationScenarioInvoker
,ValidationScenarioInvoker
- All Known Subinterfaces:
AuthorEditorAccess
,IWebappAuthorEditorAccess
,WSEditor
@API(type=NOT_EXTENDABLE,
src=PUBLIC)
public interface WSEditorBase
extends ModifiedStatusProvider, ScenarioInvoker
Provides access to methods related to the editor actions and information.
- Since:
- 11.2
-
Method Summary
Modifier and TypeMethodDescriptionboolean
close
(boolean askForSave) Closes the current editor.Create a properly encoded input stream reader over the whole editor's content (exactly the XML content which gets saved on disk).Create a reader over the whole editor's content (exactly the XML content which gets saved on disk).Get information about the current document type configuration used to edit the XML document.Get theURL
representing the editor location.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.boolean
This method can be used to determine if the document from the editor was ever saved.void
reloadContent
(Reader reader) Update the whole content of the editor with the one taken from the reader.void
reloadContent
(Reader reader, boolean discardUndoableEdits) Update the whole content of the editor with the one taken from the reader.void
save()
Saves the editor content.void
Saves the editor content to a new location.void
setEditorTabText
(String tabText) Set the text which appears on the editor's tab, by default it is the loaded file name.void
setEditorTabTooltipText
(String tabTooltip) Set the tooltip text for the editor's tab, by default it is the loaded file path.void
setModified
(boolean modified) Set the modified status of the editor document.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
-
Method Details
-
getEncodingForSerialization
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
URL getEditorLocation()Get theURL
representing the editor location.- Returns:
- The editor location. It cannot be
null
.
-
save
void save()Saves the editor content. -
saveAs
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
istrue
, the user will be given the opportunity to save it.- Parameters:
askForSave
-true
to save the editor contents if required, andfalse
to discard any unsaved changes.- Returns:
true
if the editor was successfully closed, andfalse
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
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
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:
IOException
- If an I/O exception occurs.- Since:
- 15.2
- See Also:
-
for the processing instruction names
-
reloadContent
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
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 isfalse
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
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
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
-