Code‎ > ‎Tutorials‎ > ‎

Navigating the code base and making the first change - Change Undo Key Mapping

What steps to exercise the new feature?

1. Open WIAB client.
2. Create a new wave
3. Type some text
4. ctrl+0

The following is a description on how to figure out how to implement a tiny feature without know much about the code. The actual feature is trivial to implement. The main learning of this starter project is to set up the dev environment, how to navigate the code base and make a change. In this spirit, the instructions below does not go directly to the feature, rather it includes lots of investigative steps.

1. Follow the instructions at Client Development Environment Set Up to set up the dev environment

2. In windows or linux, start the browser with OOPHM plugin installed and navigate to the WIAB server as in the above instruction. This lets you debug the client code.

3. Let's try to see if there are any class to do with undo. 
   3.1 In eclipse hit ctrl+shift+t (class search), and type "Undo". 
   3.2 Notice there is a class called "UndoManagerImpl". Notice there is a method called "undoPlus()" in this class.
   3.3 Let's look up where it's called, by putting the cursor over the method and hit (ctrl+shft+g), which looks up call references should take you to "EditorUndoManagerImpl.undo()". 
   3.4 Repeat call reference look up again on "EditorUndoMangerImpl.undo()", should take you to "EditorImpl:handleCommand()". Notice on line 764 "if (event.isUndoCombo()) {". Bingo
  3.5 Putting cursor over "isUndoCombo()" and hit (ctrl+t), which looks up implementations of the method. This will take you to "SignalEventImpl.isUndoCombo()"

4. Looks like it currently uses "Z" for undo. Let's change it to "0".

5. Refresh the browser with OOPHM and try the feature. The code now works in debug.

6. Compile the WIAB (slow) to see it works outside of debug
  6.1 In the wave-protocol directory run "ant
  6.5 Restart WIAB server

7. Open WIAB in a browser without using OOPHM by directly visiting http://localhost:9898 and check the feature works.
Comments