ShowTable of Contents
The PlatformUI API gives you access to the Eclipse part of the Notes Client user interface: You can find out what the user is currently looking at, open new display areas for content (so called view parts) or bring existing ones to the front.
The API also contains helper classes to display message boxes and file/directory selection dialogs.
To use the PlatformUI API, call the method com.x2e.PlatformUIAPI.getUI(conn)
with a valid XPages2Eclipse connection object.
The resulting object of type IRemotePlatformUI
contains a useful helper method to write text to the Notes Client's status bar:
var conn=X2E.createConnection();
var pUI=com.x2e.PlatformUIAPI.getUI(conn);
pUI.logToStatusBar("Use the method 'logToStatusBar()' to write status and debug information");
var conn=X2E.createConnection();
var pUI=com.x2e.PlatformUIAPI.getUI(conn);
var msgBoxTools=pUI.getMessageBoxTools();
//the first parameter is a bit combination of an ICON_ constant and the button types (e.g. OK, CANCEL)
msgBoxTools.showMessageBox(2 /* ICON_INFORMATION */ | 32 /* OK */,"Title", "Information message");
For a complete reference of available message box icons and buttons, please refer to the
Clipboard API - write text, files and images to the clipboard contains a sample application which uses the file dialog tools class to let the user select a file that will then be copied to the system clipboard.
A directory selection dialog can be displayed by calling the method fdTools.showDirectoryDialog()
of the file dialog tools class:
var startPath="c:\\temp";
var selDirectoryPath=fdTools.showDirectoryDialog(String startPath, "Please select a directory to import");
if (selDirectoryPath) {
//do something with selected directory path
}
A directory selection dialog is used in the sample of the wiki article
JavaScript Jobs - Background operations developed in JavaScript: we let the user select one or more directories that will then be scanned recursively in background job developed in JavaScript. The purpose is to calculate MD5 checksums for each contained file in order to find duplicates.