Ignore:
Timestamp:
2004-02-09T15:55:22+13:00 (20 years ago)
Author:
kjdon
Message:

tidied up preview stuff. if windows and mac, just uses the start/open command and never prompts the user for a browser. if linux, prompts the user (should be changed to look for netscape and mozilla first). now use new prompt, PreviewCommandDialog, to get the browser, not the file association dialog which is really confusing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/file/FileAssociationManager.java

    r6630 r6748  
    3232import org.greenstone.gatherer.Gatherer;
    3333import org.greenstone.gatherer.gui.FileAssociationDialog;
     34import org.greenstone.gatherer.gui.PreviewCommandDialog;
    3435import org.greenstone.gatherer.msm.MSMUtils;
    3536import org.greenstone.gatherer.util.StaticStrings;
     
    104105        return command;
    105106    }
    106     // Failing that we have to prompt the user for what they want to do, but we do our best to provide a sensible default (if available).
    107     // For windows we can have a pretty good guess
     107    command = null;
     108    // Failing that we have a guess at a sensible default
    108109    if(Utility.isWindows()) {
    109110        // we use cmd and start
     
    113114        command = StaticStrings.WIN_OPEN_COMMAND;//"cmd.exe /c start \"\" \""+url+"\"";
    114115        }
    115     }
    116 
    117     // Now prompt the user
    118     FileAssociationDialog dialog = new FileAssociationDialog(this);
    119     command = dialog.display(true, command);
    120     dialog.dispose();
    121     dialog = null;
     116    } else if (Utility.isMac()) {
     117        command = StaticStrings.MAC_OPEN_COMMAND; // "open %1"
     118    } else {
     119        // we try to look for a browser
     120    }
     121   
     122    // if we still haven't found something, prompt the user
     123    if (command == null) {
     124        PreviewCommandDialog dialog = new PreviewCommandDialog();
     125        command = dialog.display();
     126        dialog.dispose();
     127        dialog = null;
     128    }
    122129
    123130    // Store the result if any
    124     if(command != null) {
     131    if(command != null && !command.equals("")) {
    125132        Gatherer.config.setPreviewCommand(command);
    126     }
    127 
    128     // for now uder linux get the fileassoc thing. but eventually want a separate thing.
    129     // pretend we are trying to open an html file
    130     // Mmmoooo. - jmt12
    131 
     133        command = command.replaceAll(FILENAME_ARG, url);
     134        Gatherer.println("Result = " + command);
     135        return command;
     136    }
    132137    // if we haven't got a command by now, we'll never get one
    133     if (command == null) {
    134         Gatherer.println("Result = " + command);
    135         return null;
    136     }
    137     // Replace %1 with the url in quotes
    138     command = command.replaceAll(FILENAME_ARG, url);
    139     Gatherer.println("Result = " + command);
    140     return command;
     138    Gatherer.println("Result = null");
     139    return null;
     140   
    141141    }
    142142
Note: See TracChangeset for help on using the changeset viewer.