/hg/icedtea-web: Update recently_used when deleting cache entrie...
asu at icedtea.classpath.org
asu at icedtea.classpath.org
Wed Apr 20 13:56:49 PDT 2011
changeset a50cd6a66ae6 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=a50cd6a66ae6
author: Andrew Su <asu at redhat.com>
date: Wed Apr 20 16:58:29 2011 -0400
Update recently_used when deleting cache entries with itw-settings
diffstat:
ChangeLog | 7 +++++++
netx/net/sourceforge/jnlp/controlpanel/CachePane.java | 17 +++++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
diffs (62 lines):
diff -r 6abf7a788f4e -r a50cd6a66ae6 ChangeLog
--- a/ChangeLog Wed Apr 20 16:33:18 2011 -0400
+++ b/ChangeLog Wed Apr 20 16:58:29 2011 -0400
@@ -1,3 +1,10 @@
+2011-04-20 Andrew Su <asu at redhat.com>
+
+ * netx/net/sourceforge/jnlp/controlpanel/CachePane.java:
+ (createButtonPanel): Changed to update the recently_used file to
+ reflect the deletion. Added method updateRecentlyUsed to anonymous
+ ActionListener class which will do the actual updating.
+
2011-04-20 Omair Majid <omajid at redhat.com>
* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: Add new private
diff -r 6abf7a788f4e -r a50cd6a66ae6 netx/net/sourceforge/jnlp/controlpanel/CachePane.java
--- a/netx/net/sourceforge/jnlp/controlpanel/CachePane.java Wed Apr 20 16:33:18 2011 -0400
+++ b/netx/net/sourceforge/jnlp/controlpanel/CachePane.java Wed Apr 20 16:58:29 2011 -0400
@@ -32,6 +32,7 @@
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.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 @@
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 @@
}
}
}
+
+ 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);
More information about the distro-pkg-dev
mailing list