You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2008/06/30 23:21:58 UTC

svn commit: r672929 - in /harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool: ./ control/ model/ view/

Author: hindessm
Date: Mon Jun 30 14:21:58 2008
New Revision: 672929

URL: http://svn.apache.org/viewvc?rev=672929&view=rev
Log:
Formatting only change.
Fixing the layout of the header to be consistent with other source files.
Converting tabs to four spaces.

Modified:
    harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/Consts.java
    harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/Main.java
    harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/control/Controller.java
    harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/control/PolicyFileHandler.java
    harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/CommentEntry.java
    harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/KeystoreEntry.java
    harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/KeystorePasswordURLEntry.java
    harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/PolicyEntry.java
    harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/DirectTextEditorPanel.java
    harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/EditorPanel.java
    harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/GraphicalEditorPanel.java
    harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/MainFrame.java

Modified: harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/Consts.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/Consts.java?rev=672929&r1=672928&r2=672929&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/Consts.java (original)
+++ harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/Consts.java Mon Jun 30 14:21:58 2008
@@ -6,13 +6,13 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  * 
- * http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.harmony.tools.policytool;
@@ -21,16 +21,16 @@
  * Holds general and application-wide constants.
  */
 public class Consts {
-	
-	/** Name of the application. */
-	public static final String APPLICATION_NAME = "Policytool";
-	
-	/** X coordinate of the main frame on startup. */
-	public static final int MAIN_FRAME_START_POS_X = 200;
-	/** Y coordinate of the main frame on startup. */
-	public static final int MAIN_FRAME_START_POS_Y = 100;
-	
-	/** Font size in the direct editing panel.     */
-	public static final int DIRECT_EDITING_FONT_SIZE = 13;
-	
+
+    /** Name of the application. */
+    public static final String APPLICATION_NAME = "Policytool";
+
+    /** X coordinate of the main frame on startup. */
+    public static final int MAIN_FRAME_START_POS_X = 200;
+    /** Y coordinate of the main frame on startup. */
+    public static final int MAIN_FRAME_START_POS_Y = 100;
+
+    /** Font size in the direct editing panel.     */
+    public static final int DIRECT_EDITING_FONT_SIZE = 13;
+
 }

Modified: harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/Main.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/Main.java?rev=672929&r1=672928&r2=672929&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/Main.java (original)
+++ harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/Main.java Mon Jun 30 14:21:58 2008
@@ -6,13 +6,13 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  * 
- * http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.harmony.tools.policytool;
@@ -20,30 +20,30 @@
 import org.apache.harmony.tools.policytool.view.MainFrame;
 
 /**
- * The main class that parses command line parameters, and starts the GUI if everything everything is ok.
- * 
+ * The main class that parses command line parameters, and starts the
+ * GUI if everything everything is ok.
  */
 public class Main {
-	
-	/** Name of policy file to be loaded initially. */
-	private static String policyFileName;
-	
+
+    /** Name of policy file to be loaded initially. */
+    private static String policyFileName;
+
     /**
      * Entry point of the program.
      * 
      * @param arguments used to take arguments from the running environment
      */
     public static void main( final String[] arguments ) {
-    	
-    	if ( processArguments( arguments ) ) {
-    		if ( policyFileName == null )
-    			new MainFrame().setVisible( true );
-    		else
-    			new MainFrame( policyFileName ).setVisible( true );
-    	}
-    	
+
+        if ( processArguments( arguments ) ) {
+            if ( policyFileName == null )
+                new MainFrame().setVisible( true );
+            else
+                new MainFrame( policyFileName ).setVisible( true );
+        }
+
     }
-    
+
     /**
      * Processes the command line arguments.<br>
      * Currently only one option is supported:
@@ -55,46 +55,44 @@
      *         false if there were missing or invalid arguments, or no GUI launch is needed
      */
     private static boolean processArguments( final String[] arguments ) {
-    	if ( arguments.length == 0 )
-    		return true;
-    	
-    	else {
-    		if ( arguments[ 0 ].startsWith( "-" ) ) // If it is a "real" option
-	    		if ( arguments[ 0 ].equalsIgnoreCase( "-file" ) ) {
-	    			if ( arguments.length < 2 ) {   // policy file name must be provided
-	    				printErrorMessageAndUsage( "Missing policy file name!" );
-	    				return false;
-	    			}
-	    			else {
-	    				policyFileName = arguments[ 1 ];
-	    				return true;
-	    			}
-	    		}
-	    		else {
-	    			printErrorMessageAndUsage( "Illegal option: " + arguments[ 0 ] );
-	    			return false;
-	    		}
-    		else
-    			return true;  // else the arguments are ignored
-    	}
+        if ( arguments.length == 0 )
+            return true;
+
+        else {
+            if ( arguments[ 0 ].startsWith( "-" ) ) // If it is a "real" option
+                if ( arguments[ 0 ].equalsIgnoreCase( "-file" ) ) {
+                    if ( arguments.length < 2 ) {   // policy file name must be provided
+                        printErrorMessageAndUsage( "Missing policy file name!" );
+                        return false;
+                    } else {
+                        policyFileName = arguments[ 1 ];
+                        return true;
+                    }
+                } else {
+                    printErrorMessageAndUsage( "Illegal option: " + arguments[ 0 ] );
+                    return false;
+                } else
+                    return true;  // else the arguments are ignored
+        }
     }
-    
+
     /**
-     * Prints an error message to the standard output followed by the program ussage.
+     * Prints an error message to the standard output followed by the
+     * program ussage.
      * @param errorMessage error message to be printed
      */
     private static void printErrorMessageAndUsage( final String errorMessage ) {
-    	System.out.println( errorMessage );
-    	printUsage();
+        System.out.println( errorMessage );
+        printUsage();
     }
-    
+
     /**
      * Prints the program usage to the standard output.
      */
     private static void printUsage() {
-    	System.out.println( "Usage: policytool [options]" );
-    	System.out.println();
-    	System.out.println( "  [-file <file>]    name of policy file to be loaded initially" );
+        System.out.println( "Usage: policytool [options]" );
+        System.out.println();
+        System.out.println( "  [-file <file>]    name of policy file to be loaded initially" );
     }
-    
+
 }

