* In bigger applications I don't use this event mechanism but
* rather the event listener framework at https://elf.dev.java.net/
*/
public void onApplicationEvent(ApplicationEvent event) {
if(event instanceof SearchResultEvent){
SearchResultEvent specificEvent = (SearchResultEvent)event;
if(specificEvent.getSearchResult() != null){
Integer results = new Integer(specificEvent.getSearchResult().getResultElements().length);
int estimatedResults = specificEvent.getSearchResult().getEstimatedTotalResultsCount();
if(estimatedResults == 0){
statusBar.setMessage(getMessage(NO_RESULTS));
}
else{
statusBar.setMessage(getMessage(ESTIMATED_RESULTS,
new Object[]{new Integer(estimatedResults)}));
}
}
else{
statusBar.setMessage(getMessage(NO_RESULTS));
}
}
else if(event instanceof SearchResultsSelectionEvent){
//SearchResultsSelectionEvent specificEvent = (SearchResultsSelectionEvent)event;
//statusBarCommandGroup.setMessage(specificEvent.getSearchResult().getURL());
}
else if(event instanceof SwingWorkerExceptionEvent){
SwingWorkerExceptionEvent specificEvent = (SwingWorkerExceptionEvent)event;
if(specificEvent.getCause().getCause() != null){
statusBar.setErrorMessage(
specificEvent.getCause().getCause().getMessage());
}
else{
statusBar.setErrorMessage(getMessage(UNKNOWN_ERROR));
}
}
else if(event instanceof OpenEditorEvent){
OpenEditorEvent specificEvent = (OpenEditorEvent)event;
GoogleSearchResultElement element = (GoogleSearchResultElement)specificEvent.getObject();
statusBar.setMessage(getMessage(OPENED, new Object[]{element.getURL()}));
}
}