Hiding GUI elements

You can hide elements in the CICS Explorer GUI and deploy the change to your enterprise, to prevent end users from using those GUI items unintentionally. The example shows how to hide the Region shutdown options from the right-click menu by using an activity.

About the task

Eclipse provides extension support for hiding GUI elements, but it does not remove the corresponding functionality. That means given sufficient permission, users can still use the functionality by calling CMCI directly. Therefore, hiding an item to prevent users from using the service is not secure; in this case, you need to have your security, including RACF, set up correctly.

To hide a GUI element, you need to identify its action ID that is provided by CICS Explorer or Eclipse. These IDs might change in future releases, so it's important to incorporate a quick test to ensure they remain hidden, as part of your CICS Explorer acceptance tests.

The following steps are covered:
  1. Find the action ID of an action that is contributed to the CICS Explorer GUI
  2. Create a new plug-in project that declares an activity. This activity will refer to the action ID and hide it.
  3. Create a feature project to contain the new plug-in and deploy it into other CICS Explorer instances.

Procedure

Finding action IDs
It's not possible to hide every GUI element – it depends on how they are contributed. However, most of the context menus on CICS resources are possible. This example shows how to find the action IDs of the Region shutdown options. Find action IDs in either of the following ways:
  • Finding action IDs through the GUI:

    The simplest way of finding action IDs is using the plug-in spy. It's part of Eclipse and included with CICS Explorer by default.

    1. Start CICS Explorer, connect to CICS and open the Regions view.
    2. Press Alt+Shift+F2 to use the plug-in spy. You can see the cursor changes to a document with a magnifying glass.
    3. Right-click a region in the Regions view, and select Shutdown > Normally. A window then pops up showing information about that menu option.
      Selecting Shutdown and Normally
      Plug-in Menu Spy window
      The active contribution item identifier (com.ibm.cics.core.ui.editors.region.shutdown.normal) is the action ID of the selected option (normal shutdown). You can find action IDs for other shutdown options using this approach.
  • Finding IDs from the plug-in files:

    Most of the CICS Explorer context menus on resources are declared in an xml file.

    1. In your CICS Explorer installations, find the plug-ins directory and look for the com.ibm.cics.core.ui.editors jar file.
    2. In the jar file, open the plugin.xml file.
    3. Search for com.ibm.cics.core.ui.editors.region.shutdown.normal and you can see how the normal shutdown option is declared. Adjacent to it are the other shutdown options, so the action IDs of all the shutdown options are:
      • com.ibm.cics.core.ui.editors.region.shutdown.normal
      • com.ibm.cics.core.ui.editors.region.shutdown.immediate
      • com.ibm.cics.core.ui.editors.region.shutdown.takeover
Creating an activity to hide actions

To create an activity, you must create a plug-in project. A plug-in project can be installed into an Eclipse application such as CICS Explorer and contributes to its behavior at runtime.

  1. To create a plug-in project, click File > New > Other and select Plug-in Project wizard.
  2. In the wizard, give the project a name, in this case, "FilterMenus".
  3. Click Next through to the Templates page.
  4. Choose the template Plug-in with a popup menu and click Finish. Choose Yes when you are prompted to switch to the plug-in associated perspective.
  5. Navigate to the Package Explorer view, double-click the plugin.xml file of the plug-in project to open the it in an editor.

    Click the plugin.xml tab, replace the text in the editor with the following snippet, 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 snippet 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.

Testing the new plug-in
  1. Right-click the plug-in you created in the Package Explorer view.
    Plug-in in Package Explorer view
  2. Choose Run As > Eclipse Application. This starts up another copy of CICS Explorer with your plug-in installed, for testing.
  3. In the new copy of CICS Explorer, you can make a connection, navigate to the Regions view, and check that the Shutdown option no longer appears in the context menu.
Deploying the plug-in to end users

You can package the plug-in so that other users can install it into their CICS Explorer instances. To do this you must create a feature to contain the plug-in and export it. For instructions, see Deploying the custom perspective to end users.