diff options
Diffstat (limited to 'netx/net/sourceforge/jnlp/services')
5 files changed, 17 insertions, 20 deletions
diff --git a/netx/net/sourceforge/jnlp/services/ServiceUtil.java b/netx/net/sourceforge/jnlp/services/ServiceUtil.java index a384f27..bb41f1b 100644 --- a/netx/net/sourceforge/jnlp/services/ServiceUtil.java +++ b/netx/net/sourceforge/jnlp/services/ServiceUtil.java @@ -40,7 +40,8 @@ import javax.jnlp.UnavailableServiceException; import net.sourceforge.jnlp.JNLPFile; import net.sourceforge.jnlp.runtime.ApplicationInstance; import net.sourceforge.jnlp.runtime.JNLPRuntime; -import net.sourceforge.jnlp.security.SecurityWarningDialog; +import net.sourceforge.jnlp.security.SecurityWarning; +import net.sourceforge.jnlp.security.SecurityWarning.AccessType; /** * Provides static methods to interact useful for using the JNLP @@ -219,8 +220,7 @@ public class ServiceUtil { * message formatting. * @return true if the access was granted, false otherwise. */ - public static boolean checkAccess(SecurityWarningDialog.AccessType type, - Object... extras) { + public static boolean checkAccess(AccessType type, Object... extras) { return checkAccess(null, type, extras); } @@ -235,8 +235,7 @@ public class ServiceUtil { * message formatting. * @return true if the access was granted, false otherwise. */ - public static boolean checkAccess(ApplicationInstance app, - SecurityWarningDialog.AccessType type, + public static boolean checkAccess(ApplicationInstance app, AccessType type, Object... extras) { if (app == null) @@ -270,7 +269,7 @@ public class ServiceUtil { } if (!codeTrusted) { - final SecurityWarningDialog.AccessType tmpType = type; + final AccessType tmpType = type; final Object[] tmpExtras = extras; final ApplicationInstance tmpApp = app; @@ -279,7 +278,7 @@ public class ServiceUtil { //from resources.jar. Boolean b = AccessController.doPrivileged(new PrivilegedAction<Boolean>() { public Boolean run() { - boolean b = SecurityWarningDialog.showAccessWarningDialog(tmpType, + boolean b = SecurityWarning.showAccessWarningDialog(tmpType, tmpApp.getJNLPFile(), tmpExtras); return new Boolean(b); } diff --git a/netx/net/sourceforge/jnlp/services/XClipboardService.java b/netx/net/sourceforge/jnlp/services/XClipboardService.java index 860d859..b00e6da 100644 --- a/netx/net/sourceforge/jnlp/services/XClipboardService.java +++ b/netx/net/sourceforge/jnlp/services/XClipboardService.java @@ -39,7 +39,7 @@ package net.sourceforge.jnlp.services; import javax.jnlp.*; -import net.sourceforge.jnlp.security.SecurityWarningDialog; +import net.sourceforge.jnlp.security.SecurityWarning.AccessType; import java.awt.datatransfer.Transferable; import java.awt.Toolkit; @@ -59,7 +59,7 @@ class XClipboardService implements ClipboardService { */ public java.awt.datatransfer.Transferable getContents(){ - if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.CLIPBOARD_READ)) { + if (ServiceUtil.checkAccess(AccessType.CLIPBOARD_READ)) { Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null); return (Transferable) ServiceUtil.createPrivilegedProxy( Transferable.class, t); @@ -72,7 +72,7 @@ class XClipboardService implements ClipboardService { * Sets the contents of the system clipboard. */ public void setContents(java.awt.datatransfer.Transferable contents) { - if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.CLIPBOARD_WRITE)) { + if (ServiceUtil.checkAccess(AccessType.CLIPBOARD_WRITE)) { Toolkit.getDefaultToolkit().getSystemClipboard().setContents( contents, null); } diff --git a/netx/net/sourceforge/jnlp/services/XExtendedService.java b/netx/net/sourceforge/jnlp/services/XExtendedService.java index 9eafba5..296740d 100644 --- a/netx/net/sourceforge/jnlp/services/XExtendedService.java +++ b/netx/net/sourceforge/jnlp/services/XExtendedService.java @@ -22,7 +22,7 @@ import java.io.IOException; import javax.jnlp.ExtendedService; import javax.jnlp.FileContents; -import net.sourceforge.jnlp.security.SecurityWarningDialog; +import net.sourceforge.jnlp.security.SecurityWarning.AccessType; /** * Implementation of ExtendedService @@ -35,8 +35,7 @@ public class XExtendedService implements ExtendedService { public FileContents openFile(File file) throws IOException { /* FIXME: this opens a file with read/write mode, not just read or write */ - if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.READ_FILE, - new Object[]{ file.getAbsolutePath() })) { + if (ServiceUtil.checkAccess(AccessType.READ_FILE, new Object[]{ file.getAbsolutePath() })) { return (FileContents) ServiceUtil.createPrivilegedProxy(FileContents.class, new XFileContents(file)); } else { diff --git a/netx/net/sourceforge/jnlp/services/XFileOpenService.java b/netx/net/sourceforge/jnlp/services/XFileOpenService.java index 8f2c110..61d2bdb 100644 --- a/netx/net/sourceforge/jnlp/services/XFileOpenService.java +++ b/netx/net/sourceforge/jnlp/services/XFileOpenService.java @@ -45,7 +45,7 @@ import javax.jnlp.*; import net.sourceforge.jnlp.*; import net.sourceforge.jnlp.runtime.*; -import net.sourceforge.jnlp.security.SecurityWarningDialog; +import net.sourceforge.jnlp.security.SecurityWarning.AccessType; import javax.swing.JFileChooser; import javax.swing.JOptionPane; @@ -67,7 +67,7 @@ class XFileOpenService implements FileOpenService { public FileContents openFileDialog (java.lang.String pathHint, java.lang.String[] extensions) throws java.io.IOException { - if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.READ_FILE)) { + if (ServiceUtil.checkAccess(AccessType.READ_FILE)) { //open a file dialog here, let the user choose the file. JFileChooser chooser = new JFileChooser(); @@ -90,7 +90,7 @@ class XFileOpenService implements FileOpenService { public FileContents[] openMultiFileDialog (java.lang.String pathHint, java.lang.String[] extensions) throws java.io.IOException { - if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.WRITE_FILE)) { + if (ServiceUtil.checkAccess(AccessType.WRITE_FILE)) { JFileChooser chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(true); int chosen = chooser.showOpenDialog(null); diff --git a/netx/net/sourceforge/jnlp/services/XFileSaveService.java b/netx/net/sourceforge/jnlp/services/XFileSaveService.java index d3fbe2e..dc4fdc0 100644 --- a/netx/net/sourceforge/jnlp/services/XFileSaveService.java +++ b/netx/net/sourceforge/jnlp/services/XFileSaveService.java @@ -43,8 +43,7 @@ import java.util.*; import java.lang.ref.*; import javax.jnlp.*; -import net.sourceforge.jnlp.*; -import net.sourceforge.jnlp.security.*; +import net.sourceforge.jnlp.security.SecurityWarning.AccessType; import javax.swing.JFileChooser; import javax.swing.JOptionPane; @@ -67,7 +66,7 @@ class XFileSaveService implements FileSaveService { java.lang.String[] extensions, java.io.InputStream stream, java.lang.String name) throws java.io.IOException { - if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.WRITE_FILE)) { + if (ServiceUtil.checkAccess(AccessType.WRITE_FILE)) { JFileChooser chooser = new JFileChooser(); int chosen = chooser.showSaveDialog(null); @@ -90,7 +89,7 @@ class XFileSaveService implements FileSaveService { public FileContents saveAsFileDialog(java.lang.String pathHint, java.lang.String[] extensions, FileContents contents) throws java.io.IOException { - if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.WRITE_FILE)) { + if (ServiceUtil.checkAccess(AccessType.WRITE_FILE)) { JFileChooser chooser = new JFileChooser(); chooser.setSelectedFile(new File(contents.getName())); int chosen = chooser.showSaveDialog(null); |