Skip Navigation

com.sabre.redapp.example.resources Sample

The com.sabre.redapp.example.resources sample is an example of using resources in a plug-in and the workspace. This sample demonstrates the following functionality:

  • Loading icons by the Activator’s getImage() method inside the createControl() method

  • Reading properties in the plug-in with the getApplicationProperties() method from the Activator class. For example, this is used in the configureShell() method of the SurveyWriter class.

  • Reading from files and writing to files that are stored in the workspace directory of the plug-in. The createDescriptionLabel() method from the SurveyReader class and the saveAnswer() method from the SurveyWriter class are used.

  • Reading and writing is done by obtaining a reference to File by the getDataFile() method of the Activator’s class. Reading is done in the createDescriptionLabel() method, and writing is done in the saveAnswer() method, which then reads and writes from this file.

The following describes the files that this sample includes:

  • SurveyWriter.java constructs the dialog in which the end-user types comments.

  • SurveyWriterHandler.java opens the Survey Writer dialog.

  • SurveyReaderHandler.java opens the Survey Reader dialog.

  • SurveyReader.java creates the dialog that displays the comments from the end-user that are read from a file.

  • Activator.java returns properties that it reads from application.properties and controls the life cycle of the plug-in.

Running the Sample

  1. In Eclipse, import the com.sabre.redapp.example.resources plug-in into your worspace and add it to your run configuration.

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

  3. Choose Survey Writer from the Tools>Other menu. Type comments into the Survey Writer dialog.

  4. Next, choose Survey Reader from the Tools>Other menu. The plug-in reads the comments from the file and displays them on the Survey Reader dialog.

        If you choose the Survey Reader menu entry without entering comments, an error message is displayed.

The dialogs below show this sample in Sabre Red 360.

image34
image35