Event Handler
Im nachstehenden Code wird gezeigt, wie die Applikation auf XMLSpy Events hört und diese verwendet.
01 // The following lines attach to the document events using a default implementation
02 // for the events and override one of its methods.
03 // If you want to override all document events it is better to derive your listener class
04 // from DocumentEvents and implement all methods of this interface.
05 Document doc = stylevision.getActiveDocument();
06 doc.addListener(new DocumentEventsDefaultHandler()
07 {
08 @Override
09 public void onDocumentClosed(Document i_ipDoc) throws AutomationException
10 {
11 System.out.println("Document " + i_ipDoc.getName() + " requested closing.");
12 }
13 });
14 doc.close();
15 doc = null;