/hg/icedtea-web: New, simplified PolicyEditor

aazores at icedtea.classpath.org aazores at icedtea.classpath.org
Thu Feb 20 08:25:30 PST 2014


changeset 877209479c2f in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=877209479c2f
author: Andrew Azores <aazores at redhat.com>
date: Thu Feb 20 11:25:01 2014 -0500

	New, simplified PolicyEditor

	New simplified PolicyEditor for editing Java policy files, particularly
	user-level JNLP policies.
	* Makefile.am: added policyeditor launcher targets
	* netx/net/sourceforge/jnlp/controlpanel/PolicyPanel.java:
	(OpenFileResult, canOpenPolicyFile, testPolicyFileDirectory,
	showCouldNotOpenFileDialog, showReadOnlyDialog) moved into FileUtils.
	(PolicyPanel) added button for PolicyEditor. (launchSimplePolicyEditor)
	new function. (LaunchSimplePolicyEditorAction) new class, action for new
	button.
	* netx/net/sourceforge/jnlp/resources/Messages.properties: new messages
	for PolicyEditor
	* netx/net/sourceforge/jnlp/util/FileUtils.java: (OpenFileResult,
	testDirectoryPermissions, testFilePermissions, showReadOnlyDialog,
	showCouldNotOpenFileDialog) new functions
	* netx/net/sourceforge/jnlp/security/policyeditor/CustomPermission.java:
	new class
	* netx/net/sourceforge/jnlp/security/policyeditor/CustomPolicyViewer.java:
	new class
	* netx/net/sourceforge/jnlp/security/policyeditor/PermissionActions.java:
	new class
	* netx/net/sourceforge/jnlp/security/policyeditor/PermissionTarget.java:
	new class
	* netx/net/sourceforge/jnlp/security/policyeditor/PermissionType.java: new
	class
	* netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java: new
	class
	* netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditorPermissions.java:
	new class
	* netx/net/sourceforge/jnlp/security/policyeditor/PolicyEntry.java: new
	class
	* policyeditor.desktop.in: new launcher desktop file
	* tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/CustomPermissionTest.java:
	new class
	* tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PermissionActionsTest.java:
	new class
	* tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PermissionTargetTest.java:
	new class
	* tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PermissionTypeTest.java:
	new class
	* tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PolicyEditorPermissionsTest.java:
	new class
	* tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PolicyEditorTest.java:
	new class


diffstat:

 ChangeLog                                                                                   |   46 +
 Makefile.am                                                                                 |   20 +-
 netx/net/sourceforge/jnlp/controlpanel/PolicyPanel.java                                     |  210 +-
 netx/net/sourceforge/jnlp/resources/Messages.properties                                     |   81 +-
 netx/net/sourceforge/jnlp/security/policyeditor/CustomPermission.java                       |  130 +
 netx/net/sourceforge/jnlp/security/policyeditor/CustomPolicyViewer.java                     |  212 ++
 netx/net/sourceforge/jnlp/security/policyeditor/PermissionActions.java                      |   89 +
 netx/net/sourceforge/jnlp/security/policyeditor/PermissionTarget.java                       |   72 +
 netx/net/sourceforge/jnlp/security/policyeditor/PermissionType.java                         |   72 +
 netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java                           |  956 ++++++++++
 netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditorPermissions.java                |  203 ++
 netx/net/sourceforge/jnlp/security/policyeditor/PolicyEntry.java                            |  102 +
 netx/net/sourceforge/jnlp/util/FileUtils.java                                               |  146 +-
 policyeditor.desktop.in                                                                     |    9 +
 tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/CustomPermissionTest.java        |   85 +
 tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PermissionActionsTest.java       |   71 +
 tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PermissionTargetTest.java        |   58 +
 tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PermissionTypeTest.java          |   56 +
 tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PolicyEditorPermissionsTest.java |   66 +
 tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PolicyEditorTest.java            |  173 +
 20 files changed, 2707 insertions(+), 150 deletions(-)

diffs (truncated from 3125 to 500 lines):