Modified: harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/control/Controller.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/control/Controller.java?rev=672929&r1=672928&r2=672929&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/control/Controller.java (original)
+++ harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/control/Controller.java Mon Jun 30 14:21:58 2008
@@ -6,13 +6,13 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  * 
- * http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.harmony.tools.policytool.control;
@@ -33,179 +33,178 @@
 import org.apache.harmony.tools.policytool.view.MainFrame.MenuItemEnum;
 
 /**
- * The controller handles the user actions, drives the GUI and connects it to the model.
+ * The controller handles the user actions, drives the GUI and
+ * connects it to the model.
  */
 public class Controller implements ChangeListener, ActionListener{
-	
-	/** Reference to the main frame component.    */
-	private final Component     mainFrame;
-	/** Array of the editor panels.               */
-	private final EditorPanel[] editorPanels;
-	/** Reference to the active editor panel.     */
-	private EditorPanel         activeEditorPanel;
-	
-	/** Reference to the keystore edit menu item. */
-	private JMenuItem           keystoreEditMenuItem;
-	
-	/** The currently edited policy file.         */
-	private File editedPolicyFile;
-	
-	/**
-	 * Creates a new Controller.
-	 * @param mainFrame reference to the main frame component
-	 * @param editorPanels array of the editor panels
-	 * @param policyFileName policy file name to be loaded initially
-	 */
-	public Controller( final Component mainFrame, final EditorPanel[] editorPanels, final String policyFileName ) {
-		this.mainFrame    = mainFrame;
-		this.editorPanels = editorPanels;
-		activeEditorPanel = editorPanels[ 0 ];
-		
-		PolicyFileHandler.setDialogParentComponent( mainFrame );
-		
-		editedPolicyFile = new File( policyFileName );
-		activeEditorPanel.loadPolicyText( PolicyFileHandler.loadPoilcyFile( editedPolicyFile ) );
-	}
-	
-	/**
-	 * Returns the array of editor panels.
-	 * @return the array of editor panels
-	 */
-	public EditorPanel[] getEditorPanels() {
-		return editorPanels;
-	}
-	
-	/**
-	 * Sets the keystore edit menu item.
-	 * @param keystoreEditMenuItem the keystore edit menu item
-	 */
-	public void setKeystoreEditMenuItem( final JMenuItem keystoreEditMenuItem ) {
-		this.keystoreEditMenuItem = keystoreEditMenuItem;
-		keystoreEditMenuItem.setEnabled( activeEditorPanel.supportsGraphicalKeystoreEdit() );
-	}
-	
-	/**
-	 * Exits from the program.<br>
-	 * There might be unsaved changes in which case confirmation will be asked.
-	 */
-	public void exit() {
-		boolean exitOk = false;
-		
-		if ( activeEditorPanel.getHasDirty() ) {
-			
-			switch ( JOptionPane.showConfirmDialog( mainFrame, "There are unsaved changes. Save before exit?", "Warning", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE ) ) {
-			
-			case JOptionPane.YES_OPTION:
-				final JFileChooser fileChooser = new JFileChooser();
-				
-				if ( editedPolicyFile == null ) {
-					if ( fileChooser.showSaveDialog( mainFrame ) == JFileChooser.APPROVE_OPTION )
-						editedPolicyFile = fileChooser.getSelectedFile();
-				}
-				if ( editedPolicyFile != null ) {
-					if ( !PolicyFileHandler.savePolicyFile( editedPolicyFile, activeEditorPanel.getPolicyText() ) ) {
-						switch ( JOptionPane.showConfirmDialog( mainFrame, "Saving failed. Do you still want to exit?", "Warning", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE ) ) {
-						case JOptionPane.YES_OPTION:
-							exitOk = true;
-							break;
-							
-						case JOptionPane.NO_OPTION:
-						case JOptionPane.CLOSED_OPTION:
-							// We chose not to exit. exitOk = false
-							break;
-						}
-					}
-					else {// Changes saved successfully
-						activeEditorPanel.setHasDirty( false );						
-						exitOk = true;
-					}
-				}
-				break;
-				
-			case JOptionPane.NO_OPTION:
-				exitOk = true;
-				break;
-				
-			case JOptionPane.CANCEL_OPTION:
-			case JOptionPane.CLOSED_OPTION:
-				// We chose not to exit. exitOk = false
-				break;
-				
-			}
-			
-		}
-		else
-			exitOk = true;
-		
-		if ( exitOk )
-			System.exit( 0 );
-	}
-	
-	/**
-	 * Handles change events of the editors tabbed pane.
-	 * @param ce details of the change event
-	 */
-	public void stateChanged( final ChangeEvent ce ) {
-		final EditorPanel newActiveEditorPanel = (EditorPanel) ( (JTabbedPane) ce.getSource() ).getSelectedComponent();
-		
-		newActiveEditorPanel.loadPolicyText( activeEditorPanel.getPolicyText() );
-		newActiveEditorPanel.setHasDirty   ( activeEditorPanel.getHasDirty  () );
-		activeEditorPanel = newActiveEditorPanel;
-		
-		keystoreEditMenuItem.setEnabled( activeEditorPanel.supportsGraphicalKeystoreEdit() );
-	}
-	
-	/**
-	 * Handles the action events of the menu items.
-	 * @param ae details of the action event
-	 */
-	public void actionPerformed( final ActionEvent ae ) {
-		// The action command is the ordinal of the menu item enum.
-		final MenuItemEnum menuItemEnum = MenuItemEnum.values()[ Integer.parseInt( ae.getActionCommand() ) ];
-		
-		final JFileChooser fileChooser = new JFileChooser();
-		switch ( menuItemEnum ) {
-		
-		case NEW :
-			break;
-			
-		case OPEN :
-			if ( fileChooser.showOpenDialog( mainFrame ) == JFileChooser.APPROVE_OPTION ) {
-				editedPolicyFile = fileChooser.getSelectedFile();
-				activeEditorPanel.loadPolicyText( PolicyFileHandler.loadPoilcyFile( editedPolicyFile ) );
-			}
-			break;
-			
-		case SAVE :
-			if ( editedPolicyFile == null ) {
-				if ( fileChooser.showSaveDialog( mainFrame ) == JFileChooser.APPROVE_OPTION )
-					editedPolicyFile = fileChooser.getSelectedFile();
-			}
-			if ( editedPolicyFile != null )
-				if ( PolicyFileHandler.savePolicyFile( editedPolicyFile, activeEditorPanel.getPolicyText() ) )
-					activeEditorPanel.setHasDirty( false );						
-			break;
-			
-		case SAVE_AS :
-			if ( fileChooser.showSaveDialog( mainFrame ) == JFileChooser.APPROVE_OPTION ) {
-				editedPolicyFile = fileChooser.getSelectedFile();
-				if ( PolicyFileHandler.savePolicyFile( editedPolicyFile, activeEditorPanel.getPolicyText() ) )
-					activeEditorPanel.setHasDirty( false );						
-			}
-			break;
-			
-		case VIEW_WARNING_LOG :
-			break;
-			
-		case EXIT :
-			exit();
-			break;
-			
-		case EDIT :
-			break;
-			
-		}
-		
-	}
-	
+
+    /** Reference to the main frame component.    */
+    private final Component     mainFrame;
+    /** Array of the editor panels.               */
+    private final EditorPanel[] editorPanels;
+    /** Reference to the active editor panel.     */
+    private EditorPanel         activeEditorPanel;
+
+    /** Reference to the keystore edit menu item. */
+    private JMenuItem           keystoreEditMenuItem;
+
+    /** The currently edited policy file.         */
+    private File editedPolicyFile;
+
+    /**
+     * Creates a new Controller.
+     * @param mainFrame reference to the main frame component
+     * @param editorPanels array of the editor panels
+     * @param policyFileName policy file name to be loaded initially
+     */
+    public Controller( final Component mainFrame, final EditorPanel[] editorPanels, final String policyFileName ) {
+        this.mainFrame    = mainFrame;
+        this.editorPanels = editorPanels;
+        activeEditorPanel = editorPanels[ 0 ];
+
+        PolicyFileHandler.setDialogParentComponent( mainFrame );
+
+        editedPolicyFile = new File( policyFileName );
+        activeEditorPanel.loadPolicyText( PolicyFileHandler.loadPoilcyFile( editedPolicyFile ) );
+    }
+
+    /**
+     * Returns the array of editor panels.
+     * @return the array of editor panels
+     */
+    public EditorPanel[] getEditorPanels() {
+        return editorPanels;
+    }
+
+    /**
+     * Sets the keystore edit menu item.
+     * @param keystoreEditMenuItem the keystore edit menu item
+     */
+    public void setKeystoreEditMenuItem( final JMenuItem keystoreEditMenuItem ) {
+        this.keystoreEditMenuItem = keystoreEditMenuItem;
+        keystoreEditMenuItem.setEnabled( activeEditorPanel.supportsGraphicalKeystoreEdit() );
+    }
+
+    /**
+     * Exits from the program.<br>
+     * There might be unsaved changes in which case confirmation will be asked.
+     */
+    public void exit() {
+        boolean exitOk = false;
+
+        if ( activeEditorPanel.getHasDirty() ) {
+
+            switch ( JOptionPane.showConfirmDialog( mainFrame, "There are unsaved changes. Save before exit?", "Warning", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE ) ) {
+
+            case JOptionPane.YES_OPTION:
+                final JFileChooser fileChooser = new JFileChooser();
+
+                if ( editedPolicyFile == null ) {
+                    if ( fileChooser.showSaveDialog( mainFrame ) == JFileChooser.APPROVE_OPTION )
+                        editedPolicyFile = fileChooser.getSelectedFile();
+                }
+                if ( editedPolicyFile != null ) {
+                    if ( !PolicyFileHandler.savePolicyFile( editedPolicyFile, activeEditorPanel.getPolicyText() ) ) {
+                        switch ( JOptionPane.showConfirmDialog( mainFrame, "Saving failed. Do you still want to exit?", "Warning", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE ) ) {
+                        case JOptionPane.YES_OPTION:
+                            exitOk = true;
+                            break;
+
+                        case JOptionPane.NO_OPTION:
+                        case JOptionPane.CLOSED_OPTION:
+                            // We chose not to exit. exitOk = false
+                            break;
+                        }
+                    } else {// Changes saved successfully
+                        activeEditorPanel.setHasDirty( false );
+                        exitOk = true;
+                    }
+                }
+                break;
+
+            case JOptionPane.NO_OPTION:
+                exitOk = true;
+                break;
+
+            case JOptionPane.CANCEL_OPTION:
+            case JOptionPane.CLOSED_OPTION:
+                // We chose not to exit. exitOk = false
+                break;
+
+            }
+
+        } else
+            exitOk = true;
+
+        if ( exitOk )
+            System.exit( 0 );
+    }
+
+    /**
+     * Handles change events of the editors tabbed pane.
+     * @param ce details of the change event
+     */
+    public void stateChanged( final ChangeEvent ce ) {
+        final EditorPanel newActiveEditorPanel = (EditorPanel) ( (JTabbedPane) ce.getSource() ).getSelectedComponent();
+
+        newActiveEditorPanel.loadPolicyText( activeEditorPanel.getPolicyText() );
+        newActiveEditorPanel.setHasDirty   ( activeEditorPanel.getHasDirty  () );
+        activeEditorPanel = newActiveEditorPanel;
+
+        keystoreEditMenuItem.setEnabled( activeEditorPanel.supportsGraphicalKeystoreEdit() );
+    }
+
+    /**
+     * Handles the action events of the menu items.
+     * @param ae details of the action event
+     */
+    public void actionPerformed( final ActionEvent ae ) {
+        // The action command is the ordinal of the menu item enum.
+        final MenuItemEnum menuItemEnum = MenuItemEnum.values()[ Integer.parseInt( ae.getActionCommand() ) ];
+
+        final JFileChooser fileChooser = new JFileChooser();
+        switch ( menuItemEnum ) {
+
+        case NEW :
+            break;
+
+        case OPEN :
+            if ( fileChooser.showOpenDialog( mainFrame ) == JFileChooser.APPROVE_OPTION ) {
+                editedPolicyFile = fileChooser.getSelectedFile();
+                activeEditorPanel.loadPolicyText( PolicyFileHandler.loadPoilcyFile( editedPolicyFile ) );
+            }
+            break;
+
+        case SAVE :
+            if ( editedPolicyFile == null ) {
+                if ( fileChooser.showSaveDialog( mainFrame ) == JFileChooser.APPROVE_OPTION )
+                    editedPolicyFile = fileChooser.getSelectedFile();
+            }
+            if ( editedPolicyFile != null )
+                if ( PolicyFileHandler.savePolicyFile( editedPolicyFile, activeEditorPanel.getPolicyText() ) )
+                    activeEditorPanel.setHasDirty( false );						
+            break;
+
+        case SAVE_AS :
+            if ( fileChooser.showSaveDialog( mainFrame ) == JFileChooser.APPROVE_OPTION ) {
+                editedPolicyFile = fileChooser.getSelectedFile();
+                if ( PolicyFileHandler.savePolicyFile( editedPolicyFile, activeEditorPanel.getPolicyText() ) )
+                    activeEditorPanel.setHasDirty( false );						
+            }
+            break;
+
+        case VIEW_WARNING_LOG :
+            break;
+
+        case EXIT :
+            exit();
+            break;
+
+        case EDIT :
+            break;
+
+        }
+
+    }
+
 }

