Changeset 543
- Timestamp:
- 11/27/13 14:33:22 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/widgets/JfxBrowser.java
r541 r543 112 112 State = classLoader.loadClass("javafx.concurrent.Worker$State"); 113 113 StateConstants = Arrays.asList(State.getEnumConstants()); 114 System.out.println(StateConstants);115 114 116 115 } catch (Exception e) { … … 149 148 } 150 149 }); 151 } catch (IllegalAccessException e) { 152 e.printStackTrace(); 153 } catch (IllegalArgumentException e) { 154 e.printStackTrace(); 155 } catch (InvocationTargetException e) { 156 e.printStackTrace(); 157 } catch (InstantiationException e) { 150 } catch (Exception e) { 158 151 e.printStackTrace(); 159 152 } … … 233 226 234 227 WebEngineLoad.invoke(WebViewGetEngine.invoke(this.webview), url); 235 } catch (IllegalAccessException e) { 236 e.printStackTrace(); 237 } catch (IllegalArgumentException e) { 238 e.printStackTrace(); 239 } catch (InvocationTargetException e) { 240 e.printStackTrace(); 241 } catch (InstantiationException e) { 242 e.printStackTrace(); 243 } catch (SecurityException e) { 228 } catch (Exception e) { 244 229 e.printStackTrace(); 245 230 } … … 261 246 try { 262 247 WebViewSetPrefSize.invoke(this.webview, this.getWidth(), this.getHeight()); 263 } catch (IllegalAccessException e1) { 264 e1.printStackTrace(); 265 } catch (IllegalArgumentException e1) { 266 e1.printStackTrace(); 267 } catch (InvocationTargetException e1) { 268 e1.printStackTrace(); 269 } catch (SecurityException e1) { 248 } catch (Exception e1) { 270 249 e1.printStackTrace(); 271 250 } … … 308 287 Text carried = null; 309 288 if ((carried = FreeItems.getTextAttachedToCursor()) != null) { 310 this.navigate(carried.getText()); 289 String text = carried.getText().trim(); 290 String textLower = text.toLowerCase(); 291 // check if protocol is missing 292 // TODO: can/should we support other protocols such as ftp ??? 293 if(!(textLower.startsWith("http://") || text.startsWith("https://"))) { 294 // check if it's a search (will be a search if there is a ' ' before the first '.') 295 // TODO: maybe support changing the default search engine (using a settings frame like the proxy settings frame) 296 int firstSpace = text.indexOf(" "); 297 int firstDot = text.indexOf("."); 298 if(firstSpace != -1 && firstSpace < firstDot) { 299 // make it a search 300 text = "https://duckduckgo.com/?q=" + text; 301 } else { 302 // add the missing protocol 303 text = "http://" + text; 304 } 305 } 306 this.navigate(text); 307 FreeItems.getInstance().clear(); 311 308 return true; 312 309 } … … 320 317 try { 321 318 r = new String[] { (String) WebEngineGetLocation.invoke(WebViewGetEngine.invoke(this._browser.webview)) }; 322 } catch ( IllegalAccessException e) {319 } catch (Exception e) { 323 320 e.printStackTrace(); 324 } catch (IllegalArgumentException e) {325 e.printStackTrace();326 } catch (InvocationTargetException e) {327 e.printStackTrace();328 } catch (SecurityException e) {329 e.printStackTrace();330 321 } 331 322 }
Note:
See TracChangeset
for help on using the changeset viewer.