Skip Navigation

About Generic Commands and Handlers

As Sabre Red App certified developers, you can either use pre-defined classes for Sabre Red 360 or you can customize your own classes. This book illustrates how to create a command and handler when you want to develop custom classes, without using Sabre Red 360 classes.

The procedure shows how to create a generic command using the extension point org.eclipse.ui.commands and a handler using the extension point org.eclipse.ui.handlers . You can use this procedure whenever you need to create a command and a handler.

Creating a Java command declares its behavior, and the handler implements the behavior. After you create a command with a handler, you must bind the command to an editor or a view to make it functional. Without binding it to some object, it is not functional. For the procedure that shows how to create editor commands and handlers, and bind a command to an editor, see Editors.

Dependencies, Extension Points, and Classes

Whether you are customizing a command and handler or creating the command and handler that the procedure in this book builds, both Eclipse and Sabre Red 360 have defined some dependencies, extension points, and classes that are required to create a generic command and handler. These requirements follow.

Minimum Required Dependencies

  • org.eclipse.core.runtime

  • com.sabre.edge.platform.core.editor

        This Sabre Red 360 dependency is required for an editor object. It provides classes that are required to implement an editor.

  • org.eclipse.ui

Required Extension Points

  • org.eclipse.ui.commands

  • org.eclipse.ui.handlers

Required Classes

For an object that is not an editor, you must create a handler, generate your own class for the handler, and then extend org.eclipse.core.commands.AbstractHandler. This handler class handles commands.

Your class name must be in the following format: name +   Handler

Example: SampleHandler