/hg/icedtea-web: Allow delete only when plugin or javaws is not ...
asu at icedtea.classpath.org
asu at icedtea.classpath.org
Wed Apr 20 11:33:48 PDT 2011
changeset f0cccaba8060 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=f0cccaba8060
author: Andrew Su <asu at redhat.com>
date: Wed Apr 20 14:35:13 2011 -0400
Allow delete only when plugin or javaws is not running
diffstat:
ChangeLog | 6 +++
netx/net/sourceforge/jnlp/controlpanel/CachePane.java | 30 +++++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)
diffs (69 lines):
diff -r 6e89f860a35a -r f0cccaba8060 ChangeLog
--- a/ChangeLog Wed Apr 20 11:48:16 2011 -0400
+++ b/ChangeLog Wed Apr 20 14:35:13 2011 -0400
@@ -1,3 +1,9 @@
+2011-04-20 Andrew Su <asu at redhat.com>
+
+ * netx/net/sourceforge/jnlp/controlpanel/CachePane.java:
+ (createButtonPanel): Added check to delete button for whether plugin
+ or javaws is not running before proceeding with delete.
+
2011-04-20 Andrew Su <asu at redhat.com>
* netx/net/sourceforge/jnlp/cache/CacheUtil.java:
diff -r 6e89f860a35a -r f0cccaba8060 netx/net/sourceforge/jnlp/controlpanel/CachePane.java
--- a/netx/net/sourceforge/jnlp/controlpanel/CachePane.java Wed Apr 20 11:48:16 2011 -0400
+++ b/netx/net/sourceforge/jnlp/controlpanel/CachePane.java Wed Apr 20 14:35:13 2011 -0400
@@ -26,6 +26,10 @@
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.nio.channels.FileLock;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
@@ -125,8 +129,25 @@
deleteButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
+ FileLock fl = null;
+ File netxRunningFile = new File(config.getProperty(DeploymentConfiguration.KEY_USER_NETX_RUNNING_FILE));
+ if (!netxRunningFile.exists()) {
+ try {
+ FileUtils.createParentDir(netxRunningFile);
+ FileUtils.createRestrictedFile(netxRunningFile, true);
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ try {
+ fl = FileUtils.getFileLock(netxRunningFile.getPath(), false, false);
+ } catch (FileNotFoundException e1) {
+ }
+
int row = cacheTable.getSelectedRow();
try {
+ if (fl == null) return;
if (row == -1 || row > cacheTable.getRowCount() - 1)
return;
int modelRow = cacheTable.convertRowIndexToModel(row);
@@ -141,6 +162,15 @@
} catch (Exception exception) {
//ignore
}
+
+ if (fl != null) {
+ try {
+ fl.release();
+ fl.channel().close();
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ }
}
});
buttons.add(deleteButton);
More information about the distro-pkg-dev
mailing list