Java Event Wizard for Eclipse

The Java Event Wizard for Eclipse (v0.4.5 beta) makes adding an event to a Java class a simple point and click operation. The wizard adda code to add and remove listeners, fire events. It also creates an interface for listeners to implement. All code is compliant to the JavaBean specification.

 
    Installation
 
 
  1. Open Eclipse.
  2. Select Help | Software Updates | Find and Install.



  3. In the Install/Update dialog:
    1. Select Search for New Features to Install.
    2. Click Next.
    3. Click New Remote Site...
      1. For Name, enter 
        Java Event Wizard.
      2. For URL, enter 
        http://www.cogitoengineering.com/javaeventwizard
      3. Click OK.
      4. Java Event Wizard should be checked.
    4. Click Finish.
  4. On the Updates dialog:
    1. Check Java Event Wizard.
    2. Click Next.
    3. Select the "I accept the terms..." radio button.
    4. Click Next.
    5. Click Finish.
  5. On the Verification dialog:
    1. Click Install.
  6. On the Install/Update dialog:
    1. Click Yes.
 
 
 
    Basic Usage
 
 
  1. In a Java source code file:
    1. Right-click, select Add Java Event.



  2. In the New Event Wizard:
    1. Type in the name of an event (e.g. CountChanged).
    2. Click Finish.
  3. The following code will be added by the wizard:
    1. In the current class:
      1. A list variable to hold references to observers:
        private ArrayList countChangedListeners = new ArrayList();
         
      2. Add methods to add and remove observers:
        public void addCountChangedListener( CountChangedListener listener) {
           countChangedListeners.add(listener);
        }

        public void removeCountChangedListener(CountChangedListener listener) {
           countChangedListeners.remove(listener);
        }
      3. Add a method to fire events (i.e. inform observers of the change):
        private void fireCountChanged() {
          for (int i = 0; i < countChangedListeners.size(); i++) {
             CountChangedListener listener = ((CountChangedListener) countChangedListeners.get(i));
             listener.countChanged(this);
           }
        }
    2. To the package
      1. An interface called CountChangedListener with a single method called countChanged().
 
 
 
   Alternate Installation
 
 

Note: the alternate installation method circumvents Eclipse's built-in configuration management system, making updates to the Java Event Wizard more difficult (essentially requiring the developer to manually remove the old plug-in files and directories prior to installation of a new version).  For this reason, it is recommended that the standard installation procedure described above be used.  If you still want to perform a manual install, simply follow these steps:

  1. Download com.cogitoresearch.eclipse.javaeventwizard_0.4.5.jar.
  2. Copy the jar file into C:\eclipse\plugins