[Schmitzm-commits] r2351 - trunk/schmitzm-core/src/main/java/de/schmitzm/swing
scm-commit at wald.intevation.org
scm-commit at wald.intevation.org
Fri Jun 21 23:19:31 CEST 2013
Author: mojays
Date: 2013-06-21 23:19:31 +0200 (Fri, 21 Jun 2013)
New Revision: 2351
Modified:
trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingUtil.java
Log:
SwingUtil: new method openLocalFile(.)
Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingUtil.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingUtil.java 2013-06-21 19:09:05 UTC (rev 2350)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingUtil.java 2013-06-21 21:19:31 UTC (rev 2351)
@@ -2657,6 +2657,20 @@
/**
+ * Opens a local file
+ *
+ * @param localFile file path
+ */
+ public static void openLocalFile(File localFile) throws Exception {
+ if (!Desktop.isDesktopSupported() || !Desktop.getDesktop().isSupported(Desktop.Action.OPEN))
+ throw new UnsupportedOperationException(R("SwingUtil.openDesktopFile.not.supported"));
+ if (localFile == null || !localFile.exists())
+ throw new FileNotFoundException(R("SwingUtil.openDesktopFile.file.not.found",localFile));
+ // Datei oeffnen
+ Desktop.getDesktop().open(localFile);
+ }
+
+ /**
* Oeffnet eine Datei aus dem Classpath ueber {@link Desktop#open(File)}. Hierzu wird die Datei ein lokales
* Verzeichnis kopiert.
* @param baseResourceClass
More information about the Schmitzm-commits
mailing list