Breadcrumb
- Sabre Red 360 Software Development Kit Help
- Desktop Red Apps
- Red App Development using WebKit Browser
- Opening Editors Programmatically from a web based Red App
Opening Editors Programmatically from a web based Red App
Sabre Red 360 Software Development Kit provides capability to open editors programmatically from any web based Red App. For this purpose there is WorkbenchUtils utility class in package com.sabre.edge.platform.core.ui.handlers .
Dependencies and classes
Below you can find a list of required dependencies and classes.
Minimal Required Dependency
-
com.sabre.edge.platform.core.ui
The following code snippet demonstrates how to open browser editor programmatically:
LauncherParams parameters = new LauncherParams.LauncherParamsBuilder(String editorId, String editorName, String pluginId)
.persist(Boolean value)
.url(String url)
.insertJavaScript(String jsString)
.additionalParams(Map <String, String> additionalParams)
.build();
new WorkbenchUtils().openBrowserEditor(String commandId, LauncherParams parameters);
LauncherParams is a utility class that will help in setting up the parameters required for opening the editor.
The required parameters are:
-
EditorId - String value, id of the editor
-
EditorName - String value, name of the editor
-
pluginId - String value, plugin id
-
Url - String value, url to load in the editor
The optional parameters are:
-
PersistInd - Boolean value, indicator to maintain the persistency of the editor
-
JsString - String value, javascript code to be executed on the editor opened
-
AdditionalParams - Map <String, String>, to send any additional key value pair data
Note
|
You still need to register your editor to the applicable editor handler in plugin.xml. Example shown below: |
<extension point="org.eclipse.ui.commands">
<command
defaultHandler="com.sabre.edge.platform.optional.webkit.handlers.FocusOrOpenWebkitEditorHandler"
id="com.sabre.redapp.example.openeditor.OpenWebkitEditorTest"
name="Open Webkit Editor Test">
<commandParameter
id="editorId"
name="editorId"
optional="true">
</commandParameter>
</command>
</extension>