|
30 | 30 | import javafx.fxml.FXML; |
31 | 31 | import javafx.scene.Cursor; |
32 | 32 | import javafx.scene.control.*; |
| 33 | +import javafx.scene.control.MenuItem; |
33 | 34 | import javafx.scene.image.Image; |
34 | 35 | import javafx.scene.image.ImageView; |
35 | 36 | import javafx.scene.input.MouseEvent; |
|
46 | 47 | import org.phoebus.ui.javafx.ImageCache; |
47 | 48 |
|
48 | 49 | import javax.imageio.ImageIO; |
| 50 | +import java.awt.*; |
49 | 51 | import java.awt.image.BufferedImage; |
50 | 52 | import java.io.File; |
51 | 53 | import java.io.IOException; |
@@ -120,13 +122,18 @@ public void changed(ObservableValue<? extends Attachment> observable, Attachment |
120 | 122 | defaultApp.create(attachment.getFile().toURI()); |
121 | 123 | return; |
122 | 124 | } |
| 125 | + |
123 | 126 | // If not internal apps are found look for external apps |
124 | 127 | String fileName = attachment.getFile().getName(); |
125 | 128 | String[] parts = fileName.split("\\."); |
126 | 129 | if(parts.length == 1 || !ApplicationService.getExtensionsHandledByExternalApp().contains(parts[parts.length - 1])){ |
127 | | - // If there is no app configured for the file type, show an error message and return. |
128 | | - ExceptionDetailsErrorDialog.openError(Messages.PreviewOpenErrorTitle, Messages.PreviewOpenErrorBody, null); |
129 | | - return; |
| 130 | + // If there is no app configured for the file type, then use the default configured for the OS/User |
| 131 | + try { |
| 132 | + Desktop.getDesktop().open(attachment.getFile()); |
| 133 | + return; |
| 134 | + } catch (IOException e) { |
| 135 | + ExceptionDetailsErrorDialog.openError(Messages.PreviewOpenErrorTitle, Messages.PreviewOpenErrorBody, null); |
| 136 | + } |
130 | 137 | } |
131 | 138 | } |
132 | 139 | ApplicationLauncherService.openFile(attachment.getFile(), false, null); |
|
0 commit comments