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.FileList;
11  import org.lcsim.util.loop.LCIOEventSource;
12  
13  /**
14   * A file handler for LCIO file lists.
15   * @author tonyj
16   * @version $Id: LCSimFileListHandler.java,v 1.1 2007/03/15 05:24:30 tonyj Exp $
17   */
18  
19  class LCSimFileListHandler implements FileHandler
20  {
21     private Studio app;
22     LCSimFileListHandler(Studio app)
23     {
24        this.app = app;
25     }
26     public boolean accept(File file) throws IOException
27     {
28        return file.getName().endsWith(".slcio.filelist");
29     }
30     
31     public FileFilter getFileFilter()
32     {
33        return new ExtensionFileFilter(".slcio.filelist","LCIO File List");
34     }
35  
36     public void openFile(File file) throws IOException
37     {
38        FileList fileList = new FileList(file,"LCIO File List");
39        LCIOEventSource source = new LCIOEventSource(fileList);
40        app.getLookup().add(source);
41     }   
42  }