}//GEN-LAST:event_tableKeyTyped
private void tableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableMouseClicked
if( evt.getClickCount() == 2 ) {
int row = table.getSelectedRow();
Resource r = model.getResource( row );
if( r instanceof Folder ) {
try {
App.current().view.showDetails( new FolderPanel( (Folder) r ) );
} catch( Exception ex ) {
throw new RuntimeException( ex );
}
} else {
File f = (File) r;
if( ( f.contentType != null && f.contentType.equals( "text/html" ) ) || f.name.endsWith( "html" ) ) {
BareBonesBrowserLaunch.openURL( r.href() );
} else if( ( f.contentType != null && f.contentType.contains( "image" ) ) || f.name.endsWith( "jpg" ) ) {
BareBonesBrowserLaunch.openURL( r.href() );
} else if( f.contentType != null && f.contentType.contains( "text" ) ) {
openTextEditor( f );
} else {
java.io.File dest = new java.io.File( "/home/brad/Desktop" ); // TODO
java.io.File rFile;
try {
rFile = r.downloadTo( dest, null );
} catch( Exception ex ) {
throw new RuntimeException( ex );
}
String url = "file://" + rFile.getAbsolutePath();
BareBonesBrowserLaunch.openURL( url );