Skip to content

Commit 949b07a

Browse files
committed
Simplified the addition of popup contextual menu action for the Text page.
1 parent b29b5ba commit 949b07a

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

contributePopupActionTextPage/wsAccess.js

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
function applicationStarted(pluginWorkspaceAccess) {
22
Packages.java.lang.System.err.println("Application started " + pluginWorkspaceAccess);
3-
edChangedListener = {
4-
/*Called when a document is opened*/
5-
editorOpened: function (editorLocation) {
6-
Packages.java.lang.System.err.println("\nrunning " + editorLocation);
7-
/*Get the opened DITA Map*/
8-
editor = pluginWorkspaceAccess.getEditorAccess(editorLocation, Packages.ro.sync.exml.workspace.api.PluginWorkspace.MAIN_EDITING_AREA);
9-
textPage = editor.getCurrentPage();
10-
/*Add listener called when right click is performed in the DITA Maps manager view*/
3+
4+
/*Add listener called when right click is performed in the text page*/
115
customizerObj = {
12-
customizePopUpMenu: function (popUp, textPage) {
6+
customizeTextPopUpMenu: function (popUp, textPage) {
137
Packages.java.lang.System.err.println("RIGHT CLICK" + popUp);
148
try {
159
/*Create absolute reference*/
@@ -34,14 +28,9 @@ function applicationStarted(pluginWorkspaceAccess) {
3428
}
3529
}
3630
}
37-
38-
textPage.addPopUpMenuCustomizer(new Packages.ro.sync.exml.workspace.api.editor.page.text.TextPopupMenuCustomizer(customizerObj));
39-
}
40-
}
41-
edChangedListener = new JavaAdapter(Packages.ro.sync.exml.workspace.api.listeners.WSEditorChangeListener, edChangedListener);
42-
pluginWorkspaceAccess.addEditorChangeListener(
43-
edChangedListener,
44-
Packages.ro.sync.exml.workspace.api.PluginWorkspace.MAIN_EDITING_AREA);
31+
32+
//Add the popup menu customizer.
33+
pluginWorkspaceAccess.addMenusAndToolbarsContributorCustomizer(new JavaAdapter(Packages.ro.sync.exml.workspace.api.standalone.actions.MenusAndToolbarsContributorCustomizer, customizerObj));
4534
}
4635

4736
function applicationClosing(pluginWorkspaceAccess) {

0 commit comments

Comments
 (0)