Programmatically starting an instance of an application
The Applications view is provided by default on the Host Access perspective so that your end users can start new instances of their ZIETrans rich client applications. An API is provided to enable you to programmatically launch a new instance of a ZIETrans rich client application. This is useful if you have elected to not show the Applications view in your perspective; however, you want to provide a way to launch an application from the perspective or to programmatically launch an application instance from another view. For example, you might have a ZIETrans application to collect data from one host system, launch a new instance of another ZIETrans application, and pass the data to the new instance.
- Add an SWT Button from the Window Builder Palette or to the parent composite or transformation. You can also use standard SWT programming to add a button and the widgetSelected() code. For more information, see Editing transformations.
- Right-click the button and select Events > widgetSelected.
- Replace the sample placeholder code in the
widgetSelected(SelectionEvent)
method with the following code:
String applicationId = "myApplication";
Properties initParams = new Properties();
initParams.setProperty(com.ibm.eNetwork.beans.HOD.Session.HOST, "129.12.11.2");
initParams.setProperty(com.ibm.eNetwork.beans.HOD.Session.PORT, "623");
initParams.setProperty("hatsgv_userName", "some user");
initParams.setProperty("hatsgv_password", "xxxxx");
initParams.setProperty("hatssharedgv_someVariable", "zzzzz");
ViewInitInfo viewInitInfo = new ViewInitInfo(true, initParams);
RcpUiUtils.launchView(PlatformUI.getWorkbench().getActiveWorkbenchWindow().
getActivePage(), applicationId, viewInitInfo);