Revision 9931 trunk/libraries/libCorePlugin/src/com/iver/core/preferences/general/FolderingPage.java

View differences:

FolderingPage.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.7  2006-10-02 07:12:12  jaume
46
* Revision 1.8  2007-01-26 13:35:06  jaume
47 47
* *** empty log message ***
48 48
*
49
* Revision 1.7  2006/10/02 07:12:12  jaume
50
* *** empty log message ***
51
*
49 52
* Revision 1.6  2006/09/13 16:21:00  jaume
50 53
* *** empty log message ***
51 54
*
......
97 100
	private static final String PROJECTS_FOLDER_PROPERTY_NAME = "ProjectsFolder";
98 101
	private static final String DATA_FOLDER_PROPERTY_NAME = "DataFolder";
99 102
	private static final String TEMPLATES_FOLDER_PROPERTY_NAME = "TemplatesFolder";
103
	private static final String SYMBOL_LIBRARY_FOLDER_PROPERTY_NAME = "SymbolLibraryFolder";
100 104
	private JTextField txtProjectsFolder;
101 105
	private JTextField txtDataFolder;
102 106
	private JTextField txtTemplatesFolder;
107
	private JTextField txtSymbolLibraryFolder;
103 108
	private JButton btnSelectProjectsFolder;
104 109
	private JButton btnSelectDataFolder;
105 110
	private JButton btnSelectTemplatesFolder;
111
	private JButton btnSelectSymbolLibraryFolder;
106 112
	private ImageIcon icon;
107 113
	private ActionListener btnFileChooserAction;
108 114

  
115

  
116

  
109 117
	public FolderingPage() {
110 118
		super();
111 119
		setParentID(GeneralPage.id);
......
118 126
					path = txtProjectsFolder.getText();
119 127
				} else if (e.getSource().equals(btnSelectDataFolder)) {
120 128
					path = txtDataFolder.getText();
129
				} else if (e.getSource().equals(btnSelectSymbolLibraryFolder)) {
130
					path = txtSymbolLibraryFolder.getText();
121 131
				} else {
122 132
					path = txtTemplatesFolder.getText();
123 133
				}
......
165 175
		btnSelectDataFolder.addActionListener(btnFileChooserAction);
166 176
		btnSelectTemplatesFolder = new JButton(PluginServices.getText(this, "browse"));
167 177
		btnSelectTemplatesFolder.addActionListener(btnFileChooserAction);
178
		btnSelectSymbolLibraryFolder = new JButton(PluginServices.getText(this, "browse"));
179
		btnSelectSymbolLibraryFolder.addActionListener(btnFileChooserAction);
168 180

  
169 181

  
170 182
		JLabel lblProjectsFolder = new JLabel("<html><b>" +
......
191 203
		addComponent(txtTemplatesFolder = new JTextField(30), btnSelectTemplatesFolder);
192 204
		addComponent(new JLabel(" "));
193 205

  
206
		JLabel lblSymbolLibraryFolder = new JLabel("<html><b>" +
207
				PluginServices.
208
				getText(this, "options.foldering.symbol_library_folder") +
209
		"</b></html>");
210
		addComponent(lblSymbolLibraryFolder);
211
		addComponent(txtSymbolLibraryFolder = new JTextField(30), btnSelectSymbolLibraryFolder);
212
		addComponent(new JLabel(" "));
194 213
		PluginServices ps = PluginServices.getPluginServices(this);
195 214
		XMLEntity xml = ps.getPersistentXML();
196 215

  
......
206 225
			prefs.put(TEMPLATES_FOLDER_PROPERTY_NAME, xml.getStringProperty(TEMPLATES_FOLDER_PROPERTY_NAME));
207 226
		}
208 227

  
228
		if (xml.contains(SYMBOL_LIBRARY_FOLDER_PROPERTY_NAME)) {
229
			prefs.put(SYMBOL_LIBRARY_FOLDER_PROPERTY_NAME, xml.getStringProperty(SYMBOL_LIBRARY_FOLDER_PROPERTY_NAME));
230
		}
231

  
209 232
	}
210 233

  
211 234
	public void storeValues() throws StoreException {
......
276 299
			}
277 300
		}
278 301

  
302
		// Symbol library folder
303
		propertyName = SYMBOL_LIBRARY_FOLDER_PROPERTY_NAME;
304
		path = txtSymbolLibraryFolder.getText();
305

  
306
		if (path.equals("")) {
307
			if (xml.contains(propertyName)) {
308
				xml.remove(propertyName);
309
			}
310
			prefs.remove(propertyName);
311
		} else {
312
			f = new File(path);
313
			if (f.exists()) {
314
				if (xml.contains(propertyName)) {
315
					xml.remove(propertyName);
316
				}
317
				xml.putProperty(propertyName, f.getAbsolutePath());
318
				prefs.put(propertyName, f.getAbsolutePath());
319
			}
320
		}
321

  
279 322
	}
280 323

  
281 324
	public void setChangesApplied() {
......
306 349
		if (xml.contains(TEMPLATES_FOLDER_PROPERTY_NAME)) {
307 350
			txtTemplatesFolder.setText(xml.getStringProperty(TEMPLATES_FOLDER_PROPERTY_NAME));
308 351
		}
309

  
352
		if (xml.contains(SYMBOL_LIBRARY_FOLDER_PROPERTY_NAME)) {
353
			txtTemplatesFolder.setText(xml.getStringProperty(SYMBOL_LIBRARY_FOLDER_PROPERTY_NAME));
354
		}
310 355
	}
311 356

  
312 357
	public void initializeDefaults() {

Also available in: Unified diff