diff -r db83ddf35fc0 -r 877209479c2f ChangeLog
--- a/ChangeLog	Wed Feb 19 15:39:02 2014 +0100
+++ b/ChangeLog	Thu Feb 20 11:25:01 2014 -0500
@@ -1,3 +1,49 @@
+2014-02-20  Andrew Azores  <aazores at redhat.com>
+
+	New simplified PolicyEditor for editing Java policy files, particularly
+	user-level JNLP policies.
+	* Makefile.am: added policyeditor launcher targets
+	* netx/net/sourceforge/jnlp/controlpanel/PolicyPanel.java:
+	(OpenFileResult, canOpenPolicyFile, testPolicyFileDirectory,
+	showCouldNotOpenFileDialog, showReadOnlyDialog) moved into FileUtils.
+	(PolicyPanel) added button for PolicyEditor. (launchSimplePolicyEditor)
+	new function. (LaunchSimplePolicyEditorAction) new class, action for new
+	button.
+	* netx/net/sourceforge/jnlp/resources/Messages.properties: new messages
+	for PolicyEditor
+	* netx/net/sourceforge/jnlp/util/FileUtils.java: (OpenFileResult,
+	testDirectoryPermissions, testFilePermissions, showReadOnlyDialog,
+	showCouldNotOpenFileDialog) new functions
+	* netx/net/sourceforge/jnlp/security/policyeditor/CustomPermission.java:
+	new class
+	* netx/net/sourceforge/jnlp/security/policyeditor/CustomPolicyViewer.java:
+	new class
+	* netx/net/sourceforge/jnlp/security/policyeditor/PermissionActions.java:
+	new class
+	* netx/net/sourceforge/jnlp/security/policyeditor/PermissionTarget.java:
+	new class
+	* netx/net/sourceforge/jnlp/security/policyeditor/PermissionType.java: new
+	class
+	* netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java: new
+	class
+	* netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditorPermissions.java:
+	new class
+	* netx/net/sourceforge/jnlp/security/policyeditor/PolicyEntry.java: new
+	class
+	* policyeditor.desktop.in: new launcher desktop file
+	* tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/CustomPermissionTest.java:
+	new class
+	* tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PermissionActionsTest.java:
+	new class
+	* tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PermissionTargetTest.java:
+	new class
+	* tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PermissionTypeTest.java:
+	new class
+	* tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PolicyEditorPermissionsTest.java:
+	new class
+	* tests/netx/unit/net/sourceforge/jnlp/security/policyeditor/PolicyEditorTest.java:
+	new class
+
 2014-02-19  Michal Vyskocil  <mvyskocil at suse.com>
 
 	Put link flags to the end of gcc command line to prevent link failures
diff -r db83ddf35fc0 -r 877209479c2f Makefile.am
--- a/Makefile.am	Wed Feb 19 15:39:02 2014 +0100
+++ b/Makefile.am	Thu Feb 20 11:25:01 2014 -0500
@@ -208,6 +208,7 @@
 # binary names
 javaws:= $(shell echo javaws | sed '@program_transform_name@')
 itweb_settings:= $(shell echo itweb-settings | sed '@program_transform_name@')
+policyeditor:= $(shell echo policyeditor | sed '@program_transform_name@')
 
 # the launcher needs to know $(bindir) and $(datadir) which can be different at
 # make-time from configure-time
@@ -224,7 +225,8 @@
 # =================
 
 all-local: stamps/netx-dist.stamp stamps/plugin.stamp launcher.build/$(javaws) \
- javaws.desktop stamps/docs.stamp launcher.build/$(itweb_settings) itweb-settings.desktop
+ javaws.desktop stamps/docs.stamp launcher.build/$(itweb_settings) itweb-settings.desktop \
+ launcher.build/$(policyeditor) policyeditor.desktop
 
 check-local: $(RHINO_TESTS) $(JUNIT_TESTS)
 
