ShowTable of Contents
XPages2Eclipse control in DDE
After you have successfully installed the XPages2Eclipse product in your Lotus Notes/Domino environment, a new control shows up in the control palette of the XPages editor in Domino Designer (DDE):
To use XPages2Eclipse functionality in an XPages of your application, simply drag this control to the XPage. The first time you do this, you will see this prompt that you need to confirm:
API access from server-side JavaScript (SSJS)
To open a connection to the API and call a test method, add this code snippet to server-side JavaScript (SSJS) code, e.g. in the onClick event of a button:
var conn=X2E.createConnection();
var platformUI=x2e.PlatformUIAPI.getUI(conn);
platformUI.logToStatusBar("Hello World!");
The method createConnection
creates a new API connection that is only valid for the current XPages page request. The connection is automatically disposed and it is the entry point for any API method calls.
Line 2 of our snippet accesses the first API that we will get to know: PlatformUI. This API corresponds to the Eclipse API class with the same name, with some functionality modified, added and removed to make it compatible with usable from an XPages application.
logToStatusBar
is not actually part of the Eclipse version of PlatformUI, but was added to quickly write some status and debug information to the Notes Client status bar (which would be much more difficult when using Eclipse API directly).
API access from Java
If you prefer to write the backend code of your XPage in Java instead of SSJS, the syntax is quite similar:
package com.mindoo.x2esamples.helloworld;
import com.mindoo.remote.api.IRemoteEclipseConnection;
import com.mindoo.remote.api.RemoteEclipseAPIException;
import com.mindoo.remote.api.org.eclipse.ui.IRemotePlatformUI;
import com.mindoo.xpages2eclipse.X2E;
public class HelloWorld {
public void doCallAPI(String username) throws RemoteEclipseAPIException {
IRemoteEclipseConnection conn=X2E.createConnection();
IRemotePlatformUI platformUI=x2e.PlatformUIAPI.getUI(conn);
platformUI.logToStatusBar("Java: Hello "+username+"! How are you?");
}
}
Full API class reference
Please refer to the following articles for a complete Javadoc reference of the API classes for XPages2Eclipse and Add-on packages:
XPages2Eclipse Base API Javadocs