One of the frequent questions we receive from customers is "How can I customize the CICS Explorer GUI, for instance by removing items that confuse my internal users?"
While removing GUI items is not something we provide support for, because CICS Explorer is built on top of Eclipse technology there is an Eclipse technique you can use to hide some elements of the GUI.
In this blog post I'll walk you through some using an activity to hide a GUI item, techniques for establishing whether a GUI item might be hideable, and how to deploy this into a CICS Explorer instance.
A bit of information you need to know
Firstly - understanding when to hide an item is important. You'll know from Isabel's blog post about using CMCI (https://www.ibm.com/developerworks/community/blogs/cicsdev/entry/the_cmci_restful_api_part_1_talk_to_cics_using_the_browser?lang=en) that pretty much anything that can be done in CICS Explorer can also be done using a browser and a bit of searching. This means that hiding an item to prevent users from using it is not secure - if their user ID has sufficient permissions then they could just call CMCI directly. You must have your security, including RACF, set up correctly.
Secondly - as part of this technique you'll be looking up internal action IDs for actions provided by CICS Explorer (and maybe Eclipse too!). These IDs might change in future releases. You'll want to incorporate a quick test that things have remained hidden, as part of your CICS Explorer acceptance tests.
What we'll be doing
The broad overview is like this.
- We'll find the action ID of an action that is being contributed to the CICS Explorer GUI
- We'll create a new plugin that declares an activity. This activity will refer to the action ID and hide it
- We'll create a feature to contain the new plugin, and deploy it into a CICS Explorer instance
Finding action IDs
It's not possible to hide every GUI element - it depends how they were contributed. Most of the context menus on CICS resources should be possible, though. I'll go through the example of the Region shutdown options.
Finding IDs through the GUI
The simplest way of finding the action ID is using a tool called plugin spy. It's part of Eclipse and included with CICS Explorer by default. Open CICS Explorer, connect to a plex and open the Regions view.
To use plugin spy, press Alt+Shift+F2 - you'll see the cursor change to an icon of a document with a magnifying glass. The next time you click on a menu, a window will pop up giving you information about that menu option.
So - you have the Regions view open. Press Alt+Shift+F2 (you'll see the cursor change to a document with a magnifying glass) and right-click on a Region in the Regions view, choose Shutdown and Normal.
Next you'll see the Plugin spy window pop up.
This gives you some information about the selection. We're interested in the action ID - com.ibm.cics.core.ui.editors.region.shutdown.normal. This is the action ID that we need, to prevent the normal shutdown option from appearing on a Region resource.
Finding IDs from the plugin files
Most of the CICS Explorer context menus on resources are currently (CICS Explorer 5.2!) declared in an XML file. In your CICS Explorer installations, find the plugins directory and look for the com.ibm.cics.core.ui.editors jar file. In it, open the plugin.xml file. If you search for "com.ibm.cics.core.ui.editors.region.shutdown.normal" you'll see how we declare the normal shutdown option, and adjacent are the other shutdown options, so we have:
Creating an activity to hide some actions
To create an activity, we must create a plug-in project. A plug-in project can be installed into an Eclipse application like CICS Explorer and contributes to its behaviour at runtime. CICS Explorer itself is just a collection of plug-in projects!
Create a plug-in project using File > New > Other... - "Plug-in Project" will be near the top of the list. Choose Next and give the project a name - perhaps "FilterMenus".
Click Next through to the Templates page. Choose the template "Plug-in with a popup menu" and Finish. Answer yes when you're prompted to switch to the plug-in perspective.
From the Package Explorer, the view on the far left, double-click on plugin.xml to open the plugin metadata editor. Choose the plugin.xml tab (near the far right)
Replace the text in this editor with the following, and save the editor:
<?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.4"?> <plugin> <extension point="org.eclipse.ui.activities"> <category name="Filter actions category" id="actions.exclude.category" /> <categoryActivityBinding activityId="actions.exclude" categoryId="actions.exclude.category" /> <activity name="Exclude actions" description="Exclude actions" id="actions.exclude" /> <activityPatternBinding activityId="actions.exclude" pattern=".*/com\.ibm\.cics\.core\.ui\.editors\.region\.shutdown\..*"> </activityPatternBinding> </extension> </plugin>
This XML declares an extension to the Eclipse activities extension point. It defines a category and an activity, binds the activity to the category, and sets up an activityPatternBinding which contains a regular expression pattern defining the items to be excluded. You can find more information about activities, and how you might make refer to an ID without using a regular expression, in the Eclipse documentation (http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fworkbench_advext_activities.htm).
Testing that our new plug-in works
It's always good to test some code once you've written it! Right-click on the plug-in you created in the Package Explorer
Choose Run As > Eclipse Application. This will start up a *new* copy of CICS Explorer with your plug-in installed, for testing. Make a connection, find the Regions view, and check that Shutdown no longer appears in the context menu.
Deploying the plug-in to our users
The final step is to package the plug-in so that other users can install it into their CICS Explorer instances. To do this you must create a feature containing the plug-in, and export. Have a look at the previous "Extending CICS Explorer" blog post for a full description, in the section "Deploying the new perspective to our users".
For more ideas or background, see the Eclipse infocenter I previously linked to: http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fworkbench_advext_activities.htm
Also, Lars Vogel has a more general description of activities than I provide in this blog post: http://blog.vogella.com/2009/07/13/eclipse-activities/
Thanks for reading!
CICS Explorer development