blob: 13d218fbd02fb80109e802b77424ca89224c4004 [file] [log] [blame]
= Overview =
The code for this feature is provided by the plugin '''org.eclipse.papyrus.uml.diagram.clazz.lf.classtextualedition'''.
The following schema shows an overview of the implementation of the textual editor.
[[File:images/implementationOverview.png|frame|none|Overview of the implementation]]
As you can see, there are three entry points.
The first two ones concern the launch of the editor and the associated mapping Java to Javascript.
The third one concerns the conversion of the editor's content into papyrus.
= Launching the editor =
A command has been added to launch the editor. The command has been associated to the SHIFT+ENTER shorcut.
This command is implemented by the class '''handlers.ClassEditionHandler'''.
The '''execute''' method of this class will instantiate the Class '''UmlClassHTMLEditionDialog''' with the consequences to execute boitsth methods '''constructBrowserInDialog''' and '''loadHtmlPage'''. The first method creates the dialog window with an instance of a JavaFX Web Browser (WebView). The second one load all the necessary files for the web editor (inside the WebView).
= Editor launched: mapping Java to Javascript =
When all the javascript is loaded two methods of the Java Objects javascript.functions.ObjectWithFunctions will be called from the web editor: '''getAccessibleTypes''' and '''getProperties'''.
'''getAccessibleTypes''' gets all types that will be supported by the editor (and proposed during autocomplete) for properties, operations and parameters. This methods fetch all possible types and returns a list of String. For this operation, '''mapping.TypeHelper''' and '''mapping.AccessibleTypes''' will be used.
'''getProperties''' will use the class '''mapping.java2js.JsonUmlClassFromEditPart''' to construct a JSON structure equivalent to the selected UML Class. '''mapping.java2js.JsonUmlPropertyFromEditPart''' and '''mapping.java2js.JsonUmlOperationFromEditPart''' Java classes will also be used.
= Editor closed : mapping Javascript to Java =
When the web editor closes, it invokes the method '''expandIfNecessary''' of the class '''classcompartments.ClassExpander'''. This refers to accordion feature (display compartments of a UML class only if they contain something). It will look in the JSON specification of the class to see if there are properties or operations in order to display the corresponding compartment if this one is collapsed.
Next, the '''JsonUmlClassToEditPart''' class is used to map the JSON specification of the class to the the Papyrus context. In other words, translating what was described in the editor to the UML class diagram context.
= The rest of the documentation =
This page gives an overview of how the editor works. For the details, please refer to the Javadoc where each class are completely described.