Demonstration 1 – Creating a view and
using a selection listener
Sample code
The first sample project creates a new view in the CICS Explorer, and populates it using a selection listener. The code is included in the following compressed file. See the Introduction topic for instructions on installing the project in your Eclipse environment. demo1-view.project_code.zip
About the Demo1 sample project
The sample class com.ibm.cics.explorer.sdk.demo1.views.DemoView1 is
included in the sample plug-in com.ibm.cics.explorer.sdk.demo1. This uses the org.eclipse.ui.views extension to declare a view that
listens to workbench selection and, if a CICS region is selected, shows a
selection of its attributes in a table. The purpose is to show the notification
mechanism whereby objects selected in CICS Explorer views are propagated around
the workbench.
The interfaces making up the CICS Explorer API for CICS objects are in
the package com.ibm.cics.model. The Demo1View class
imports the interface com.ibm.cics.model.IRegion and
adds a selection listener to the view site, checking, whenever a selection
event occurs, whether the object is an IRegion
instance and, if so, retrieving attributes through the public methods to create
an item to add to the tree.
The first three columns in the table show data retrieved from the region
through public getter methods, while the fourth column is a derived value
showing the variation in the number of total tasks if the region that was
selected it the same as the previous one. This could form the basis for the
beginning of an application to see workload throughput over time.
To open the view
include the plug-in com.ibm.cics.explorer.sdk.demo1 in your launch
configuration's list of plug-ins and open the view using Window>Show View
selecting Sample Category and Sample View.
A video of this demo (with some minor variations) is available at :
http://www.youtube.com/watch?v=DtcXuYaDyJ4&feature=channel_page