1   package com.explosion.expf.supportmodules;
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  import java.util.Hashtable;
23  import java.util.Properties;
24  import java.util.Vector;
25  import java.util.prefs.Preferences;
26  
27  import javax.swing.JPanel;
28  
29  import com.explosion.expf.ExpActionListener;
30  import com.explosion.expf.ExpConstants;
31  import com.explosion.expf.ExpModuleManager;
32  import com.explosion.expf.preferences.SystemPreferences;
33  import com.explosion.utilities.exception.ExceptionManagerFactory;
34  import com.explosion.utilities.preferences.Preference;
35  
36  /***
37   * Author: Stephen Cowx
38   * Date: Dec 1, 2002
39   * Time: 12:50:18 PM
40   * 
41   * This HistorySupportModule records the file and other histories
42   * for editing.
43   */
44  
45  public class HistorySupportModule implements ExpModuleManager
46  {
47    private Vector preferences;
48    private Hashtable preferenceHash;
49    
50    public void initialiseGui() throws Exception
51    {
52      
53    }
54  
55    public String getVersion()
56    {
57      return "1.0";
58    }
59  
60    public String getName()
61    {
62      return "History Support";
63    }
64  
65    public String getDescription()
66    {
67      return "Support for items which require a history to be kept.  E.G File History or Connection History.";
68    }
69  
70    public void initialiseCore(Properties properties)
71    {
72  	  try {
73  		String appPrefix =  (String) SystemPreferences.getPreference(ExpConstants.EXPF_APP_PREFIX).getValue();
74  		  
75  		  Preferences prefs = Preferences.userRoot().node(appPrefix+"/history");
76  		   
77  		  Preference maxItemsInHistory = new Preference(ExpConstants.MAXITEMSINHISTORY, Preference.PROPERTY_TYPE_INT, new Integer(10), prefs);
78  		  maxItemsInHistory.setLongName("Maximum items in history.");
79  		  maxItemsInHistory.setDescription("This indicates the maximum number of items to hold in the history list.");
80  		  preferences.addElement(maxItemsInHistory);
81  		  preferenceHash.put(ExpConstants.MAXITEMSINHISTORY, maxItemsInHistory);
82  		  
83  	} catch (Exception e) {
84  		ExceptionManagerFactory.getExceptionManager().manageException(e,"Exception caught while initialising History Support Module.");
85  	}
86    }
87  
88    public Vector getPreferences()
89    {
90      return preferences;
91    }
92    
93    public Preference getPreference(String preferenceName)
94    {
95    	return (Preference) preferenceHash.get(preferenceName);
96    }
97  
98    public JPanel getPreferencesEditor()
99    {
100     return null;
101   }
102   
103   public ExpActionListener getGlobalListener()
104   {
105   	return null;
106   }
107 
108 }