[index]

Task: Reload Settings on Change (A-T2)

This task involves planning a change to jEdit's edit modes and macros features. You will need to first familiarize yourself with jEdit and the edit modes and macros.

Overview of jEdit, Edit Modes, and Macros

  1. Launch JEdit to check it out. From the Eclipse Run configurations menu, choose jEdit-4-1-pre6. JEdit will appear momentarily. Some warning messages will be displayed in the console: this is normal. Do not close JEdit.
  2. In JEdit, an opened text file is called a Buffer. The following is an extract from the JEdit Manual (section 2.1):
    Several files can be opened and edited at once. Each open file is referred to as a buffer.
    JEdit supports context-specific behaviour and actions through the use of edit modes and macros. From the jEdit user manual:
    An edit mode specifies syntax highlighting rules, auto indent behavior, and various other customizations for editing a certain file type.
    Macros in jEdit are short scripts written in a scripting language called BeanShell. They provide an easy way to automate repetitive keyboard and menu procedures, as well as access to the objects and methods created by jEdit. Macros also provide a powerful facility for customizing jEdit and automating complex text processing and programming tasks.
  3. The appropriate edit mode is determined when a file is opened, and may be explicitly set as well. Choose File -> Open and open the file modes/xml.xml. Notice how different elements of the XML file are highlighted in different colours and fonts. All edit modes are described using XML: this particular file describes the edit mode for XML files.
  4. Choose File -> Open and look at the contents of the jEdit-4.1pre6 directory. Note the presence the directory named modes: this directory contains file definitions for the edit modes. The jEdit user manual notes:
    jEdit looks for edit modes in two locations; the modes subdirectory of the jEdit settings directory, and the modes subdirectory of the jEdit install directory. The location of the settings directory is system-specific.
  5. You should also notice a file named catalog. The jEdit user manual notes:
    Each mode directory contains a catalog file. All edit modes contained in that directory must be listed in the catalog, otherwise they will not be available to jEdit.
  6. Now choose the Macros menu. Explore the various submenus and note their arrangement.
    From the jEdit user manual:
  7. Choose File -> Open and look at the contents of the jEdit-4.1pre6 directory. Using the file chooser dialog, look at the directory structure of the macros directory; note its correspondance with the contents of the Macros menu. From the jEdit user manual:

    Macros are defined in files written in a language called BeanShell. [...]

    Macros are stored in two places: the macros subdirectory of the jEdit home directory, and the macros subdirectory of the user-specific settings directory.

    There is no central description file for macros analogous to the edit modes' catalog file.

    When jEdit first loads, it scans the designated macro directories and assembles a listing of individual macros in the Macros menu. When scanning the names, jEdit will delete underscore characters and the .bsh extension for menu labels, so that List_Useful_Information.bsh, for example, will be displayed in the Macros menu as List Useful Information.

Change Request

You are to create a a plan for performing the following task. This involves identifying the relevant program elements that need to be changed and how they should be changed, and those program elements that are necessary to understand for the change. NOTE: You are not actually required perform the changes. Rather you should identify the particular classes and methods to be used describe any new classes required. These instructions should be appropriate for giving to a first-year coop student to rapidly turn to working code.

You are to perform the software exploration using the provided software exploration tool. We ask that you attempt to use this tool for as much of your exploration as possible: we are interested in what information it cannot provide, and the circumstances. If you cannot find the answer to your query, then by all means use the normal Eclipse facilities.

Change Task: jEdit may be used for editing the macro and edit mode definitions. Your task is to add support to dynamically reload any edit modes or update its macro listings should they change. The modified version should meet the following requirements:

  1. Upon modifying an edit mode, the edit mode definition should be reloaded and applied to all current buffers.
  2. Upon modifying a BeanShell macro, the Macros menu contents should be refreshed and updated.

Expert Knowledge

You are given the following expert knowledge about the source code:

jEdit's internals provides support for an event broadcast system, including file system changes, in org.gjt.sp.jedit.EditBus.

Task

  1. You must make no change to the source code. You are not allowed to perform temporary changes, or try out different alternatives.
  2. Do not use the debugger.

Please notify the investigator when you are ready to commence.