PropertyListener demonstrates an extension can keep informed of changes in the IDE's state, including the files it contains, what has focus, and so on. registers to listen for IDE events. These events include com.bea.ide.Application.EVENT_DocumentDirtyChange and com.bea.ide.Application.PROP_FocusedURIs.
EVENT_DocumentDirtyChange is delivered when a document is changed (made "dirty") or saved. The PROP_FocusedURIs event is sent any time the set of files highlighted in the Application tree changes. When either of these events is fired, the handlers in the sample's PropertyListenerAction class propagate diagnostic info to an instance of IOutputWindow.
To view the sample code in WebLogic Workshop:
To run this sample, open one of its files in WebLogic Workshop and click the Start button. The sample will build, copying the resulting extension JAR file to the WORKSHOP_HOME/extensions folder, then launch a new instance of WebLogic Workshop. If you've set breakpoints in the first IDE instance, these should be hit as you exercise the sample code in the new instance.
With the second IDE instance running, you should have access to Properties menu on the main menu bar. Click Properties -> Property Listener to display a message window like the one at the top of this topic. Click items in the Application window, or edit an open document to see messages generated by the event listeners.
For information on debugging extension samples, see Debugging Extensions.