A perspective defines the initial layout of views in an Eclipse workbench window. Each perspective provides a set of functions for accomplishing a specific type of task, or works with specific types of resources. For example, the Java™ perspective combines views commonly used while editing Java source files, and the Debug perspective contains the views for debugging Java programs.
Perspectives control what appears in certain menus and toolbars. Perspectives also define visible action sets, which you can change to customize a perspective. You can save a perspective that you build this way, making a custom perspective that you can open again later.
A default perspective class, hostaccess.perspectives.MainPerspective, has been provided for you in the com.ibm.hats.rcp.runtime.extension plug-in project. This class extends from the HATS com.ibm.hats.rcp.ui.Perspective class and implements the Eclipse perspective interface, org.eclipse.ui.IPerspectiveFactory. The default title for this perspective is Host Access, although you can change the title by modifying the plugin_en.properties file in the com.ibm.hats.rcp.runtime.extension plug-in project.
Table 5 lists the methods that can be overridden in your perspective class.
| Method | Description |
|---|---|
| addApplicationsView(IPageLayout) | Adds the HATS applications view to the perspective. |
| createTransformationViewsPlaceholder(IPageLayout) | Creates a placeholder for the HATS transformation views. |
| createPrintJobViewsPlaceholder(IPageLayout)</code> | Creates the placeholder area for the 3270 and 5250 print jobs view. |
| addPrintActionsSet(IPageLayout)</code> | Adds the print action set (defined in the plugin.xml of the com.ibm.hats.rcp.rntime.extension plug-in) to the perspective. |
To change the default perspective first opened by the Host Access runtime application, edit the HostAccessWorkbenchAdvisor source file in com.ibm.hats.rcp.runtime.extension plug-in project, and change the PERSPECTIVE_ID to your custom perspective ID. See HostAccessWorkbenchAdvisor for more information about the Host Access perspective.
The following is an example showing how the Host Access perspective is registered in the plug-in descriptor for com.ibm.hats.rcp.runtime.extension:
<extension
point="org.eclipse.ui.perspectives">
<perspective
name="%PERSPECTIVE_TITLE"
icon="images/applications_view.gif"
class="hostaccess.perspectives.MainPerspective"
id="hostaccess.perspectives.main">
</perspective>
</extension>
You are not required to use the Host Access perspective, although it provides your end users with easy access to the HATS applications you have provided them. You can use the Host Access perspective as a starting point, or start from scratch and develop a perspective that better fits the needs of your users.
By default, the Host Access perspective includes the Applications view. See Applications view for more information on this view.
See the Javadoc API for more information on the com.ibm.hats.rcp.ui.Perspective class
The Applications view (com.ibm.hats.rcp.ui.views.ApplicationsView) is registered in the com.ibm.hats.rcp.runtime.extension plug-in. This view provides users access to the HATS rich client applications installed in the client environment. Users can also configure properties for an application by launching the Properties dialog from this view.
See Applications view in the User's and Administrator's Guide for more information on how to use this view.
The Applications view is provided by default on the Host Access perspective so that your end users can start new instances of their HATS rich client applications. An API is provided to enable you to programmatically launch a new instance of a HATS 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 HATS application to collect data from one host system, launch a new instance of another HATS 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 HATS rich client application instance by clicking a button:
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);
A view is a visual component of an Eclipse perspective that displays information to a user. For more information on perspectives, see The Host Access perspective. Each HATS rich client application contributes a view, which extends from the base com.ibm.hats.rcp.ui.views.TransformationView class, to the Eclipse environment it is running in. The transformation view is used by a user to interact with a HATS rich client application.
Table 6 lists the methods of your application's transformation view class can be overridden.
| Method | Description |
|---|---|
| createViewActions() | Creates actions for the view's menu.
Note:
After actions
are created, they must then be registered. See Extending the transformation view's menu for
more information. |
| createKeyboardActions() | Creates keyboard action classes for all known
HATS keyboard functions registered in the plugin.xml of the com.ibm.hats.rcp.runtime.extension
plug-in project. Once keyboard actions are created, each is registered
with the IKeyBindingService of the workbench window by the registerKeyboardActions()
method.
Note:
See the User's
and Administrator's Guide for information about the createKeyboardActions() method
and how to add keyboard support for other keys. |
| getApplicationKeypadDisplayInfo() | Controls which buttons to display in the application keypad area of the view's toolbar. By default, the application's settings are read to determine what keys to display. You can override this method in your transformation view class if you need to calculate what is displayed. This method has no affect if the view's toolbar is hidden. |
| getHostKeypadDisplayInfo() | Controls which keys to display in the host keypad area of the view, and indicates how the keys are displayed. By default, the application's settings are read to determine which keys to display. You can override this method in your transformation view class if you need to calculate what is displayed. |
| getOiaDisplayInfo() | Indicates what information to display in the OIA of the transformation view. By default, the application's settings are read to determine what to display. You can override this method in your transformation view class if you need to calculate what is displayed. |
| getToolbarDisplayInfo() | Indicates whether the view's toolbar is displayed. If displayed, this method also indicates how buttons are rendered on the toolbar. By default, the application's settings are read to determine how the toolbar is presented. You can override this method in your transformation view class. |
| shouldAutoStart() | Indicates whether the application should connect automatically when this view is opened. |
See the HATS Rich Client API Reference for more information on these methods.
The following code sample shows how to extend your transformation view's menu. In the sample, a disconnect menu item is added which, when clicked, causes the host connection to be disconnected and the disconnect and stop events of the application to be run. You should only add actions to the view's menu that are applicable during the entire lifecycle of the view.
Follow these steps to extend the menu of your transformation view class (the Java source file for this class is located in the <project name>.views package of your project):
private com.ibm.hats.rcp.ui.actions.DisconnectAction disconnectAction;
protected void createViewActions() {
super.createViewActions();
//create an action and append the action to the view's menu.
disconnectAction = new DisconnectAction("Disconnect",getSessionService());
getViewSite().getActionBars().getMenuManager().add(new Separator());
getViewSite().getActionBars().getMenuManager().add(disconnectAction);
}protected void updateViewActions() {
super.updateViewActions();
//enable the action based on the session state.
disconnectAction.setEnabled(getSessionService().getSessionServiceState().
isOperational());
}After adding the Disconnect action, when you click the menu button in the transformation view, you can see Disconnect on the menu:
