Chapter 4. Interacting with the User

In the last chapter, we looked at some of the basic JFace viewers that provide a representation of data. However, we need to interact with the user and we can do this in multiple ways, from responding to mouse clicks to processing data-intensive operations in the background.

In this chapter we will:

  • Create a menu in response to a user popup
  • Add a command and a handler in a menu
  • Use progress managers to report work
  • Add commands to the progress manager
  • Show errors and deal with failure

Creating menus, commands, and handlers

In Eclipse, menus can be used to trigger user actions. These menus can be displayed at the top of the application window (or top of the screen on macOS). Menus can also be associated with a view through a contextual popup using the right mouse button.

A menu can be associated with a command, which represents a generic operation. The command is then dynamically associated with a handler, which is the code that executes the operation. This allows a generic operation (such as copy) to be executed by different handlers depending on the context.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.159.150