Modified: harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/control/PolicyFileHandler.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/control/PolicyFileHandler.java?rev=672929&r1=672928&r2=672929&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/control/PolicyFileHandler.java (original)
+++ harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/control/PolicyFileHandler.java Mon Jun 30 14:21:58 2008
@@ -6,13 +6,13 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  * 
- * http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.harmony.tools.policytool.control;
@@ -35,104 +35,94 @@
  * We're aware of the UTF-8 policy file encoding. 
  */
 public class PolicyFileHandler {
-	
-	/** Encoding of the policy file by the specification. */
-	private static final String POLICY_FILE_ENCODING = "UTF-8";
-	
-	/** Platform dependent line separator. */
-	private static final String LINE_SEPARATOR = System.getProperty( "line.separator" );
-	
-	/** Parent component to be used when displaying dialogs. */
-	private static Component dialogParentComponent;
-	
-	/**
-	 * Sets the parent component to be used when displaying dialogs.
-	 * @param dialogParentComponent component to be used when displaying dialogs
-	 */
-	public static void setDialogParentComponent( final Component dialogParentComponent ) {
-		PolicyFileHandler.dialogParentComponent = dialogParentComponent;
-	}
-	
-	/**
-	 * Loads the content of a policy file.
-	 * @param policyFile policy file whose content to be loaded
-	 * @return the policy text within the given policy file
-	 */
-	public static String loadPoilcyFile( final File policyFile ) {
-		final StringBuilder policyTextBuilder = new StringBuilder();
-		
-		BufferedReader input = null;
-		try {
-			
-			input = new BufferedReader( new InputStreamReader( new FileInputStream( policyFile ), POLICY_FILE_ENCODING ) );
-			String line;
-			while ( ( line = input.readLine() ) != null )
-				policyTextBuilder.append( line ).append( LINE_SEPARATOR );
-			
-		}
-		catch ( final FileNotFoundException fnfe ) {
-			JOptionPane.showMessageDialog( dialogParentComponent, "The file does not exist!", "Error", JOptionPane.ERROR_MESSAGE );
-			return null;
-		}
-		catch ( final UnsupportedEncodingException uee ) {
-			// This should never happen.
-			uee.printStackTrace();
-			return null;
-		}
-		catch ( final IOException ie ) {
-			JOptionPane.showMessageDialog( dialogParentComponent, new String[] { "I/O error occured, can't read the file!", ie.getMessage() }, "Error", JOptionPane.ERROR_MESSAGE );
-			return null;
-		}
-		finally {
-			if ( input != null )
-				try {
-					input.close();
-				}
-				catch ( final IOException ie ) {
-					ie.printStackTrace();
-				}
-		}
-		
-		return policyTextBuilder.toString();
-	}
-	
-	/**
-	 * Saves policy text to a policy file.
-	 * @param policyFile policy file to save to
-	 * @param policyText policy text to be saved
-	 * @return true, if saving was successful; false otherwise
-	 */
-	public static boolean savePolicyFile( final File policyFile, final String policyText ) {
-		OutputStreamWriter output = null;
-		try {
-			output = new OutputStreamWriter( new FileOutputStream( policyFile ), POLICY_FILE_ENCODING );
-			
-			output.write( policyText );
-			
-			return true;
-		}
-		catch ( final UnsupportedEncodingException uee ) {
-			// This should never happen.
-			uee.printStackTrace();
-		}
-		catch ( final FileNotFoundException ffe ) {
-			JOptionPane.showMessageDialog( dialogParentComponent, new String[] { "Cannot open file for writing!", ffe.getMessage() }, "Error", JOptionPane.ERROR_MESSAGE );
-			ffe.printStackTrace();
-		} catch ( final IOException ie ) {
-			JOptionPane.showMessageDialog( dialogParentComponent, new String[] { "Write error!", ie.getMessage() }, "Error", JOptionPane.ERROR_MESSAGE );
-			ie.printStackTrace();
-		} 
-		finally {
-			if ( output != null )
-				try {
-					output.close();
-				}
-				catch ( final IOException ie ) {
-					ie.printStackTrace();
-				}
-		}
-		
-		return false;
-	}
-	
+
+    /** Encoding of the policy file by the specification. */
+    private static final String POLICY_FILE_ENCODING = "UTF-8";
+
+    /** Platform dependent line separator. */
+    private static final String LINE_SEPARATOR = System.getProperty( "line.separator" );
+
+    /** Parent component to be used when displaying dialogs. */
+    private static Component dialogParentComponent;
+
+    /**
+     * Sets the parent component to be used when displaying dialogs.
+     * @param dialogParentComponent component to be used when displaying dialogs
+     */
+    public static void setDialogParentComponent( final Component dialogParentComponent ) {
+        PolicyFileHandler.dialogParentComponent = dialogParentComponent;
+    }
+
+    /**
+     * Loads the content of a policy file.
+     * @param policyFile policy file whose content to be loaded
+     * @return the policy text within the given policy file
+     */
+    public static String loadPoilcyFile( final File policyFile ) {
+        final StringBuilder policyTextBuilder = new StringBuilder();
+
+        BufferedReader input = null;
+        try {
+
+            input = new BufferedReader( new InputStreamReader( new FileInputStream( policyFile ), POLICY_FILE_ENCODING ) );
+            String line;
+            while ( ( line = input.readLine() ) != null )
+                policyTextBuilder.append( line ).append( LINE_SEPARATOR );
+        } catch ( final FileNotFoundException fnfe ) {
+            JOptionPane.showMessageDialog( dialogParentComponent, "The file does not exist!", "Error", JOptionPane.ERROR_MESSAGE );
+            return null;
+        } catch ( final UnsupportedEncodingException uee ) {
+            // This should never happen.
+            uee.printStackTrace();
+            return null;
+        } catch ( final IOException ie ) {
+            JOptionPane.showMessageDialog( dialogParentComponent, new String[] { "I/O error occured, can't read the file!", ie.getMessage() }, "Error", JOptionPane.ERROR_MESSAGE );
+            return null;
+        } finally {
+            if ( input != null )
+                try {
+                    input.close();
+                } catch ( final IOException ie ) {
+                    ie.printStackTrace();
+                }
+        }
+
+        return policyTextBuilder.toString();
+    }
+
+    /**
+     * Saves policy text to a policy file.
+     * @param policyFile policy file to save to
+     * @param policyText policy text to be saved
+     * @return true, if saving was successful; false otherwise
+     */
+    public static boolean savePolicyFile( final File policyFile, final String policyText ) {
+        OutputStreamWriter output = null;
+        try {
+            output = new OutputStreamWriter( new FileOutputStream( policyFile ), POLICY_FILE_ENCODING );
+
+            output.write( policyText );
+
+            return true;
+        } catch ( final UnsupportedEncodingException uee ) {
+            // This should never happen.
+            uee.printStackTrace();
+        } catch ( final FileNotFoundException ffe ) {
+            JOptionPane.showMessageDialog( dialogParentComponent, new String[] { "Cannot open file for writing!", ffe.getMessage() }, "Error", JOptionPane.ERROR_MESSAGE );
+            ffe.printStackTrace();
+        } catch ( final IOException ie ) {
+            JOptionPane.showMessageDialog( dialogParentComponent, new String[] { "Write error!", ie.getMessage() }, "Error", JOptionPane.ERROR_MESSAGE );
+            ie.printStackTrace();
+        } finally {
+            if ( output != null )
+                try {
+                    output.close();
+                } catch ( final IOException ie ) {
+                    ie.printStackTrace();
+                }
+        }
+
+        return false;
+    }
+
 }

