uk.ac.kcl.cch.jb.pliny.browser
Class URLDropTargetListener

java.lang.Object
  extended byuk.ac.kcl.cch.jb.pliny.browser.URLDropTargetListener
All Implemented Interfaces:
org.eclipse.swt.dnd.DropTargetListener, EventListener, org.eclipse.swt.internal.SWTEventListener

public class URLDropTargetListener
extends Object
implements org.eclipse.swt.dnd.DropTargetListener

A SWT DropTargetListener that allows the user to drop a URL in the form of either the icon on an external web browser's address field or a URL shortcut onto the internal browser's address field. This will cause the internal browser to redirect itself to the given web page.

The code tries to locate the URL within the data provided by the drop, and if successful calls BrowserViewer.setURL(java.lang.String) to direct the internal browser to that page.

Author:
Bradley

Constructor Summary
URLDropTargetListener(org.eclipse.swt.widgets.Combo locationItem, BrowserViewer viewer)
           
 
Method Summary
 void dragEnter(org.eclipse.swt.dnd.DropTargetEvent event)
           
 void dragLeave(org.eclipse.swt.dnd.DropTargetEvent event)
           
 void dragOperationChanged(org.eclipse.swt.dnd.DropTargetEvent event)
           
 void dragOver(org.eclipse.swt.dnd.DropTargetEvent event)
           
 void drop(org.eclipse.swt.dnd.DropTargetEvent event)
           
 void dropAccept(org.eclipse.swt.dnd.DropTargetEvent event)
           
protected  String getFileContentsAsString(InputStream stream)
           
protected  void handleUrlFile(org.eclipse.core.runtime.IPath myPath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLDropTargetListener

public URLDropTargetListener(org.eclipse.swt.widgets.Combo locationItem,
                             BrowserViewer viewer)
Method Detail

dragEnter

public void dragEnter(org.eclipse.swt.dnd.DropTargetEvent event)
Specified by:
dragEnter in interface org.eclipse.swt.dnd.DropTargetListener

dragLeave

public void dragLeave(org.eclipse.swt.dnd.DropTargetEvent event)
Specified by:
dragLeave in interface org.eclipse.swt.dnd.DropTargetListener

dragOperationChanged

public void dragOperationChanged(org.eclipse.swt.dnd.DropTargetEvent event)
Specified by:
dragOperationChanged in interface org.eclipse.swt.dnd.DropTargetListener

dragOver

public void dragOver(org.eclipse.swt.dnd.DropTargetEvent event)
Specified by:
dragOver in interface org.eclipse.swt.dnd.DropTargetListener

drop

public void drop(org.eclipse.swt.dnd.DropTargetEvent event)
Specified by:
drop in interface org.eclipse.swt.dnd.DropTargetListener

handleUrlFile

protected void handleUrlFile(org.eclipse.core.runtime.IPath myPath)

getFileContentsAsString

protected String getFileContentsAsString(InputStream stream)

dropAccept

public void dropAccept(org.eclipse.swt.dnd.DropTargetEvent event)
Specified by:
dropAccept in interface org.eclipse.swt.dnd.DropTargetListener