[Schmitzm-commits] r957 - branches/2.2.x/src/schmitzm/swing
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Aug 9 19:13:38 CEST 2010
Author: alfonx
Date: 2010-08-09 19:13:37 +0200 (Mon, 09 Aug 2010)
New Revision: 957
Modified:
branches/2.2.x/src/schmitzm/swing/SwingUtil.java
Log:
Make "open folder" method work in Xubuntu
Modified: branches/2.2.x/src/schmitzm/swing/SwingUtil.java
===================================================================
--- branches/2.2.x/src/schmitzm/swing/SwingUtil.java 2010-08-05 18:47:31 UTC (rev 956)
+++ branches/2.2.x/src/schmitzm/swing/SwingUtil.java 2010-08-09 17:13:37 UTC (rev 957)
@@ -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);
}
}
-
}
More information about the Schmitzm-commits
mailing list