Modified: harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/CommentEntry.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/CommentEntry.java?rev=672929&r1=672928&r2=672929&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/CommentEntry.java (original)
+++ harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/CommentEntry.java Mon Jun 30 14:21:58 2008
@@ -6,13 +6,13 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  * 
- * http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.harmony.tools.policytool.model;
@@ -26,26 +26,26 @@
  * </ul> 
  */
 public class CommentEntry extends PolicyEntry {
-	
-	/** Comment entries are not tokenized just holds the entry text "as is". */
-	private String entryText;
-	
-	/**
-	 * Creates a new CommentEntry.
-	 * @param entryText policy entry text of the entry
-	 */
-	public CommentEntry( final String entryText ) {
-		setText( entryText );
-	}
-	
-	@Override
-	public String getText() {
-		return entryText;
-	}
-	
-	@Override
-	public void setText( final String entryText ) {
-		this.entryText = entryText;
-	}
-	
+
+    /** Comment entries are not tokenized just holds the entry text "as is". */
+    private String entryText;
+
+    /**
+     * Creates a new CommentEntry.
+     * @param entryText policy entry text of the entry
+     */
+    public CommentEntry( final String entryText ) {
+        setText( entryText );
+    }
+
+    @Override
+    public String getText() {
+        return entryText;
+    }
+
+    @Override
+    public void setText( final String entryText ) {
+        this.entryText = entryText;
+    }
+
 }

