[Schmitzm-commits] r958 - in trunk/src: schmitzm/swing skrueger/geotools/selection

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Aug 9 19:14:04 CEST 2010


Author: alfonx
Date: 2010-08-09 19:14:03 +0200 (Mon, 09 Aug 2010)
New Revision: 958

Modified:
   trunk/src/schmitzm/swing/SwingUtil.java
   trunk/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java
Log:
Make "open folder" method work in Xubuntu

Modified: trunk/src/schmitzm/swing/SwingUtil.java
===================================================================
--- trunk/src/schmitzm/swing/SwingUtil.java	2010-08-09 17:13:37 UTC (rev 957)
+++ trunk/src/schmitzm/swing/SwingUtil.java	2010-08-09 17:14:03 UTC (rev 958)
@@ -423,8 +423,7 @@
 	 *            Eine Componente des zu zentrierenden Fensters. Wenn comp kein
 	 *            {@link Window} ist, wird das Parent {@link Window} ermittelt.
 	 * 
-	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
-	 *         Tzeggai</a>
+	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Tzeggai</a>
 	 */
 	public static void centerFrameOnScreenRandom(Component comp) {
 		Random r = new Random();
@@ -706,8 +705,7 @@
 	 *            GUI-Komponente
 	 * @param w
 	 *            Breite
-	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
-	 *         Tzeggai</a>
+	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Tzeggai</a>
 	 */
 	public static void setMinimumWidth(Component comp, int w) {
 		Dimension d = comp.getMinimumSize();
@@ -722,8 +720,7 @@
 	 *            GUI-Komponente
 	 * @param h
 	 *            Hoehe
-	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
-	 *         Tzeggai</a>
+	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Tzeggai</a>
 	 */
 	public static void setMinimumHeight(Component comp, int h) {
 		Dimension d = comp.getMinimumSize();
@@ -1265,8 +1262,7 @@
 	 * @param upIsUp
 	 *            Can be used to reverse the wheel (Down => Up in list).
 	 * 
-	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
-	 *         Tzeggai</a>
+	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Tzeggai</a>
 	 */
 	public static void addMouseWheelForCombobox(final JComboBox comboBox,
 			final boolean upIsUp) {
@@ -1312,8 +1308,7 @@
 	 * By default mouseheel up is up in the list.
 	 * 
 	 * 
-	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
-	 *         Tzeggai</a>
+	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Tzeggai</a>
 	 */
 	public static void addMouseWheelForCombobox(
 			final JComboBox comboBoxRuleListType) {
@@ -1321,12 +1316,12 @@
 	}
 
 	/**
-	 * Tries to open a folder with a system dependent file browser (Explorer or Nautilus etc.) The Java
-	 * Desktop integration sometimes lead to hard windows crashes around Sun JRE
-	 * 1.6.10, so we use plain command line tools here.
+	 * Tries to open a folder with a system dependent file browser (Explorer or
+	 * Nautilus etc.) The Java Desktop integration sometimes lead to hard
+	 * windows crashes around Sun JRE 1.6.10, so we use plain command line tools
+	 * here.
 	 * 
-	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
-	 *         Tzeggai</a>
+	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Tzeggai</a>
 	 */
 	public static void openOSFolder(final File fileDirectory) {
 
@@ -1336,11 +1331,9 @@
 		try {
 
 			if (SystemUtils.IS_OS_WINDOWS) {
-				// ****************************************************************************
-				// Trying to open a folder on Windows
-				// ****************************************************************************
+				// Windows
 				dir = dir.replace('/', '\\');
-				final String[] cmdList = { "cmd.exe", "/c explorer " + dir }; // TODO evt. anders machen für Lücken im String
+				final String[] cmdList = { "cmd.exe", "/c explorer " + dir }; // TODO
 				Runtime.getRuntime().exec(cmdList);
 			}
 
@@ -1350,11 +1343,10 @@
 				// ****************************************************************************
 
 				try {
+					// Ubuntu
 					final List<String> command = new ArrayList<String>();
 					command.add("nautilus");
 					command.add(dir);
-					// LOGGER.info("running " + cmd + dir);
-					// Runtime.getRuntime().exec(cmd + dir);
 					final ProcessBuilder builder = new ProcessBuilder(command);
 					builder.start();
 
@@ -1363,30 +1355,34 @@
 						final List<String> command = new ArrayList<String>();
 						command.add("dolphin");
 						command.add(dir);
-						// LOGGER.info("running " + cmd + dir);
-						// Runtime.getRuntime().exec(cmd + dir);
 						final ProcessBuilder builder = new ProcessBuilder(
 								command);
 						builder.start();
 					} catch (final Exception ee) {
-						final List<String> command = new ArrayList<String>();
-						command.add("konqueror");
-						command.add(dir);
-						// LOGGER.info("running " + cmd + dir);
-						// Runtime.getRuntime().exec(cmd + dir);
-						final ProcessBuilder builder = new ProcessBuilder(
-								command);
-						builder.start();
+						try {
+							// Kubuntu
+							final List<String> command = new ArrayList<String>();
+							command.add("konqueror");
+							command.add(dir);
+							final ProcessBuilder builder = new ProcessBuilder(
+									command);
+							builder.start();
+						} catch (Exception eee) {
+							// Xubuntu
+							final List<String> command = new ArrayList<String>();
+							command.add("thunar");
+							command.add(dir);
+							final ProcessBuilder builder = new ProcessBuilder(
+									command);
+							builder.start();
+						}
 					}
 				}
 			}
 
 			else if (SystemUtils.IS_OS_MAC) {
-				// ****************************************************************************
-				// Trying to open a folder on Mac
-				// ****************************************************************************
+				// Mac
 				cmd = "open ";
-				// LOGGER.info("running  " + cmd + dir);
 				Runtime.getRuntime().exec(cmd + dir);
 			}
 
@@ -1394,5 +1390,4 @@
 			LOGGER.info("failed", e);
 		}
 	}
-
 }

Modified: trunk/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java
===================================================================
--- trunk/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java	2010-08-09 17:13:37 UTC (rev 957)
+++ trunk/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java	2010-08-09 17:14:03 UTC (rev 958)
@@ -300,7 +300,7 @@
 					//
 					StylingUtil.saveStyleToSLD(newStyle, new File(
 							"/home/stefan/Desktop/selection.sld"));
-				} catch (Exception e) {
+				} catch (final Throwable e) {
 				}
 
 				// DuplicatingStyleVisitor dsv = new DuplicatingStyleVisitor();



More information about the Schmitzm-commits mailing list