public interface IEditionService
A text editor is bound to a model element and a file, and must have one of those types:
Each editor can be set to read-only mode.
IMDAEditorListener
Modifier and Type | Method and Description |
---|---|
void |
activateEditor(IMDATextEditor editor)
Set the focus on a specific editor.
|
void |
closeEditor(IMDATextEditor editor)
Close the given text editor.
|
boolean |
createDocumentContent(Document doc)
Create a document content for the given document.
|
java.nio.file.Path |
editRichNote(Document doc,
IExternDocumentChangeListener listener)
Get a copy of the file for a given external document.
|
java.util.List<java.lang.String> |
getSupportedMimeTypes()
Indicates which mime type are supported in the current instance of Modelio.
|
java.lang.String |
html2text(java.lang.String s) |
void |
openEditor(AbstractDiagram diagram)
Open a diagram editor from an
AbstractDiagram . |
void |
openEditor(Artifact artifact)
Open an editor from an artifact.
|
void |
openEditor(Document document)
Open an editor from an extern document.
|
void |
openEditor(MatrixDefinition document)
Open an editor from a matrix.
|
IMDATextEditor |
openEditor(ModelElement modelElement,
java.io.File file,
EditorType editorTypeID,
boolean readonly)
Deprecated.
|
IMDATextEditor |
openEditor(ModelElement modelElement,
java.io.File file,
EditorType editorTypeID,
boolean readonly,
java.lang.String charsetName)
Deprecated.
|
IMDATextEditor |
openEditor(ModelElement modelElement,
java.io.File file,
EditorType editorTypeID,
boolean readonly,
java.lang.String charsetName,
java.lang.String askedTitle,
java.lang.String askedTooltip)
Open a new text editor, making the correspondence between a model element and a file.
|
void |
registerDiagramContributor(ContributorCategory category,
IWizardContributor contributor)
Register creation wizard contributor
|
void |
saveRichNote(Document doc,
java.nio.file.Path fileToSave)
Save the external document.
|
void |
setDocumentContent(Document doc,
java.nio.file.Path content)
Set a document content for the given document.
|
void |
unregisterDiagramContributor(ContributorCategory category,
IWizardContributor contributor)
Unregister creation wizard contributor
|
void |
unregisterListener(IExternDocumentChangeListener editor)
To call when an listener is not used anymore.
|
void activateEditor(IMDATextEditor editor)
editor
- the editor to focus.void closeEditor(IMDATextEditor editor)
editor
- The text editor to close.boolean createDocumentContent(Document doc) throws java.io.IOException
A default content is found by 2 ways:
ExternDocumentType
with the same MIME type.
role_name.mime_type.dat
like file
role_name.dat
like file.
doc
- The document to initializetrue
if the file was created, false if no default content could be found.java.io.IOException
- in case of error trying to create the file.java.nio.file.Path editRichNote(Document doc, IExternDocumentChangeListener listener) throws java.io.IOException
doc
- an external document.listener
- A listener fired if the original note is modified externally, by SVN for example. null
means no edition.java.io.IOException
- in case of failure.java.util.List<java.lang.String> getSupportedMimeTypes()
java.lang.String html2text(java.lang.String s)
@Deprecated IMDATextEditor openEditor(ModelElement modelElement, java.io.File file, EditorType editorTypeID, boolean readonly)
openEditor(ModelElement, File, EditorType, boolean, String, String, String)
instead.modelElement
- the model element to edit.file
- the file to display in the editor.editorTypeID
- the type of the editor to open.readonly
- true
if the editor is in read only mode.@Deprecated IMDATextEditor openEditor(ModelElement modelElement, java.io.File file, EditorType editorTypeID, boolean readonly, java.lang.String charsetName)
openEditor(ModelElement, File, EditorType, boolean, String, String, String)
instead.modelElement
- the model element to edit.file
- the file to display in the editor.editorTypeID
- the type of the editor to open.readonly
- true
if the editor is in read only mode.charsetName
- The name of a supported charset
. If null it will be the UTF-8 charset.void openEditor(AbstractDiagram diagram)
AbstractDiagram
.diagram
- the diagram to edit.void openEditor(Artifact artifact)
The file declared by the artifact must be part of the supported mime type list.
artifact
- the artifact to edit.void openEditor(Document document)
The type of the document's file must be part of the supported mime type list.
document
- the extern document to edit.IMDATextEditor openEditor(ModelElement modelElement, java.io.File file, EditorType editorTypeID, boolean readonly, java.lang.String charsetName, java.lang.String askedTitle, java.lang.String askedTooltip)
modelElement
- the model element to edit.file
- the file to display in the editor.editorTypeID
- the type of the editor to open.readonly
- true
if the editor is in read only mode.charsetName
- The name of a supported charset
. If null it will be the UTF-8 charset.askedTitle
- the tab title. If null it will be the model element name.askedTooltip
- the tab tooltip. If null it will be the file absolute path.void openEditor(MatrixDefinition document)
The type of the document's file must be part of the supported mime type list.
document
- the matrix to edit.void registerDiagramContributor(ContributorCategory category, IWizardContributor contributor)
category
- of the diagram contributorcontributor
- the diagram contributorvoid saveRichNote(Document doc, java.nio.file.Path fileToSave) throws java.io.IOException
doc
- the external document model object.fileToSave
- the external document contentjava.io.IOException
- in case of failure.void setDocumentContent(Document doc, java.nio.file.Path content) throws java.io.IOException
doc
- The document to update.content
- the content to set.java.io.IOException
- in case of error trying to set the file.void unregisterDiagramContributor(ContributorCategory category, IWizardContributor contributor)
category
- of the diagram contributorcontributor
- the diagram contributorvoid unregisterListener(IExternDocumentChangeListener editor)
editor
- the listener to unregister.