@@ -249,6 +251,7 @@
 	${INSTALL_DATA} $(NETX_SRCDIR)/javaws_splash.png $(DESTDIR)$(datadir)/$(PACKAGE_NAME)/javaws_splash.png
 	${INSTALL_PROGRAM} launcher.build/$(javaws) $(DESTDIR)$(bindir)
 	${INSTALL_PROGRAM} launcher.build/$(itweb_settings) $(DESTDIR)$(bindir)
+	${INSTALL_PROGRAM} launcher.build/$(policyeditor) $(DESTDIR)$(bindir)
 
 install-data-local:
 	${mkinstalldirs} -d $(DESTDIR)$(mandir)/man1
@@ -276,6 +279,7 @@
 	rm -f $(DESTDIR)$(mandir)/man1/javaws.1
 	rm -f $(DESTDIR)$(bindir)/$(javaws)
 	rm -f $(DESTDIR)$(bindir)/$(itweb_settings)
+	rm -f $(DESTDIR)$(bindir)/$(policyeditor)
 	rm -rf $(DESTDIR)$(htmldir)
 
 # Plugin
@@ -531,9 +535,17 @@
 	PROGRAM_NAME=$(itweb_settings) ;\
 	$(edit_launcher_script) < $< > $@
 
+launcher.build/$(policyeditor): launcher/launchers.in
+	mkdir -p launcher.build
+	MAIN_CLASS=net.sourceforge.jnlp.security.policyeditor.PolicyEditor ;\
+	BIN_LOCATION=$(bindir)/$(policyeditor) ;\
+	PROGRAM_NAME=$(policyeditor) ;\
+	$(edit_launcher_script) < $< > $@
+
 clean-launchers:
 	rm -f launcher.build/$(javaws)
 	rm -f launcher.build/$(itweb_settings)
+	rm -f launcher.build/$(policyeditor)
 	if [ -e launcher.build ] ; then \
 	  rmdir launcher.build ; \
 	fi
@@ -545,6 +557,10 @@
 	sed "s#PATH_TO_ITWEB_SETTINGS#$(bindir)/$(itweb_settings)#" \
 	  < $(srcdir)/itweb-settings.desktop.in > itweb-settings.desktop
 
+policyeditor.desktop: $(srcdir)/policyeditor.desktop.in
+	sed 's#PATH_TO_POLICYEDITOR#$(bindir)/$(policyeditor)#' \
+	< $(srcdir)/policyeditor.desktop.in > policyeditor.desktop
+
 # documentation
 
 stamps/docs.stamp: stamps/netx-docs.stamp stamps/plugin-docs.stamp
@@ -870,7 +886,7 @@
 	mv $(SOFTKILLER) $(TESTS_DIR)/
 
 stamps/run-netx-dist-tests.stamp: stamps/netx-dist.stamp stamps/plugin.stamp launcher.build/$(javaws) \
- javaws.desktop stamps/docs.stamp launcher.build/$(itweb_settings) itweb-settings.desktop \
+ javaws.desktop stamps/docs.stamp launcher.build/$(itweb_settings) itweb-settings.desktop launcher.build/$(policyeditor) policyeditor.desktop \
  stamps/netx.stamp stamps/junit-jnlp-dist-dirs stamps/netx-dist-tests-import-cert-to-public $(TESTS_DIR)/softkiller \
  stamps/test-extensions-compile.stamp stamps/compile-reproducers-testcases.stamp $(JUNIT_RUNNER_JAR) stamps/copy-reproducers-resources.stamp\
  $(TESTS_DIR)/$(REPORT_STYLES_DIRNAME) $(REPRODUCERS_CLASS_NAMES) stamps/process-custom-reproducers.stamp
diff -r db83ddf35fc0 -r 877209479c2f netx/net/sourceforge/jnlp/controlpanel/PolicyPanel.java
--- a/netx/net/sourceforge/jnlp/controlpanel/PolicyPanel.java	Wed Feb 19 15:39:02 2014 +0100
+++ b/netx/net/sourceforge/jnlp/controlpanel/PolicyPanel.java	Thu Feb 20 11:25:01 2014 -0500
@@ -49,8 +49,6 @@
 import java.lang.reflect.Method;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
 
 import javax.swing.Box;
 import javax.swing.JButton;
