Antidote Reopener changed to use global PropertiesManager (instead of writing
its own Properties file).
--
Jack J. Woehr # You measure democracy by the freedom it
Senior Consultant # gives its dissidents, not the freedom
Purematrix, Inc. # it gives its assimilated conformists.
www.purematrix.com # - Abbie Hoffman
? antidote.diff
? org/apache/tools/ant/gui/core/.nbattrs
? org/apache/tools/ant/gui/event/.nbattrs
? org/apache/tools/ant/gui/modules/.nbattrs
Index: org/apache/tools/ant/gui/modules/Reopener.java
===================================================================
RCS file:
/home/cvspublic/ant-antidote/src/java/org/apache/tools/ant/gui/modules/Reopener.java,v
retrieving revision 1.4
diff -r1.4 Reopener.java
77a78
> import org.apache.tools.ant.gui.core.PropertiesManager;
87,88c88,89
< *
< * @version $Revision: 1.4 $
---
> *
> * @version $Revision: 1.4 $
99c100
< = new SimpleDateFormat ("yyyy.MM.dd G 'at' hh:mm:ss a zzz");
---
> = new SimpleDateFormat("yyyy.MM.dd G 'at' hh:mm:ss a zzz");
106,107c107,149
<
< /**
---
>
> /** The string prefixed to every reopener filelist entry in our
> Properties */
> public static final String
> REOPENER_FILELIST_PROPERTY_PREFIX="Reopener.filelist.";
>
> /** Test if a key (i.e., a Properties file key in our persistent
> properties)
> * is a key written/read by the Reopener as a filelist member.
> * @param key A string used as a properties file key.
> * @return true if indeed the string represents a Reopener filelist key.
> */
> public static boolean isReopenerFilelistKey(String key) {
> boolean result = false;
> if (null != key) {
> result = key.startsWith(REOPENER_FILELIST_PROPERTY_PREFIX);
> }
> return result;
> }
>
> /** Make a file key intended to be stored in our persistent properties
> * into a key written/read by the Reopener as a filelist member by
> prefixing
> * it correctly.
> * @param key A string used by the Reopener intended to be used as a
> properties file key.
> * @return The same string prefixed with the Reopener filelist key.
> */
> public static String makeReopenerFilelistKey(String protoKey) {
> String result= REOPENER_FILELIST_PROPERTY_PREFIX + protoKey;
> return result;
> }
>
> /** Make a file key intended to be stored in our persistent properties
> * into a the kind of key understood by the Reopener as a filelist member
> by
> * stripping the prefix that identifies it as a Reopener key in the
> properties file.
> * @param key A string used as a properties file key.
> * @return The same string with the prefix for a Reopener filelist key
> stripped from it.
> */
> public static String stripReopenerFilelistKey(String protoKey) {
> String result = protoKey;
> if (isReopenerFilelistKey(protoKey)) {
> result =
> protoKey.substring(REOPENER_FILELIST_PROPERTY_PREFIX.length());
> }
> return result;
> }
>
> /**
109c151
< *
---
> *
116c158
< context.getResources().getString(getClass(), "menuName");
---
> context.getResources().getString(getClass(), "menuName");
118c160
< context.getResources().getString(getClass(),
"insertAfterMenuName");
---
> context.getResources().getString(getClass(), "insertAfterMenuName");
122c164
<
---
>
135c177
<
---
>
161c203
<
---
>
163c205
< *
---
> *
185c227
<
---
>
200c242
< getContext(), new File(name));
---
> getContext(), new File(name));
202c244
< event, name);
---
> event, name);
206c248
< KeyStroke.getKeyStroke("control " + count));
---
> KeyStroke.getKeyStroke("control " + count));
210c252
<
---
>
229c271,275
< map.remove(map.firstKey());
---
> Object key = map.firstKey();
> map.remove(key); // Remove it from our temp list used to
> reinstance _fileList
> // .AND. remove it from our global properties (first converting
> key into form
> // our persistent properties knows about!).
>
> getContext().getPropertiesManager().remove(makeReopenerFilelistKey(key.toString()));
241,249c287
<
< /**
< * @return the file used to save the list
< */
< protected File getSaveFile() {
< String home = System.getProperty("user.home");
< return new File(home + "/antidote.reopen.properties");
< }
<
---
>
251c289
< * Saves the list
---
> * Saves the list to the global PropertiesManager and causes a props file
> save.
253a292,298
> Iterator i = _fileList.keySet().iterator();
> PropertiesManager pm = getContext().getPropertiesManager();
> while(i.hasNext()) {
> String key = (String) i.next();
> String value = (String) _fileList.get(key);
> pm.setProperty(makeReopenerFilelistKey(key), value);
> }
255,262c300,306
< File file = getSaveFile();
< if (!file.exists()) {
< file.createNewFile();
< }
< FileOutputStream out = new FileOutputStream(file);
< _fileList.store(out, null);
< } catch (IOException e) {
< e.printStackTrace();
---
> getContext().saveProperties();
> }
> catch (java.io.FileNotFoundException e) {
> // Log error? Show dialog? Couldn't save.
> }
> catch (java.io.IOException e) {
> // Log error? Show dialog? Couldn't save.
265c309
<
---
>
267c311
< * Loads the list
---
> * Refreshes the Properties used by the Reopened from the global
> PropertiesManager.
270,275c314,323
< try {
< File file = getSaveFile();
< if (file.exists())
< {
< FileInputStream in = new FileInputStream(file);
< _fileList.load(in);
---
> _fileList.clear();
> PropertiesManager pm = getContext().getPropertiesManager();
> Iterator i = pm.keySet().iterator();
> String key = null;
> String value = null;
> while(i.hasNext()) {
> key = (String) i.next();
> if (isReopenerFilelistKey(key)) {
> value = (String) pm.getProperty(key);
> _fileList.setProperty(stripReopenerFilelistKey(key), value);
277,278d324
< } catch (IOException e) {
< e.printStackTrace();
285,286c331,332
<
< /**
---
>
> /**
289c335
< *
---
> *
296c342
< /**
---
> /**
298c344
< *
---
> *
304c350
<
---
>
306c352
<
---
>
309c355
< getContext().getSelectionManager().getSelectedProject();
---
> getContext().getSelectionManager().getSelectedProject();
322c368
<
---
>
329c375
<
---
>
333c379
< /**
---
> /**
335c381
< *
---
> *
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]