View Javadoc

1   package org.lcsim.plugin;
2   
3   import org.freehep.application.studio.Studio;
4   import org.freehep.swing.ExtensionFileFilter;
5   
6   import javax.swing.filechooser.FileFilter;
7   import java.io.File;
8   import java.io.IOException;
9   import org.freehep.jas.services.FileHandler;
10  import org.lcsim.util.loop.LCIOEventSource;
11  
12  /**
13   * A file handler for LCIO files.
14   * @author tonyj
15   * @version $Id: LCSimFileHandler.java,v 1.2 2005/06/20 23:23:08 tonyj Exp $
16   */
17  
18  class LCSimFileHandler implements FileHandler
19  {
20     private Studio app;
21     LCSimFileHandler(Studio app)
22     {
23        this.app = app;
24     }
25     public boolean accept(File file) throws IOException
26     {
27        return file.getName().endsWith(".slcio");
28     }
29     
30     public FileFilter getFileFilter()
31     {
32        return new ExtensionFileFilter("slcio","LCIO Files");
33     }
34  
35     public void openFile(File file) throws IOException
36     {
37        LCIOEventSource source = new LCIOEventSource(file);
38        app.getLookup().add(source);
39     }   
40  }