To reflect the modifications of the states and actions
available to the CARMA member or container, you will need to modify
the Activator class.
To modify the Java Activator class:
- Open the Java Activator class.
In the Package Editor view, expand com.ibm.carma.plugin.disable.programatically > src > com.ibm.carma.plugin.disable.programatically.
Double click on theActivator.java class to open it.
- Scroll down in the Activator class and
find the start method declaration. You
will want to provide code that will modify the GAMActionRegistry,
where the available actions and their states are stored, to disable
the Open With option. You will also have to
identify the particular RAM to which you want the modifications to
be applied. This can be done with either the RAM's uniqueId or
the ramId. The following example assumes that you
will use the RAM's uniqueId.
Sample code:
public void start(BundleContext context) throws Exception
{
RAMActionRegistry myRegistry = RAMActionRegistry.getRegistry();
myRegistry.setUniqueRAMActionState("com.ibm.carma.sample.PDSRAM",
"com.ibm.carma.action.remove",
RAMActionState.DISABLED);
}
Note: If you choose to use the
ramId as
the RAM identification, then change the fourth line of code to:
myRegistry.setRAMActionState("ramId",
"com.ibm.carma.action.openWith",
RAMActionState.DISABLED);
and
provide the appropriate
ramId.
- Import the needed classes and packages which tells the Activator class
where to find the other types you mentioned in your code. Right click
in the editor and select Source > Organize
Imports, and verify the packages to import. Ensure
the following packages were imported, add any to the import commands
at the top of the Activator class if necessary:
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import com.ibm.carma.ui.view.*;
- Save the source and resolve any errors.