From 232ba5612a0d574de878a18fe217effcb7c75e95 Mon Sep 17 00:00:00 2001
From: mathiasdm <mathiasdm@mail.i2p>
Date: Tue, 25 Jan 2011 07:08:54 +0000
Subject: [PATCH] Whitespace cleanup, while we're not yet merged into trunk
 yet.

---
 .../i2p/desktopgui/ExternalTrayManager.java   |  58 +++++-----
 .../i2p/desktopgui/InternalTrayManager.java   |  24 ++--
 .../src/net/i2p/desktopgui/Main.java          |  36 +++---
 .../src/net/i2p/desktopgui/TrayManager.java   |  28 ++---
 .../desktopgui/i18n/DesktopguiTranslator.java |  24 ++--
 .../i2p/desktopgui/router/RouterManager.java  | 108 +++++++++---------
 .../i2p/desktopgui/util/BrowseException.java  |  30 ++---
 .../net/i2p/desktopgui/util/I2PDesktop.java   |  20 ++--
 8 files changed, 164 insertions(+), 164 deletions(-)

diff --git a/apps/desktopgui/src/net/i2p/desktopgui/ExternalTrayManager.java b/apps/desktopgui/src/net/i2p/desktopgui/ExternalTrayManager.java
index 702807ba2a..6fea46fef5 100644
--- a/apps/desktopgui/src/net/i2p/desktopgui/ExternalTrayManager.java
+++ b/apps/desktopgui/src/net/i2p/desktopgui/ExternalTrayManager.java
@@ -13,40 +13,40 @@ import net.i2p.util.Log;
 
 public class ExternalTrayManager extends TrayManager {
 	
-	private final static Log log = new Log(ExternalTrayManager.class);
+    private final static Log log = new Log(ExternalTrayManager.class);
 
-	protected ExternalTrayManager() {}
+    protected ExternalTrayManager() {}
 
-	@Override
-	public PopupMenu getMainMenu() {
-		PopupMenu popup = new PopupMenu();
+    @Override
+    public PopupMenu getMainMenu() {
+        PopupMenu popup = new PopupMenu();
         MenuItem startItem = new MenuItem(_("Start I2P"));
         startItem.addActionListener(new ActionListener() {
 
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				new SwingWorker<Object, Object>() {
-
-					@Override
-					protected Object doInBackground() throws Exception {
-						RouterManager.start();
-						return null;
-					}
-					
-					@Override
-					protected void done() {
-						trayIcon.displayMessage(_("Starting"), _("I2P is starting!"), TrayIcon.MessageType.INFO);
-						//Hide the tray icon.
-						//We cannot stop the desktopgui program entirely,
-						//since that risks killing the I2P process as well.
-						tray.remove(trayIcon);
-					}
-					
-				}.execute();
-			}
-        	
+            @Override
+            public void actionPerformed(ActionEvent arg0) {
+                new SwingWorker<Object, Object>() {
+
+                    @Override
+                    protected Object doInBackground() throws Exception {
+                        RouterManager.start();
+                        return null;
+                    }
+                    
+                    @Override
+                    protected void done() {
+                        trayIcon.displayMessage(_("Starting"), _("I2P is starting!"), TrayIcon.MessageType.INFO);
+                        //Hide the tray icon.
+                        //We cannot stop the desktopgui program entirely,
+                        //since that risks killing the I2P process as well.
+                        tray.remove(trayIcon);
+                    }
+                    
+                }.execute();
+            }
+            
         });
         popup.add(startItem);
-		return popup;
-	}
+        return popup;
+    }
 }