@@ -61,9 +59,9 @@
 import javax.swing.SwingUtilities;
 
 import net.sourceforge.jnlp.config.DeploymentConfiguration;
-import net.sourceforge.jnlp.config.DirectoryValidator;
-import net.sourceforge.jnlp.config.DirectoryValidator.DirectoryCheckResults;
+import net.sourceforge.jnlp.security.policyeditor.PolicyEditor;
 import net.sourceforge.jnlp.util.FileUtils;
+import net.sourceforge.jnlp.util.FileUtils.OpenFileResult;
 import net.sourceforge.jnlp.util.logging.OutputController;
 
 /**
@@ -74,22 +72,7 @@
  */
 public class PolicyPanel extends NamedBorderPanel {
 
-    /**
-     * Indicates whether a file was successfully opened. If not, provides specific reasons
-     * along with a general failure case
-     */
-    private enum OpenFileResult {
-        /** The file was successfully opened */
-        SUCCESS,
-        /** The file could not be opened, for non-specified reasons */
-        FAILURE,
-        /** The file could not be opened because it did not exist and could not be created */
-        CANT_CREATE,
-        /** The file can be opened but in read-only */
-        CANT_WRITE,
-        /** The specified path pointed to a non-file filesystem object, ie a directory */
-        NOT_FILE
-    }
+    private PolicyEditor policyEditor = null;
 
     public PolicyPanel(final JFrame frame, final DeploymentConfiguration config) {
         super(R("CPHeadPolicy"), new GridBagLayout());
@@ -100,11 +83,14 @@
         JLabel aboutLabel = new JLabel("<html>" + R("CPPolicyDetail") + "</html>");
 
         final String fileUrlString = config.getProperty(DeploymentConfiguration.KEY_USER_SECURITY_POLICY);
-        final JButton showUserPolicyButton = new JButton(R("CPButPolicy"));
-        showUserPolicyButton.addActionListener(new ViewPolicyButtonAction(frame, fileUrlString));
+        final JButton simpleEditorButton = new JButton(R("CPButSimpleEditor"));
+        simpleEditorButton.addActionListener(new LaunchSimplePolicyEditorAction(frame, fileUrlString));
+
+        final JButton advancedEditorButton = new JButton(R("CPButAdvancedEditor"));
+        advancedEditorButton.addActionListener(new LaunchPolicyToolAction(frame, fileUrlString));
 
         final String pathPart = localFilePathFromUrlString(fileUrlString);
-        showUserPolicyButton.setToolTipText(R("CPPolicyTooltip", FileUtils.displayablePath(pathPart, 60)));
+        simpleEditorButton.setToolTipText(R("CPPolicyTooltip", FileUtils.displayablePath(pathPart, 60)));
 
         final JTextField locationField = new JTextField(pathPart);
         locationField.setEditable(false);
@@ -123,7 +109,10 @@
 
         c.fill = GridBagConstraints.NONE;
         c.gridx++;
-        add(showUserPolicyButton, c);
+        add(simpleEditorButton, c);
+        c.gridx++;
+        add(advancedEditorButton, c);
+        c.gridx--;
 
         /* Keep all the elements at the top of the panel (Extra padding)
          * Keep View/Edit button next to location field, with padding between
@@ -148,18 +137,36 @@
     private static void launchPolicyTool(final JFrame frame, final String filePath) {
         try {
             final File policyFile = new File(filePath).getCanonicalFile();
-            final OpenFileResult result = canOpenPolicyFile(policyFile);
+            final OpenFileResult result = FileUtils.testFilePermissions(policyFile);
             if (result == OpenFileResult.SUCCESS) {
                 policyToolLaunchHelper(frame, filePath);
             } else if (result == OpenFileResult.CANT_WRITE) {
-                showReadOnlyDialog(frame);
+                OutputController.getLogger().log(OutputController.Level.WARNING_ALL, "Opening user JNLP policy read-only");
+                FileUtils.showReadOnlyDialog(frame);
                 policyToolLaunchHelper(frame, filePath);
             } else {
-                showCouldNotOpenFileDialog(frame, policyFile.getPath(), result);
+                OutputController.getLogger().log(OutputController.Level.ERROR_ALL, "Could not open user JNLP policy");
+                FileUtils.showCouldNotOpenFileDialog(frame, policyFile.getPath(), result);
             }
         } catch (IOException e) {
             OutputController.getLogger().log(e);
-            showCouldNotOpenFileDialog(frame, filePath);
+            OutputController.getLogger().log(OutputController.Level.ERROR_ALL, "Could not open user JNLP policy");
+            FileUtils.showCouldNotOpenFilepathDialog(frame, filePath);
+        }
+    }
+
+    /**
+     * Launch the simplified PolicyEditor for a specified file path
+     * @param frame a {@link JFrame} to act as parent to warning dialogs which may appear
+     * @param filePath a {@link String} representing the path to the file to be opened
+     */
+    private void launchSimplePolicyEditor(final String filePath) {
+        if (policyEditor == null || policyEditor.isClosed()) {
+            policyEditor = PolicyEditor.createInstance(filePath);
+            policyEditor.setVisible(true);
+        } else {
+            policyEditor.toFront();
+            policyEditor.repaint();
         }
     }
 
@@ -189,7 +196,8 @@
                         reflectivePolicyToolLaunch(filePath);
                     } catch (Exception e) {
                         OutputController.getLogger().log(e);
-                        showCouldNotOpenFileDialog(frame, filePath, R("CPPolicyEditorNotFound"));
+                        OutputController.getLogger().log(OutputController.Level.ERROR_ALL, "Could not open user JNLP policy");
+                        FileUtils.showCouldNotOpenDialog(frame, R("CPPolicyEditorNotFound"));
                     }
                 }
             }
