- Timestamp:
- 2004-01-16T16:04:59+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/file/FileAssociationManager.java
r6314 r6539 105 105 106 106 public String getBrowserCommand(String url) { 107 String command = null; 107 System.err.println("Get browser command: " + url); 108 // First off we try to retrieve one from the configuration 109 String command = Gatherer.config.getPreviewCommand(); 110 // If that worked, substitute in the url and return 111 if(command != null && command.length() > 0) { 112 command = command.replaceAll("%1", url); 113 System.err.println("Result = " + command); 114 return command; 115 } 116 // 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). 117 // For windows we can have a pretty good guess 108 118 if(Utility.isWindows()) { 109 119 // we use cmd and start … … 113 123 command = StaticStrings.WIN_OPEN_COMMAND;//"cmd.exe /c start \"\" \""+url+"\""; 114 124 } 115 command = command.replaceAll(FILENAME_ARG, url); 116 return command; 117 } 125 } 126 127 // Now prompt the user 128 FileAssociationDialog dialog = new FileAssociationDialog(this); 129 command = dialog.display(true, command); 130 dialog.dispose(); 131 dialog = null; 132 133 // Store the result if any 134 if(command != null) { 135 Gatherer.config.setPreviewCommand(command); 136 } 137 118 138 // for now uder linux get the fileassoc thing. but eventually want a separate thing. 119 // pretend we are t yring to open an html file139 // pretend we are trying to open an html file 120 140 // Mmmoooo. - jmt12 141 /* 121 142 String extension = "html"; 122 143 Element entry = getCommand(extension); … … 140 161 MSMUtils.setValue(entry, command.replaceAll("temp.html", FILENAME_ARG)); 141 162 } 142 163 */ 143 164 // if we haven't got a command by now, we'll never get one 144 if (command == null) return null; 165 if (command == null) { 166 System.err.println("Result = " + command); 167 return null; 168 } 145 169 // Replace %1 with the url in quotes 146 170 command = command.replaceAll(FILENAME_ARG, url); 171 System.err.println("Result = " + command); 147 172 return command; 148 173 }
Note:
See TracChangeset
for help on using the changeset viewer.