Modified: harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/KeystoreEntry.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/KeystoreEntry.java?rev=672929&r1=672928&r2=672929&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/KeystoreEntry.java (original)
+++ harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/KeystoreEntry.java Mon Jun 30 14:21:58 2008
@@ -6,13 +6,13 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  * 
- * http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.harmony.tools.policytool.model;
@@ -28,51 +28,51 @@
  * @see KeystorePasswordURLEntry
  */
 public class KeystoreEntry extends PolicyEntry {
-	
-	/** Keyword of the keystore entry in the policy text. */
-	public static final String KEYWORD = "keystore";
-	
-	/** URL of the keystore.      */
-	private String url;
-	/** Type of the keystore.     */
-	private String type;
-	/** Provider of the keystore. */
-	private String provider;
-	
-	@Override
-	public String getText() {
-		final StringBuilder textBuilder = new StringBuilder( KEYWORD );
-		boolean firstParamAdded = false;
-		
-		if ( url != null ) {
-			textBuilder.append( " \"" ).append( url ).append( '"' );
-			firstParamAdded = true;
-		}
-		
-		if ( type != null ) {
-			if ( firstParamAdded )
-				textBuilder.append( ',' );
-			else
-				firstParamAdded = true;
-			textBuilder.append( " \"" ).append( type ).append( '"' );
-		}
-		
-		if ( provider != null ) {
-			if ( firstParamAdded )
-				textBuilder.append( ',' );
-			else
-				firstParamAdded = true;
-			textBuilder.append( " \"" ).append( provider ).append( '"' );
-		}
-		
-		textBuilder.append( TERMINATOR_CHAR );
-		
-		return textBuilder.toString();
-	}
-	
-	@Override
-	public void setText( final String entryText ) {
-		// TODO Auto-generated method stub
-	}
-	
+
+    /** Keyword of the keystore entry in the policy text. */
+    public static final String KEYWORD = "keystore";
+
+    /** URL of the keystore.      */
+    private String url;
+    /** Type of the keystore.     */
+    private String type;
+    /** Provider of the keystore. */
+    private String provider;
+
+    @Override
+    public String getText() {
+        final StringBuilder textBuilder = new StringBuilder( KEYWORD );
+        boolean firstParamAdded = false;
+
+        if ( url != null ) {
+            textBuilder.append( " \"" ).append( url ).append( '"' );
+            firstParamAdded = true;
+        }
+
+        if ( type != null ) {
+            if ( firstParamAdded )
+                textBuilder.append( ',' );
+            else
+                firstParamAdded = true;
+            textBuilder.append( " \"" ).append( type ).append( '"' );
+        }
+
+        if ( provider != null ) {
+            if ( firstParamAdded )
+                textBuilder.append( ',' );
+            else
+                firstParamAdded = true;
+            textBuilder.append( " \"" ).append( provider ).append( '"' );
+        }
+
+        textBuilder.append( TERMINATOR_CHAR );
+
+        return textBuilder.toString();
+    }
+
+    @Override
+    public void setText( final String entryText ) {
+        // TODO Auto-generated method stub
+    }
+
 }

Modified: harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/KeystorePasswordURLEntry.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/KeystorePasswordURLEntry.java?rev=672929&r1=672928&r2=672929&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/KeystorePasswordURLEntry.java (original)
+++ harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/KeystorePasswordURLEntry.java Mon Jun 30 14:21:58 2008
@@ -6,13 +6,13 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  * 
- * http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.harmony.tools.policytool.model;
@@ -26,21 +26,21 @@
  * @see KeystoreEntry
  */
 public class KeystorePasswordURLEntry extends PolicyEntry {
-	
-	/** Keyword of the keystore password URL entry in the policy text. */
-	public static final String KEYWORD = "keystorePasswordURL";
-	
-	/** URL of the keystore password. */
-	private String url;
-	
-	@Override
-	public String getText() {
-		return KEYWORD + " \"" + url + '\"' + TERMINATOR_CHAR;
-	}
-	
-	@Override
-	public void setText( final String entryText ) {
-		// TODO Auto-generated method stub
-	}
-	
+
+    /** Keyword of the keystore password URL entry in the policy text. */
+    public static final String KEYWORD = "keystorePasswordURL";
+
+    /** URL of the keystore password. */
+    private String url;
+
+    @Override
+    public String getText() {
+        return KEYWORD + " \"" + url + '\"' + TERMINATOR_CHAR;
+    }
+
+    @Override
+    public void setText( final String entryText ) {
+        // TODO Auto-generated method stub
+    }
+
 }

Modified: harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/PolicyEntry.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/PolicyEntry.java?rev=672929&r1=672928&r2=672929&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/PolicyEntry.java (original)
+++ harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/model/PolicyEntry.java Mon Jun 30 14:21:58 2008
@@ -6,13 +6,13 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  * 
- * http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.harmony.tools.policytool.model;
@@ -21,20 +21,20 @@
  * Abstract ancestor to represent a policy entry.
  */
 public abstract class PolicyEntry {
-	
-	/** Terminator character of the policy entry texts. */
-	public static final char TERMINATOR_CHAR = ';';
-	
-	/**
-	 * Returns the policy entry text.
-	 * @return the policy entry text
-	 */
-	public abstract String getText();
-	
-	/**
-	 * Sets the policy entry text.
-	 * @param entryText policy entry text to be set
-	 */
-	public abstract void setText( final String entryText );
-	
+
+    /** Terminator character of the policy entry texts. */
+    public static final char TERMINATOR_CHAR = ';';
+
+    /**
+     * Returns the policy entry text.
+     * @return the policy entry text
+     */
+    public abstract String getText();
+
+    /**
+     * Sets the policy entry text.
+     * @param entryText policy entry text to be set
+     */
+    public abstract void setText( final String entryText );
+
 }

