@SuppressWarnings("empty-statement")
protected SpeechProcessor getKeyEventProcessor() {
if (box == null)
return new NullProcessor();
ComboBoxProcessor proc = new ComboBoxProcessor();
Object o = box.getSelectedItem();
String sayString = null;
Accessible acc = null;
proc.setKeyEvent(true);
if(box.getAccessibleContext() != null &&
box.getAccessibleContext().getAccessibleSelection() != null &&
box.getAccessibleContext().getAccessibleSelection().getAccessibleSelection(0) != null)
acc = box.getAccessibleContext().getAccessibleSelection().getAccessibleSelection(0);
else if(o != null)
sayString = o.toString();
if(acc != null) {
sayString = acc.getAccessibleContext().getAccessibleName();
}
else if(o instanceof FileFilter) {
FileFilter file = (FileFilter) o;
sayString = file.getDescription();
//speakString = classReflection(o,"javax.swing.filechooser.FileFilter","getDescription");
}
//Our combobox is most likely a Win32ShellFolder, do some
//Java reflection.
else if(o instanceof sun.awt.shell.ShellFolder) {
//preferable as it accounts
sun.awt.shell.ShellFolder folder = (sun.awt.shell.ShellFolder)o;
sayString = folder.getDisplayName();
//just in case, hold on to this
//speakString = classReflection(o,"sun.awt.shell.Win32ShellFolder2","getDisplayName");
}
else if(o instanceof SourceGroup) {
SourceGroup group = (SourceGroup)o;
sayString = group.getDisplayName();
}
else if(o instanceof Project) {
Project proj = (Project) o;
ProjectInformation info = proj.getLookup().lookup(ProjectInformation.class);
sayString = info.getDisplayName();
}
if(sayString != null) {//null values for separators?
proc.setText(sayString);
}
else {
proc.setSeparator(true);
}
return proc;
}