Implement #5 #6 Swing client open attachment bug on linux - thanks to bma99

http://hg.idempiere.com/idempiere/issue/6
https://sourceforge.net/projects/adempiere/forums/forum/610548/topic/4409004
This commit is contained in:
Carlos Ruiz 2011-05-04 22:17:35 -05:00
parent 787f6095a5
commit fba1c3e5a4
1 changed files with 14 additions and 1 deletions

View File

@ -17,6 +17,7 @@
package org.compiere.apps;
import java.awt.BorderLayout;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Frame;
@ -28,6 +29,7 @@ import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import javax.swing.JFileChooser;
@ -554,8 +556,19 @@ public final class Attachment extends CDialog
// p.waitFor();
return true;
}
else // other OS
else // other OS. originally nothing here. add the following codes
{
try {
Desktop desktop = null;
if (Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
File file = new File(tempFile.getAbsolutePath());
desktop.open(file);
return true;
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
catch (Exception e)