Modified: harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/DirectTextEditorPanel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/DirectTextEditorPanel.java?rev=672929&r1=672928&r2=672929&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/DirectTextEditorPanel.java (original)
+++ harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/DirectTextEditorPanel.java Mon Jun 30 14:21:58 2008
@@ -6,13 +6,13 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  * 
- * http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.harmony.tools.policytool.view;
@@ -31,47 +31,47 @@
  * An editor panel which provides an interface for direct editing the policy text.
  */
 public class DirectTextEditorPanel extends EditorPanel {
-	
-	/** Text area for direct editing the policy text. */
-	private final JTextArea policyTextTextArea = new JTextArea();
-	
-	/**
-	 * Creates a new DirectTextEditorPanel.<br>
-	 * Sets a BorderLayout as the layout manager.
-	 */
-	public DirectTextEditorPanel() {
-		super( new BorderLayout(), false );
-		
-		policyTextTextArea.setFont( new Font( "Courier New", Font.PLAIN, Consts.DIRECT_EDITING_FONT_SIZE ) );
-		
-		// We want to track changes of the document so we can ask confirmation on exit
-		policyTextTextArea.getDocument().addDocumentListener( new DocumentListener() {
-			public void changedUpdate( final DocumentEvent de ) {
-			}
-			public void insertUpdate ( final DocumentEvent de ) {
-				setHasDirty( true );
-			}
-			public void removeUpdate ( final DocumentEvent de ) {
-				setHasDirty( true );
-			}
-		} );
-		
-		add( new JScrollPane( policyTextTextArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS ), BorderLayout.CENTER );
-	}
-	
-	@Override
-	public String getPanelTitle() {
-		return "Direct editing";
-	}
-	
-	@Override
-	public void loadPolicyText( final String policyText ) {
-		policyTextTextArea.setText( policyText );
-	}
-	
-	@Override
-	public String getPolicyText() {
-		return policyTextTextArea.getText();
-	}
-	
+
+    /** Text area for direct editing the policy text. */
+    private final JTextArea policyTextTextArea = new JTextArea();
+
+    /**
+     * Creates a new DirectTextEditorPanel.<br>
+     * Sets a BorderLayout as the layout manager.
+     */
+    public DirectTextEditorPanel() {
+        super( new BorderLayout(), false );
+
+        policyTextTextArea.setFont( new Font( "Courier New", Font.PLAIN, Consts.DIRECT_EDITING_FONT_SIZE ) );
+
+        // We want to track changes of the document so we can ask confirmation on exit
+        policyTextTextArea.getDocument().addDocumentListener( new DocumentListener() {
+                public void changedUpdate( final DocumentEvent de ) {
+                }
+                public void insertUpdate ( final DocumentEvent de ) {
+                    setHasDirty( true );
+                }
+                public void removeUpdate ( final DocumentEvent de ) {
+                    setHasDirty( true );
+                }
+            } );
+
+        add( new JScrollPane( policyTextTextArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS ), BorderLayout.CENTER );
+    }
+
+    @Override
+    public String getPanelTitle() {
+        return "Direct editing";
+    }
+
+    @Override
+    public void loadPolicyText( final String policyText ) {
+        policyTextTextArea.setText( policyText );
+    }
+
+    @Override
+    public String getPolicyText() {
+        return policyTextTextArea.getText();
+    }
+
 }

Modified: harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/EditorPanel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/EditorPanel.java?rev=672929&r1=672928&r2=672929&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/EditorPanel.java (original)
+++ harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/EditorPanel.java Mon Jun 30 14:21:58 2008
@@ -6,13 +6,13 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  * 
- * http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.harmony.tools.policytool.view;
@@ -22,66 +22,67 @@
 import javax.swing.JPanel;
 
 /**
- * Defines an abstract editor panel which can provide a GUI for editing a policy text.
+ * Defines an abstract editor panel which can provide a GUI for
+ * editing a policy text.
  */
 public abstract class EditorPanel extends JPanel {
-	
-	/** Tells whether this editor panel has unsaved changes.              */
-	protected boolean hasDirty;
-	/** Tells whether this editor panel supports graphical keystore edit. */
-	protected boolean supportsGraphicalKeystoreEdit;
-	
-	/**
-	 * Creates a new EditorPanel.<br>
-	 * Awaits a layout manager to be sent to the super class.
-	 * @param layoutManager layout manager to be used
-	 * @param supportsGraphicalKeystoreEdit true if this editor panel supports graphical keystore edit; false otherwise
-	 */
-	public EditorPanel( final LayoutManager layoutManager, final boolean supportsGraphicalKeystoreEdit ) {
-		super( layoutManager );
-		this.supportsGraphicalKeystoreEdit = supportsGraphicalKeystoreEdit;
-	}
-	
-	/**
-	 * Returns the title of the panel.
-	 * @return the title of the panel
-	 */
-	public abstract String getPanelTitle();
-	
-	/**
-	 * Loads the specified policy text into the editor panel.
-	 * @param policyText policy text to be loaded
-	 */
-	public abstract void loadPolicyText( final String policyText );
-	
-	/**
-	 * Returns the policy text hold by this editor panel.
-	 * @return the policy text hold by this editor panel
-	 */
-	public abstract String getPolicyText();
-	
-	/**
-	 * Tells whether this editor panel has unsaved changes.
-	 * @return true if the editor panel has unsaved changes
-	 */
-	public boolean getHasDirty() {
-		return hasDirty;
-	}
-	
-	/**
-	 * Sets the hasDirty property.
-	 * @param hasDirty value of hasDirty to be set
-	 */
-	public void setHasDirty( final boolean hasDirty ) {
-		this.hasDirty = hasDirty;
-	}
-	
-	/**
-	 * Tells whether this editor panel supports graphical keystore edit.
-	 * @return true if this editor panel supports graphical keystore edit; false otherwise
-	 */
-	public boolean supportsGraphicalKeystoreEdit() {
-		return supportsGraphicalKeystoreEdit;
-	}
-	
+
+    /** Tells whether this editor panel has unsaved changes.              */
+    protected boolean hasDirty;
+    /** Tells whether this editor panel supports graphical keystore edit. */
+    protected boolean supportsGraphicalKeystoreEdit;
+
+    /**
+     * Creates a new EditorPanel.<br>
+     * Awaits a layout manager to be sent to the super class.
+     * @param layoutManager layout manager to be used
+     * @param supportsGraphicalKeystoreEdit true if this editor panel supports graphical keystore edit; false otherwise
+     */
+    public EditorPanel( final LayoutManager layoutManager, final boolean supportsGraphicalKeystoreEdit ) {
+        super( layoutManager );
+        this.supportsGraphicalKeystoreEdit = supportsGraphicalKeystoreEdit;
+    }
+
+    /**
+     * Returns the title of the panel.
+     * @return the title of the panel
+     */
+    public abstract String getPanelTitle();
+
+    /**
+     * Loads the specified policy text into the editor panel.
+     * @param policyText policy text to be loaded
+     */
+    public abstract void loadPolicyText( final String policyText );
+
+    /**
+     * Returns the policy text hold by this editor panel.
+     * @return the policy text hold by this editor panel
+     */
+    public abstract String getPolicyText();
+
+    /**
+     * Tells whether this editor panel has unsaved changes.
+     * @return true if the editor panel has unsaved changes
+     */
+    public boolean getHasDirty() {
+        return hasDirty;
+    }
+
+    /**
+     * Sets the hasDirty property.
+     * @param hasDirty value of hasDirty to be set
+     */
+    public void setHasDirty( final boolean hasDirty ) {
+        this.hasDirty = hasDirty;
+    }
+
+    /**
+     * Tells whether this editor panel supports graphical keystore edit.
+     * @return true if this editor panel supports graphical keystore edit; false otherwise
+     */
+    public boolean supportsGraphicalKeystoreEdit() {
+        return supportsGraphicalKeystoreEdit;
+    }
+
 }

