com.sabre.redapp.example.openeditor Sample
The com.sabre.redapp.example.openeditor sample demonstrates the following functionality:
-
Basic sidebar menu contributions
This sample has a sidebar menu, which opens a webkit view. In the view created a button that opens the editor programmatically and opens url (example http://www.sabre.com) on the editor and doesn’t maintain the persistency state as the persist indicator is set to false when programmatically opening the editor in jsHandler.java class in the example.
Running the Sample
-
In Eclipse, import the com.sabre.redapp.example.openeditor plug-in into your workspace and add it to your run configuration.
-
Launch Sabre Red 360 from your run configuration, and log in with your CERT Sabre ID.
-
From the Sidebar menu > Click Open View.
The figure below shows the sample view.
-
In the Example View, click the Open Webkit View to load URL button. This opens a new view programmatically and loads url http:\\www.sabre.com.
-
In the Example View, click the Open Webkit view to Execute Javascript button. This opens a new view programmatically and executes javascript. (write some text to the browser).
Important notice about icons
It’s very important that each icon for view / editor would be separate file with unique URL, declared in plugin.xml file. Otherwise our editors, as well as whole application, are at risk of instability.
<extension
point="org.eclipse.ui.editors">
<editor
class="com.sabre.edge.platform.optional.webkit.editors.DefaultWebkitEditor"
default="false"
icon="images/icon.png"
id="com.sabre.redapp.example.openeditor.OpenWebkitEditorUrlTest"
name="ExampleWebkitEditor">
</editor>
<editor
class="com.sabre.edge.platform.optional.webkit.editors.DefaultWebkitEditor"
default="false"
icon="images/icon_copy.png"
id="com.sabre.redapp.example.openeditor.OpenWebkitEditorJsTest"
name="ExampleWebkitEditorJS">
</editor>
</extension>