diff --git a/apps/desktopgui/src/net/i2p/desktopgui/InternalTrayManager.java b/apps/desktopgui/src/net/i2p/desktopgui/InternalTrayManager.java
index efa7e31a1b..46cb3deefb 100644
--- a/apps/desktopgui/src/net/i2p/desktopgui/InternalTrayManager.java
+++ b/apps/desktopgui/src/net/i2p/desktopgui/InternalTrayManager.java
@@ -16,13 +16,13 @@ public class InternalTrayManager extends TrayManager {
 	
 	private final static Log log = new Log(InternalTrayManager.class);
 
-	protected InternalTrayManager() {}
+    protected InternalTrayManager() {}
 
-	@Override
-	public PopupMenu getMainMenu() {
-		PopupMenu popup = new PopupMenu();
-		
-		MenuItem browserLauncher = new MenuItem(_("Launch I2P Browser"));
+    @Override
+    public PopupMenu getMainMenu() {
+        PopupMenu popup = new PopupMenu();
+        
+        MenuItem browserLauncher = new MenuItem(_("Launch I2P Browser"));
         browserLauncher.addActionListener(new ActionListener() {
             
             @Override
@@ -36,11 +36,11 @@ public class InternalTrayManager extends TrayManager {
                     
                     @Override
                     protected void done() {
-                    	try {
-							I2PDesktop.browse("http://localhost:7657");
-						} catch (BrowseException e1) {
-							log.log(Log.WARN, "Failed to open browser!", e1);
-						}    
+                        try {
+                            I2PDesktop.browse("http://localhost:7657");
+                        } catch (BrowseException e1) {
+                            log.log(Log.WARN, "Failed to open browser!", e1);
+                        }    
                     }
                     
                 }.execute();
@@ -89,5 +89,5 @@ public class InternalTrayManager extends TrayManager {
         popup.add(stopItem);
         
         return popup;
-	}
+    }
 }
diff --git a/apps/desktopgui/src/net/i2p/desktopgui/Main.java b/apps/desktopgui/src/net/i2p/desktopgui/Main.java
index 0783936ac2..56abf9e2c5 100644
--- a/apps/desktopgui/src/net/i2p/desktopgui/Main.java
+++ b/apps/desktopgui/src/net/i2p/desktopgui/Main.java
@@ -19,15 +19,15 @@ import net.i2p.util.I2PProperties.I2PPropertyCallback;
  * The main class of the application.
  */
 public class Main {
-	
+    
     ///Manages the lifetime of the tray icon.
     private TrayManager trayManager = null;
     private final static Log log = new Log(Main.class);
 
-	/**
-	 * Start the tray icon code (loads tray icon in the tray area).
-	 * @throws Exception 
-	 */
+    /**
+     * Start the tray icon code (loads tray icon in the tray area).
+     * @throws Exception 
+     */
     public void startUp() throws Exception {
         trayManager = TrayManager.getInstance();
         trayManager.startManager();
@@ -35,26 +35,26 @@ public class Main {
         if(RouterManager.inI2P()) {
             RouterManager.getRouterContext().addPropertyCallback(new I2PPropertyCallback() {
 
-    			@Override
-    			public void propertyChanged(String arg0, String arg1) {
-    				if(arg0.equals(Translate.PROP_LANG)) {
-    					trayManager.languageChanged();
-    				}
-    			}
-            	
+                @Override
+                public void propertyChanged(String arg0, String arg1) {
+                    if(arg0.equals(Translate.PROP_LANG)) {
+                        trayManager.languageChanged();
+                    }
+                }
+                
             });
         }
     }
     
     public static void main(String[] args) {
-    	beginStartup(args);
+        beginStartup(args);
     }
 
     /**
      * Main method launching the application.
      */
     public static void beginStartup(String[] args) {
-    	System.setProperty("java.awt.headless", "false");
+        System.setProperty("java.awt.headless", "false");
         try {
             UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
         } catch (ClassNotFoundException ex) {
@@ -62,9 +62,9 @@ public class Main {
         } catch (InstantiationException ex) {
             log.log(Log.ERROR, null, ex);
         } catch (IllegalAccessException ex) {
-        	log.log(Log.ERROR, null, ex);
+            log.log(Log.ERROR, null, ex);
         } catch (UnsupportedLookAndFeelException ex) {
-        	log.log(Log.ERROR, null, ex);
+            log.log(Log.ERROR, null, ex);
         }
         
         ConfigurationManager.getInstance().loadArguments(args);
@@ -78,10 +78,10 @@ public class Main {
             @Override
             public void run() {
                 try {
-                	main.startUp();
+                    main.startUp();
                 }
                 catch(Exception e) {
-                	log.error("Failed while running desktopgui!", e);
+                    log.error("Failed while running desktopgui!", e);
                 }
                 
             }
diff --git a/apps/desktopgui/src/net/i2p/desktopgui/TrayManager.java b/apps/desktopgui/src/net/i2p/desktopgui/TrayManager.java
index 01a5d611f2..f76b131af9 100644
--- a/apps/desktopgui/src/net/i2p/desktopgui/TrayManager.java
+++ b/apps/desktopgui/src/net/i2p/desktopgui/TrayManager.java
@@ -30,8 +30,8 @@ import net.i2p.util.Log;
  */
 public abstract class TrayManager {
 
-	private static TrayManager instance = null;
-	///The tray area, or null if unsupported
+    private static TrayManager instance = null;
+    ///The tray area, or null if unsupported
     protected SystemTray tray = null;
     ///Our tray icon, or null if unsupported
     protected TrayIcon trayIcon = null;
@@ -43,16 +43,16 @@ public abstract class TrayManager {
     protected TrayManager() {}
     
     protected static TrayManager getInstance() {
-    	if(instance == null) {
-    		boolean inI2P = RouterManager.inI2P();
-    		if(inI2P) {
-    			instance = new InternalTrayManager();
-    		}
-    		else {
-    			instance = new ExternalTrayManager();
-    		}
-    	}
-    	return instance;
+        if(instance == null) {
+            boolean inI2P = RouterManager.inI2P();
+            if(inI2P) {
+                instance = new InternalTrayManager();
+            }
+            else {
+                instance = new ExternalTrayManager();
+            }
+        }
+        return instance;
     }
 
     /**
@@ -65,13 +65,13 @@ public abstract class TrayManager {
             try {
                 tray.add(trayIcon);
             } catch (AWTException e) {
-            	log.log(Log.WARN, "Problem creating system tray icon!", e);
+                log.log(Log.WARN, "Problem creating system tray icon!", e);
             }
         }
     }
     
     protected void languageChanged() {
-    	trayIcon.setPopupMenu(getMainMenu());
+        trayIcon.setPopupMenu(getMainMenu());
     }
     
     /**
diff --git a/apps/desktopgui/src/net/i2p/desktopgui/i18n/DesktopguiTranslator.java b/apps/desktopgui/src/net/i2p/desktopgui/i18n/DesktopguiTranslator.java
index 3568ba6e03..e95cbc01f2 100644
--- a/apps/desktopgui/src/net/i2p/desktopgui/i18n/DesktopguiTranslator.java
+++ b/apps/desktopgui/src/net/i2p/desktopgui/i18n/DesktopguiTranslator.java
@@ -4,23 +4,23 @@ import net.i2p.I2PAppContext;
 import net.i2p.util.Translate;
 
 public class DesktopguiTranslator {
-	
+    
     private static final String BUNDLE_NAME = "net.i2p.desktopgui.messages";
-	
+    
     private static I2PAppContext ctx;
-	
-	private static I2PAppContext getRouterContext() {
-		if(ctx == null) {
-			ctx = I2PAppContext.getCurrentContext();
-		}
-		return ctx;
-	}
-	
+    
+    private static I2PAppContext getRouterContext() {
+        if(ctx == null) {
+            ctx = I2PAppContext.getCurrentContext();
+        }
+        return ctx;
+    }
+    
     public static String _(String s) {
-		return Translate.getString(s, getRouterContext(), BUNDLE_NAME);
+        return Translate.getString(s, getRouterContext(), BUNDLE_NAME);
     }
 
     public static String _(String s, Object o) {
-		return Translate.getString(s, o, getRouterContext(), BUNDLE_NAME);
+        return Translate.getString(s, o, getRouterContext(), BUNDLE_NAME);
     }
 }
diff --git a/apps/desktopgui/src/net/i2p/desktopgui/router/RouterManager.java b/apps/desktopgui/src/net/i2p/desktopgui/router/RouterManager.java
index 09c5558a6d..63f6ad588a 100644
--- a/apps/desktopgui/src/net/i2p/desktopgui/router/RouterManager.java
+++ b/apps/desktopgui/src/net/i2p/desktopgui/router/RouterManager.java
@@ -38,61 +38,61 @@ public class RouterManager {
 		try {
 			return getRouterContext().router();
 		} catch (Exception e) {
-			log.error("Failed to get router. Why did we request it if no RouterContext is available?", e);
-			return null;
-		}
-	}
-	
-	/**
-	 * Start an I2P router instance.
-	 * This method has limited knowledge
-	 * (there is no I2P instance running to collect information from).
-	 * 
-	 * It determines the I2P location using the I2PAppContext.
-	 */
-	public static void start() {
-		try {
-			//TODO: set/get PID
-			String separator = System.getProperty("file.separator");
-			String location = getAppContext().getBaseDir().getAbsolutePath();
-			
-			Runtime.getRuntime().exec(location + separator + "i2psvc " + location + separator + "wrapper.config");
-		} catch (IOException e) {
-			log.log(Log.WARN, "Failed to start I2P", e);
-		}
-	}
-	
-	/**
-	 * Restart the running I2P instance.
-	 */
-	public static void restart() {
-		if(inI2P()) {
-			getRouter().restart();
-		}
-	}
+	        log.error("Failed to get router. Why did we request it if no RouterContext is available?", e);
+            return null;
+        }
+    }
+    
+    /**
+     * Start an I2P router instance.
+     * This method has limited knowledge
+     * (there is no I2P instance running to collect information from).
+     * 
+     * It determines the I2P location using the I2PAppContext.
+     */
+    public static void start() {
+        try {
+            //TODO: set/get PID
+            String separator = System.getProperty("file.separator");
+            String location = getAppContext().getBaseDir().getAbsolutePath();
+            
+            Runtime.getRuntime().exec(location + separator + "i2psvc " + location + separator + "wrapper.config");
+        } catch (IOException e) {
+            log.log(Log.WARN, "Failed to start I2P", e);
+        }
+    }
+    
+    /**
+     * Restart the running I2P instance.
+     */
+    public static void restart() {
+        if(inI2P()) {
+            getRouter().restart();
+        }
+    }
 
-	/**
-	 * Stop the running I2P instance.
-	 */
-	public static void shutDown() {
-		if(inI2P()) {
-			Thread t = new Thread(new Runnable() {
+    /**
+     * Stop the running I2P instance.
+     */
+    public static void shutDown() {
+        if(inI2P()) {
+            Thread t = new Thread(new Runnable() {
 
-				@Override
-				public void run() {
-					WrapperManager.signalStopped(Router.EXIT_HARD);	
-				}
-				
-			});
-			t.start();
-			getRouter().shutdown(Router.EXIT_HARD);
-		}
+                @Override
+                public void run() {
+                    WrapperManager.signalStopped(Router.EXIT_HARD);    
+                }
+                
+            });
+            t.start();
+            getRouter().shutdown(Router.EXIT_HARD);
+        }
+    }
+    
+    /**
+     * Check if we are running inside I2P.
+     */
+    public static boolean inI2P() {
+        return context.isRouterContext();
     }
-	
-	/**
-	 * Check if we are running inside I2P.
-	 */
-	public static boolean inI2P() {
-		return context.isRouterContext();
-	}
 }
diff --git a/apps/desktopgui/src/net/i2p/desktopgui/util/BrowseException.java b/apps/desktopgui/src/net/i2p/desktopgui/util/BrowseException.java
index ec120a416a..a5e4f4350c 100644
--- a/apps/desktopgui/src/net/i2p/desktopgui/util/BrowseException.java
+++ b/apps/desktopgui/src/net/i2p/desktopgui/util/BrowseException.java
@@ -5,19 +5,19 @@ public class BrowseException extends Exception {
 	private static final long serialVersionUID = 1L;
 	
 	public BrowseException() {
-		super();
-	}
-	
-	public BrowseException(String s) {
-		super(s);
-	}
-	
-	public BrowseException(String s, Throwable t) {
-		super(s, t);
-	}
-	
-	public BrowseException(Throwable t) {
-		super(t);
-	}
-	
+        super();
+    }
+    
+    public BrowseException(String s) {
+        super(s);
+    }
+    
+    public BrowseException(String s, Throwable t) {
+        super(s, t);
+    }
+    
+    public BrowseException(Throwable t) {
+        super(t);
+    }
+    
 }
\ No newline at end of file
diff --git a/apps/desktopgui/src/net/i2p/desktopgui/util/I2PDesktop.java b/apps/desktopgui/src/net/i2p/desktopgui/util/I2PDesktop.java
index 3a35d5c318..ad6e14cb31 100644
--- a/apps/desktopgui/src/net/i2p/desktopgui/util/I2PDesktop.java
+++ b/apps/desktopgui/src/net/i2p/desktopgui/util/I2PDesktop.java
@@ -11,11 +11,11 @@ import net.i2p.desktopgui.router.RouterManager;
 import net.i2p.util.Log;
 
 public class I2PDesktop {
-	
-	private final static Log log = new Log(I2PDesktop.class);
-	
-	public static void browse(String url) throws BrowseException {
-		if(Desktop.isDesktopSupported()) {
+    
+    private final static Log log = new Log(I2PDesktop.class);
+    
+    public static void browse(String url) throws BrowseException {
+        if(Desktop.isDesktopSupported()) {
             Desktop desktop = Desktop.getDesktop();
             if(desktop.isSupported(Action.BROWSE)) {
                 try {
@@ -25,11 +25,11 @@ public class I2PDesktop {
                 }
             }
             else {
-            	throw new BrowseException();
+                throw new BrowseException();
             }
         }
-		else {
-			throw new BrowseException();
-		}
-	}
+        else {
+            throw new BrowseException();
+        }
+    }
 }
\ No newline at end of file
-- 
GitLab