@@ -221,116 +229,6 @@
     }
 
     /**
-     * Verify that a given file object points to a real, accessible plain file.
-     * As a side effect, if the file is accessible but does not yet exist, it will be created
-     * as an empty plain file.
-     * @param policyFile the {@link File} to verify
-     * @return an {@link OpenFileResult} representing the accessibility level of the file
-     * @throws IOException if the file is not accessible
-     */
-    private static OpenFileResult canOpenPolicyFile(final File policyFile) {
-        final DirectoryCheckResults dcr = testPolicyFileDirectory(policyFile);
-        if (dcr.getFailures() == 0) {
-            if (policyFile.isDirectory())
-                return OpenFileResult.NOT_FILE;
-            try {
-                if (!policyFile.exists() && !policyFile.createNewFile()) {
-                    return OpenFileResult.CANT_CREATE;
-                }
-            } catch (IOException e) {
-                return OpenFileResult.CANT_CREATE;
-            }
-            final boolean read = policyFile.canRead(), write = policyFile.canWrite();
-            if (read && write)
-                return OpenFileResult.SUCCESS;
-            else if (read)
-                return OpenFileResult.CANT_WRITE;
-            else
-                return OpenFileResult.FAILURE;
-        }
-        return OpenFileResult.FAILURE;
-    }
-
-    /**
-     * Ensure that the parent directory of the Policy File exists and that we are
-     * able to create and access files within this directory
-     * @param policyFile the {@link File} representing a Java Policy file to test
-     * @return a {@link DirectoryCheckResults} object representing the results of the test
-     */
-    private static DirectoryCheckResults testPolicyFileDirectory(final File policyFile) {
-        final List<File> policyDirectory = new ArrayList<File>();
-        policyDirectory.add(policyFile.getParentFile());
-        final DirectoryValidator validator = new DirectoryValidator(policyDirectory);
-        final DirectoryCheckResults result = validator.ensureDirs();
-
-        return result;
-    }
-
-    /**
-     * Show a generic error dialog indicating the policy file could not be opened
-     * @param frame a {@link JFrame} to act as parent to this dialog
-     * @param filePath a {@link String} representing the path to the file we failed to open
-     */
-    private static void showCouldNotOpenFileDialog(final JFrame frame, final String filePath) {
-        showCouldNotOpenFileDialog(frame, filePath, OpenFileResult.FAILURE);
-    }
-
-    /**
-     * Show an error dialog indicating the policy file could not be opened, with a particular reason
-     * @param frame a {@link JFrame} to act as parent to this dialog
-     * @param filePath a {@link String} representing the path to the file we failed to open
-     * @param reason a {@link OpenFileResult} specifying more precisely why we failed to open the file
-     */
-    private static void showCouldNotOpenFileDialog(final JFrame frame, final String filePath, final OpenFileResult reason) {
-        final String message;
-        switch (reason) {
-            case CANT_CREATE:
-                message = R("RCantCreateFile", filePath);
-                break;
-            case CANT_WRITE:
-                message = R("RCantWriteFile", filePath);
-                break;
-            case NOT_FILE:
-                message = R("RExpectedFile", filePath);
-                break;
-            default:
-                message = R("RCantOpenFile", filePath);
-                break;
-        }
-        showCouldNotOpenFileDialog(frame, filePath, message);
-    }
-
-    /**
-     * Show a dialog informing the user that the policy file could not be opened
-     * @param frame a {@link JFrame} to act as parent to this dialog
-     * @param filePath a {@link String} representing the path to the file we failed to open
-     * @param message a {@link String} giving the specific reason the file could not be opened
-     */
-    private static void showCouldNotOpenFileDialog(final JFrame frame, final String filePath, final String message) {
-        OutputController.getLogger().log(OutputController.Level.ERROR_ALL, "Could not open user JNLP policy");
-        SwingUtilities.invokeLater(new Runnable() {
-            @Override
-            public void run() {
-                JOptionPane.showMessageDialog(frame, message, R("Error"), JOptionPane.ERROR_MESSAGE);
-            }
-        });
-    }
-
-    /**
-     * Show a dialog informing the user that the policy file is currently read-only
-     * @param frame a {@link JFrame} to act as parent to this dialog
-     */
-    private static void showReadOnlyDialog(final JFrame frame) {
-        OutputController.getLogger().log(OutputController.Level.WARNING_ALL, "Opening user JNLP policy read-only");
-        SwingUtilities.invokeLater(new Runnable() {
-            @Override
-            public void run() {
-                JOptionPane.showMessageDialog(frame, R("RFileReadOnly"), R("Warning"), JOptionPane.WARNING_MESSAGE);
-            }
-        });
-    }
-
-    /**
      * Loosely attempt to get the path part of a file URL string. If this fails,
      * simply return back the input. This is only intended to be used for displaying
      * GUI elements such as the CPPolicyTooltip.
@@ -347,13 +245,13 @@
     }
 
     /**
-     * Implements the action to be performed when the "View Policy" button is clicked
+     * Implements the action to be performed when the "Advanced" button is clicked
      */
