[visad] Changes to visad.util.TextEditor


Hi,
If you never access or subclass visad.util.TextEditor then please ignore this message.

We have come across a deadlock problem in the IDV running on windows under jdk1.6.
This problem is caused by creating JFileChooser objects in multiple threads.

I'd like to change the fileChooser member of visad.util.TextEditor from protected to private so that this member does not get created at object instantiation time but rather gets created when needed. I have also modified visad.python.JPythonEditor because it would directly access that member.

Is this going to break anyone's code?

Thanks,
Jeff


The proposed changes:
In TextEditor add:

 /** Create and initialize the the file chooser */
 protected JFileChooser doMakeFileChooser() {
JFileChooser tmpChooser = new JFileChooser(System.getProperty("user.dir"));
      tmpChooser.addChoosableFileFilter(
        new ExtensionFileFilter("txt", "Text files"));
      return tmpChooser;
 }


 /** Create if needed and return the file chooser */
 protected JFileChooser getFileChooser() {
   if(fileChooser == null) {
      fileChooser = doMakeFileChooser();
   }
   return fileChooser;
 }


Any access to fileChooser in these classes is changed to getFileChooser()

In visad.python.JPythonEditor overwrite the doMakeFileChooser to add the file filter:
 /** Create and initialize the the file chooser */
 protected JFileChooser doMakeFileChooser() {
     JFileChooser tmpFileChooser = super.doMakeFileChooser();
     // add JPython files to file chooser dialog box
     tmpFileChooser.addChoosableFileFilter(
         new ExtensionFileFilter("py", "JPython source code"));
     return tmpFileChooser;
 }