diff options
author | Andrew Su <[email protected]> | 2011-04-20 16:58:29 -0400 |
---|---|---|
committer | Andrew Su <[email protected]> | 2011-04-20 16:58:29 -0400 |
commit | 6d9882321fc6e2bf6c8887c4b4ceaaad77f637f2 (patch) | |
tree | ad606a9804a607ee1c48861f2cdf2fe50e7b00be /netx/net/sourceforge/jnlp | |
parent | 75e483ead3f21f5897d4c38781dfa681ac2edda7 (diff) |
Update recently_used when deleting cache entries with itw-settings
Diffstat (limited to 'netx/net/sourceforge/jnlp')
-rw-r--r-- | netx/net/sourceforge/jnlp/controlpanel/CachePane.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/netx/net/sourceforge/jnlp/controlpanel/CachePane.java b/netx/net/sourceforge/jnlp/controlpanel/CachePane.java index 91849c4..e31b2bb 100644 --- a/netx/net/sourceforge/jnlp/controlpanel/CachePane.java +++ b/netx/net/sourceforge/jnlp/controlpanel/CachePane.java @@ -32,6 +32,7 @@ import java.io.IOException; import java.nio.channels.FileLock; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Enumeration; import java.util.List; import javax.swing.JButton; @@ -48,6 +49,7 @@ import net.sourceforge.jnlp.cache.DirectoryNode; import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.Translator; import net.sourceforge.jnlp.util.FileUtils; +import net.sourceforge.jnlp.util.PropertiesFile; public class CachePane extends JPanel { @@ -153,6 +155,7 @@ public class CachePane extends JPanel { int modelRow = cacheTable.convertRowIndexToModel(row); DirectoryNode fileNode = ((DirectoryNode) cacheTable.getModel().getValueAt(modelRow, 0)); if (fileNode.getFile().delete()) { + updateRecentlyUsed(fileNode.getFile()); fileNode.getParent().removeChild(fileNode); FileUtils.deleteWithErrMesg(fileNode.getInfoFile()); ((DefaultTableModel) cacheTable.getModel()).removeRow(modelRow); @@ -172,6 +175,20 @@ public class CachePane extends JPanel { } } } + + private void updateRecentlyUsed(File f) { + File recentlyUsedFile = new File(location + File.separator + "recently_used"); + PropertiesFile pf = new PropertiesFile(recentlyUsedFile); + pf.load(); + Enumeration<Object> en = pf.keys(); + while (en.hasMoreElements()) { + String key = (String) en.nextElement(); + if (pf.get(key).equals(f.getAbsolutePath())) { + pf.remove(key); + } + } + pf.store(); + } }); buttons.add(deleteButton); |