-    private class ViewPolicyButtonAction implements ActionListener {
+    private class LaunchPolicyToolAction implements ActionListener {
         private final JFrame frame;
         private final String fileUrlString;
 
-        public ViewPolicyButtonAction(final JFrame frame, final String fileUrlString) {
+        public LaunchPolicyToolAction(final JFrame frame, final String fileUrlString) {
             this.fileUrlString = fileUrlString;
             this.frame = frame;
         }
@@ -370,7 +268,33 @@
                 });
             } catch (MalformedURLException ex) {
                 OutputController.getLogger().log(ex);
-                showCouldNotOpenFileDialog(frame, fileUrlString);
+                FileUtils.showCouldNotOpenFilepathDialog(frame, fileUrlString);
+            }
+        }
+    }
+
+    private class LaunchSimplePolicyEditorAction implements ActionListener {
+        private final JFrame frame;
+        private final String fileUrlString;
+
+        public LaunchSimplePolicyEditorAction(final JFrame frame, final String fileUrlString) {
+            this.fileUrlString = fileUrlString;
+            this.frame = frame;
+        }
+
+        @Override
+        public void actionPerformed(final ActionEvent event) {
+            try {
+                final URL fileUrl = new URL(fileUrlString);
+                SwingUtilities.invokeLater(new Runnable() {
+                    @Override
+                    public void run() {
+                        launchSimplePolicyEditor(fileUrl.getPath());
+                    }
+                });
+            } catch (MalformedURLException ex) {
+                OutputController.getLogger().log(ex);
+                FileUtils.showCouldNotOpenFilepathDialog(frame, fileUrlString);
             }
         }
     }
