1 /* 2 * $HeadURL: $ 3 * $Date: $ 4 * $Revision: $ 5 * $Author: $ 6 * 7 * Copyright (c) 2005 MindTree Consulting Ltd. 8 * 9 * This file is part of Insight. 10 * 11 * Insight is free software: you can redistribute it and/or modify it under the 12 * terms of the GNU General Public License as published by the Free Software 13 * Foundation, either version 3 of the License, or (at your option) any later 14 * version. 15 * 16 * Insight is distributed in the hope that it will be useful, but 17 * WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 19 * Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License along with 22 * Insight. If not, see <http://www.gnu.org/licenses/>. 23 */ 24 package com.mindtree.techworks.insight.gui.action; 25 26 import java.awt.event.ActionEvent; 27 28 import javax.swing.AbstractAction; 29 30 import com.mindtree.techworks.insight.gui.Insight; 31 import com.mindtree.techworks.insight.gui.util.LoadFilesetFrame; 32 import com.mindtree.techworks.insight.preferences.util.PreferenceInterpreter; 33 34 /** 35 * 36 * The <code>LoadFileAction</code> class is a facade AbstractAction derivative 37 * that permits loading of configured Filesets or files from the local or mounted 38 * file systems depending on user preference settings. 39 * @author Regunath B 40 * @version 1.0, 05/04/04 41 * @see com.mindtree.techworks.insight.gui.Insight Insight 42 * @see com.mindtree.techworks.insight.gui.action.LoadLocalFileAction LoadLocalFileAction 43 * @see com.mindtree.techworks.insight.download.Fileset Fileset 44 */ 45 46 public class LoadFileAction extends AbstractAction { 47 48 /** 49 * Used for object serialization 50 */ 51 private static final long serialVersionUID = -9072081477007675313L; 52 53 /** 54 * Insight instance for this class 55 */ 56 private Insight insight; 57 58 /** 59 * Constructor for this class 60 * @param insight the Insight isntance for this class 61 */ 62 public LoadFileAction(Insight insight) { 63 this.insight = insight; 64 // initialize the LoadLocalFileAction class before any file load is attempted 65 LoadLocalFileAction.getInstance().initialize(insight); 66 } 67 68 /** 69 * Overriden superclass method 70 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) 71 */ 72 public void actionPerformed(ActionEvent e) { 73 if (PreferenceInterpreter.getShowFilesetOnLoad()) { 74 LoadFilesetFrame filesetFrame = new LoadFilesetFrame(this.insight); 75 filesetFrame.showFrame(); 76 } else { 77 LoadLocalFileAction.getInstance().browseAndLoadLocalFiles(); 78 } 79 } 80 81 }