Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

[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;
 }






 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690