Modified: harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/GraphicalEditorPanel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/GraphicalEditorPanel.java?rev=672929&r1=672928&r2=672929&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/GraphicalEditorPanel.java (original)
+++ harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/GraphicalEditorPanel.java Mon Jun 30 14:21:58 2008
@@ -6,13 +6,13 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  * 
- * http://www.apache.org/licenses/LICENSE-2.0
+ *     http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package org.apache.harmony.tools.policytool.view;
@@ -23,37 +23,40 @@
 import org.apache.harmony.tools.policytool.model.PolicyEntry;
 
 /**
- * An editor panel which provides an interface for direct editing the policy text.
+ * An editor panel which provides an interface for direct editing the
+ * policy text.
  */
 public class GraphicalEditorPanel extends EditorPanel {
-	
-	/** Holds the invalid policy text or null if the loaded policy text is valid.        */
-	private String invalidPolicyText;
-	
-	/** The list of the policy text's entries or null if invalid policy text was loaded. */
-	private List< PolicyEntry > policyEntryList;
-	
-	/**
-	 * Creates a new GraphicalEditorPanel.<br>
-	 * Sets a BorderLayout as the layout manager.
-	 */
-	public GraphicalEditorPanel() {
-		super( new BorderLayout(), true );
-	}
-	
-	@Override
+
+    /** Holds the invalid policy text or null if the loaded policy
+     * text is valid.  */
+    private String invalidPolicyText;
+
+    /** The list of the policy text's entries or null if invalid
+     * policy text was loaded. */
+    private List< PolicyEntry > policyEntryList;
+
+    /**
+     * Creates a new GraphicalEditorPanel.<br>
+     * Sets a BorderLayout as the layout manager.
+     */
+    public GraphicalEditorPanel() {
+        super( new BorderLayout(), true );
+    }
+
+    @Override
 	public String getPanelTitle() {
-		return "Graphical editing";
-	}
-	
-	@Override
+        return "Graphical editing";
+    }
+
+    @Override
 	public void loadPolicyText( final String policyText ) {
-		this.invalidPolicyText = policyText;
-	}
-	
-	@Override
+        this.invalidPolicyText = policyText;
+    }
+
+    @Override
 	public String getPolicyText() {
-		return invalidPolicyText;
-	}
-	
+        return invalidPolicyText;
+    }
+
 }

