Skip Navigation

com.sabre.redapp.example.conditional.activation Sample

The com.sabre.redapp.example.conditional.activation sample illustrates the display of menu entries conditionally, based on an active workbench element. In this case, the workbench elements are two editors: Sabre emulator and Sample Editor.

When Sample Editor is active, the Sample Editor Pop-up Dialog and the Sample Emulator Pop-up Dialog menu entries on the Tools menu are visible. The Sample Editor Pop-up Dialog is available, and the Sample Emulator Pop-up is unavailable.

When the active editor is Sabre emulator, the Tools menu displays the Sample Emulator Pop-up Dialog. This menu entry is visible and available. The Sample Editor Pop-up Dialog is hidden.

The visibility of these menu entries is controlled by adding the visibleWhen property to the menu contribution and the activeWhen property to the org.eclipse.core.expressions.definitions extension point.

The following describes the files that this sample includes:

  • SampleEditorDialog is a class that opens the sample dialog when BasicEditor is active.

  • SampleEditorHandler is a class that executes the command to open the dialog for BasicEditor.

  • SampleEmulatorDialog is a class that opens the sample dialog when Emulator is active.

  • SampleEmulatorHandler is a class that executes the command to open the Sample Editor’s pop-up dialog.

Running the Sample

  1. Because the conditional menu activation sample plug-in depends on the Sample Editor, import the com.sabre.redapp.example.editor.basic plug-in into your workspace. Add this plug-in to your run configuration.

  2. In Eclipse, import and add the com.sabre.redapp.example.conditional.activation plug-in to your run configuration.

  3. Launch Sabre Red 360 from your run configuration and log in with your CERT Sabre ID.

The following figure shows the menu entries when Sample Editor is active.

image46

The following figure shows the menu entry when Sabre emulator is active.

image47