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.

To facilitate passing parameters to the new application instance, the API enables you to override connection parameters and initialize global variable values. To launch a ZIETrans rich client application instance by clicking a button:
  1. 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.
  2. Right-click the button and select Events > widgetSelected.
  3. 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);
Note: You must enable connection parameter overriding in the Project Settings of your project to allow any overriding of connection parameters. (You must also enable global variable overriding to allow overriding global variables.) Enabling this function causes the Connection Parameters page to be visible in the properties dialog of the application. See the description of the org.eclipse.ui.propertyPages extension point in Table 3 for information on hiding Connection Parameters page using the properties dialog.