diff -r db83ddf35fc0 -r 877209479c2f netx/net/sourceforge/jnlp/resources/Messages.properties
--- a/netx/net/sourceforge/jnlp/resources/Messages.properties	Wed Feb 19 15:39:02 2014 +0100
+++ b/netx/net/sourceforge/jnlp/resources/Messages.properties	Thu Feb 20 11:25:01 2014 -0500
@@ -370,7 +370,8 @@
 CPButSettings=Settings...
 CPButView=View...
 CPButCertificates=Certificates...
-CPButPolicy=View/Edit with Policy Tool
+CPButSimpleEditor=Simple editor
+CPButAdvancedEditor=Advanced editor
 
 # Control Panel - Headers
 CPHead=IcedTea-Web Control Panel
@@ -438,6 +439,84 @@
 DPJavaConsole=Java Console
 DPJavaConsoleDisabledHint=Java console is disabled. Use itweb-settings to configure it out of disabled to any show or hide value.
 
+# PolicyEditor
+PEUsage=policyeditor [-file policyfile]
+PEHelpFlag=Print this message and exit
+PEFileFlag=Specify a policyfile path to open
+PETitle=Policy Editor
+PEReadProps=Read system properties
+PEReadPropsDetail=Allow applets to read system properties such as your username and home directory location
+PEReadFiles=Read from local files
+PEReadFilesDetail=Allow applets to read from files in your home directory
+PEWriteFiles=Write to local files
+PEWriteFilesDetail=Allow applets to write to files in your home directory
+PEReadSystemFiles=Read all system files
+PEReadSystemFilesDetail=Allow applets read-only access to all locations on your computer
+PEReadTempFiles=Read from temp files
+PEReadTempFilesDetail=Allow applets to read from your temporary files directory
+PEWriteTempFiles=Write to temp files
+PEWriteTempFilesDetail=Allow applets to write to your temporary files directory
+PEClipboard=Access clipboard
+PEClipboardDetail=Allow applets to read from and write to your clipboard
+PENetwork=Access the network
+PENetworkDetail=Allow applets to establish any network connections
+PEPrint=Print documents
+PEPrintDetail=Allow applets to queue print jobs
+PEAudio=Play sounds
+PEAudioDetail=Allow applets to play sounds, but not record
+PECouldNotOpen=Unable to open policy file
+PECouldNotSave=Unable to save policy file
+PEAddCodebase=Add new Codebase
+PERemoveCodebase=Remove
+PECodebasePrompt=Enter a new codebase
+PEGlobalSettings=All Applets
+PESaveChanges=Save changes before exiting?
+PEChangesSaved=Changes saved
+PECheckboxLabel=Permissions
+PECodebaseLabel=Codebases
+PEFileMenu=File
+PEOpenMenuItem=Open...
+PESaveMenuItem=Save
+PESaveAsMenuItem=Save As...
+PEExitMenuItem=Exit
+PEViewMenu=View
+PECustomPermissionsItem=Custom Permissions...
+
+# Policy Editor CustomPolicyViewer
+PECPTitle=Custom Policy Viewer
+PECPListLabel=Other policies for {0}
+PECPAddButton=Add
+PECPRemoveButton=Remove
+PECPCloseButton=Close
+PECPType=type
+PECPTarget=target
+PECPActions=actions
+PECPPrompt=Enter a custom permission. Do not include \"permission\" or punctuation marks.
+
+# PolicyEditor key mnemonics. See KeyEvent.VK_*
+# N
+PEAddCodebaseMnemonic=78


More information about the distro-pkg-dev mailing list