Modified: harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/MainFrame.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/MainFrame.java?rev=672929&r1=672928&r2=672929&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/MainFrame.java (original)
+++ harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/policytool/view/MainFrame.java Mon Jun 30 14:21:58 2008
@@ -34,164 +34,163 @@
  * This is the main frame of policytool.
  */
 public class MainFrame extends JFrame {
-	
-	/**
-	 * Creates a new <code>MainFrame</code> with no initial poilcy file.
-	 */
-	public MainFrame() {
-		this( null );
-	}
-	
-	/**
-	 * Creates a new <code>MainFrame</code>.
-	 * @param policyFileName policy file name to be loaded initially
-	 */
-	public MainFrame( final String policyFileName ) {
-		super( Consts.APPLICATION_NAME );
-		
-		final EditorPanel[] editorPanels = new EditorPanel[] { new GraphicalEditorPanel(), new DirectTextEditorPanel() };
-		final Controller    controller   = new Controller( this, editorPanels, policyFileName );
-		
-		buildGUI( controller );
-		
-		setLocation( Consts.MAIN_FRAME_START_POS_X, Consts.MAIN_FRAME_START_POS_X );
-		setSize( 400, 400 );
-		setDefaultCloseOperation( DO_NOTHING_ON_CLOSE );
-		addWindowListener( new WindowAdapter() {
-			public void windowClosing( final WindowEvent we ) {
-				controller.exit();
-			}
-		} );
-	}
-	
-	/**
-	 * Builds the graphical user interface of the main frame.
-	 * @param controller reference to the controller
-	 */
-	private void buildGUI( final Controller controller ) {
-		buildMenusAndMenuBar( controller );
-		buildTabbedPane     ( controller );
-	}
-	
-	/**
-	 * Menu items of policytool.
-	 */
-	public static enum MenuItemEnum {
-		/** File menu                  */
-		FILE            ( true, "File"       ),
-		/** New menu item              */
-		NEW             ( "New"              ),
-		/** Save menu item             */
-		OPEN            ( "Open"             ),
-		/** Save menu item             */
-		SAVE            ( "Save"             ),
-		/** Save as menu item          */
-		SAVE_AS         ( "Save As...", 'a'  ),
-		/** View warning log menu item */
-		VIEW_WARNING_LOG( "View Warning Log" ),
-		/** Exit menu item             */
-		EXIT            ( "Exit", 'x'        ),
-		/** KeyStore menu              */
-		KEY_STORE       ( true, "KeyStore"   ),
-		/** Edit menu item             */
-		EDIT            ( "Edit"             );
-		
-		/** If true, then this represents a menu instead of a menu item. */
-		public final boolean isMenu;
-		/** Text of the menu item.                                       */
-		public final String  text;
-		/** Mnemonic for the menu item.                                  */
-		public final char    mnemonic;
-		
-		/**
-		 * Creates a new MenuItemEnum with a default mnemonic of the first character of its text.
-		 * @param isMenu indicating if this will be a menu
-		 * @param text text of the menu item
-		 */
-		private MenuItemEnum( final boolean isMenu, final String text ) {
-			this( isMenu, text, text.charAt( 0 ) );
-		}
-		
-		/**
-		 * Creates a new MenuItemEnum with a default mnemonic of the first character of its text.
-		 * @param text text of the menu item
-		 */
-		private MenuItemEnum( final String text ) {
-			this( false, text, text.charAt( 0 ) );
-		}
-		
-		/**
-		 * Creates a new MenuItemEnum.
-		 * @param text text of the menu item
-		 * @param mnemonic mnemonic for the menu item
-		 */
-		private MenuItemEnum( final String text, final char mnemonic ) {
-			this( false, text, mnemonic );
-		}
-		
-		/**
-		 * Creates a new MenuItemEnum.
-		 * @param isMenu indicating if this will be a menu
-		 * @param text text of the menu item
-		 * @param mnemonic mnemonic for the menu item
-		 */
-		private MenuItemEnum( final boolean isMenu, final String text, final char mnemonic ) {
-			this.isMenu   = isMenu;
-			this.text     = text;
-			this.mnemonic = mnemonic;
-		}
-		
-	};
-	
-	/**
-	 * Builds the menus and the menu bar.
-	 * @param controller reference to the controller 
-	 */
-	private void buildMenusAndMenuBar( final Controller controller ) {
-		final JMenuBar menuBar = new JMenuBar();
-		
-		JMenu menu = null;
-		for ( final MenuItemEnum menuItemEnum : MenuItemEnum.values() ) {
-			if ( menuItemEnum.isMenu ) {
-				menu = new JMenu( menuItemEnum.text );
-				menu.setMnemonic( menuItemEnum.mnemonic );
-				menuBar.add( menu );
-			}
-			else {
-				final JMenuItem menuItem = new JMenuItem( menuItemEnum.text );
-				menuItem.setMnemonic( menuItemEnum.mnemonic );
-				menuItem.addActionListener( controller );
-				menuItem.setActionCommand( Integer.toString( menuItemEnum.ordinal() ) );
-				menu.add( menuItem );
-				if ( menuItemEnum == MenuItemEnum.EDIT )
-					controller.setKeystoreEditMenuItem( menuItem );
-			}
-		}
-		
-		setJMenuBar( menuBar );
-	}
-	
-	/**
-	 * Builds the tabbed pane containing the editor panels.
-	 * @param controller reference to the controller 
-	 */
-	private void buildTabbedPane( final Controller controller ) {
-		final JTabbedPane   tabbedPane   = new JTabbedPane();
-		final EditorPanel[] editorPanels = controller.getEditorPanels();
-		
-		for ( int i = 0; i < editorPanels.length; i++ ) {
-			final EditorPanel editorPanel = editorPanels[ i ];
-			final String      panelTitle  = (i+1) + " " + editorPanel.getPanelTitle();
-			
-			tabbedPane.addTab( panelTitle, editorPanel );
-			
-			if ( i < 9 ) // We only set 1..9 mnemonic characters
-				tabbedPane.setMnemonicAt( i, '1' + i );
-		}
-		
-		tabbedPane.addChangeListener( controller );
-		
-		add( tabbedPane , BorderLayout.CENTER );
-	}
-	
+
+    /**
+     * Creates a new <code>MainFrame</code> with no initial poilcy file.
+     */
+    public MainFrame() {
+        this( null );
+    }
+
+    /**
+     * Creates a new <code>MainFrame</code>.
+     * @param policyFileName policy file name to be loaded initially
+     */
+    public MainFrame( final String policyFileName ) {
+        super( Consts.APPLICATION_NAME );
+
+        final EditorPanel[] editorPanels = new EditorPanel[] { new GraphicalEditorPanel(), new DirectTextEditorPanel() };
+        final Controller    controller   = new Controller( this, editorPanels, policyFileName );
+
+        buildGUI( controller );
+
+        setLocation( Consts.MAIN_FRAME_START_POS_X, Consts.MAIN_FRAME_START_POS_X );
+        setSize( 400, 400 );
+        setDefaultCloseOperation( DO_NOTHING_ON_CLOSE );
+        addWindowListener( new WindowAdapter() {
+                public void windowClosing( final WindowEvent we ) {
+                    controller.exit();
+                }
+            } );
+    }
+
+    /**
+     * Builds the graphical user interface of the main frame.
+     * @param controller reference to the controller
+     */
+    private void buildGUI( final Controller controller ) {
+        buildMenusAndMenuBar( controller );
+        buildTabbedPane     ( controller );
+    }
+
+    /**
+     * Menu items of policytool.
+     */
+    public static enum MenuItemEnum {
+        /** File menu                  */
+        FILE            ( true, "File"       ),
+            /** New menu item              */
+            NEW             ( "New"              ),
+            /** Save menu item             */
+            OPEN            ( "Open"             ),
+            /** Save menu item             */
+            SAVE            ( "Save"             ),
+            /** Save as menu item          */
+            SAVE_AS         ( "Save As...", 'a'  ),
+            /** View warning log menu item */
+            VIEW_WARNING_LOG( "View Warning Log" ),
+            /** Exit menu item             */
+            EXIT            ( "Exit", 'x'        ),
+            /** KeyStore menu              */
+            KEY_STORE       ( true, "KeyStore"   ),
+            /** Edit menu item             */
+            EDIT            ( "Edit"             );
+
+        /** If true, then this represents a menu instead of a menu item. */
+        public final boolean isMenu;
+        /** Text of the menu item.                                       */
+        public final String  text;
+        /** Mnemonic for the menu item.                                  */
+        public final char    mnemonic;
+
+        /**
+         * Creates a new MenuItemEnum with a default mnemonic of the first character of its text.
+         * @param isMenu indicating if this will be a menu
+         * @param text text of the menu item
+         */
+        private MenuItemEnum( final boolean isMenu, final String text ) {
+            this( isMenu, text, text.charAt( 0 ) );
+        }
+
+        /**
+         * Creates a new MenuItemEnum with a default mnemonic of the first character of its text.
+         * @param text text of the menu item
+         */
+        private MenuItemEnum( final String text ) {
+            this( false, text, text.charAt( 0 ) );
+        }
+
+        /**
+         * Creates a new MenuItemEnum.
+         * @param text text of the menu item
+         * @param mnemonic mnemonic for the menu item
+         */
+        private MenuItemEnum( final String text, final char mnemonic ) {
+            this( false, text, mnemonic );
+        }
+
+        /**
+         * Creates a new MenuItemEnum.
+         * @param isMenu indicating if this will be a menu
+         * @param text text of the menu item
+         * @param mnemonic mnemonic for the menu item
+         */
+        private MenuItemEnum( final boolean isMenu, final String text, final char mnemonic ) {
+            this.isMenu   = isMenu;
+            this.text     = text;
+            this.mnemonic = mnemonic;
+        }
+
+    };
+
+    /**
+     * Builds the menus and the menu bar.
+     * @param controller reference to the controller 
+     */
+    private void buildMenusAndMenuBar( final Controller controller ) {
+        final JMenuBar menuBar = new JMenuBar();
+
+        JMenu menu = null;
+        for ( final MenuItemEnum menuItemEnum : MenuItemEnum.values() ) {
+            if ( menuItemEnum.isMenu ) {
+                menu = new JMenu( menuItemEnum.text );
+                menu.setMnemonic( menuItemEnum.mnemonic );
+                menuBar.add( menu );
+            } else {
+                final JMenuItem menuItem = new JMenuItem( menuItemEnum.text );
+                menuItem.setMnemonic( menuItemEnum.mnemonic );
+                menuItem.addActionListener( controller );
+                menuItem.setActionCommand( Integer.toString( menuItemEnum.ordinal() ) );
+                menu.add( menuItem );
+                if ( menuItemEnum == MenuItemEnum.EDIT )
+                    controller.setKeystoreEditMenuItem( menuItem );
+            }
+        }
+
+        setJMenuBar( menuBar );
+    }
+
+    /**
+     * Builds the tabbed pane containing the editor panels.
+     * @param controller reference to the controller 
+     */
+    private void buildTabbedPane( final Controller controller ) {
+        final JTabbedPane   tabbedPane   = new JTabbedPane();
+        final EditorPanel[] editorPanels = controller.getEditorPanels();
+
+        for ( int i = 0; i < editorPanels.length; i++ ) {
+            final EditorPanel editorPanel = editorPanels[ i ];
+            final String      panelTitle  = (i+1) + " " + editorPanel.getPanelTitle();
+
+            tabbedPane.addTab( panelTitle, editorPanel );
+
+            if ( i < 9 ) // We only set 1..9 mnemonic characters
+                tabbedPane.setMnemonicAt( i, '1' + i );
+        }
+
+        tabbedPane.addChangeListener( controller );
+
+        add( tabbedPane , BorderLayout.CENTER );
+    }
+
 }