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

java.lang.Object
  extended byorg.eclipse.core.commands.common.EventManager
      extended byorg.eclipse.ui.part.WorkbenchPart
          extended byorg.eclipse.ui.part.EditorPart
              extended byuk.ac.kcl.cch.jb.pliny.browser.BrowserEditor
All Implemented Interfaces:
org.eclipse.gef.commands.CommandStackListener, org.eclipse.core.runtime.IAdaptable, org.eclipse.ui.IEditorPart, org.eclipse.core.runtime.IExecutableExtension, IHandlesAnnotations, IPropertyChangeObject, IResourceChangeablePart, IResourceDrivenPart, org.eclipse.ui.ISaveablePart, org.eclipse.jface.viewers.ISelectionChangedListener, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.ui.part.IWorkbenchPartOrientation

public class BrowserEditor
extends org.eclipse.ui.part.EditorPart
implements IHandlesAnnotations, org.eclipse.jface.viewers.ISelectionChangedListener, org.eclipse.gef.commands.CommandStackListener, IResourceDrivenPart, IResourceChangeablePart

A web browser integrated with Pliny so that it runs a browser and a Pliny reference area separated by a SWT sash. The browsers viewer part of the code is largely taken from WebBrowserEditor in org.eclipse.ui.internal.browser. We would have done an inherited class for this except that this package supports no access outside of itself.


Field Summary
static String BROWSER_ID
           
protected  BrowserEditorCutCopyPasteAction copyAction
           
protected  BrowserEditorCutCopyPasteAction cutAction
           
protected  org.eclipse.gef.ui.actions.DeleteAction deleteAction
           
protected  org.eclipse.swt.graphics.Image image
           
protected  String initialURL
           
protected  BrowserEditorCutCopyPasteAction pasteAction
           
protected  org.eclipse.gef.ui.actions.RedoAction redoAction
           
protected  org.eclipse.gef.ui.actions.UndoAction undoAction
           
protected  BrowserViewer webBrowser
           
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Fields inherited from interface uk.ac.kcl.cch.jb.pliny.editors.IResourceChangeablePart
CHANGE_EVENT
 
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
 
Constructor Summary
BrowserEditor()
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
          Attach a non-null PropertyChangeListener to this object.
 boolean close()
          Close the editor correctly.
 void commandStackChanged(EventObject event)
           
protected  void createActions()
           
 void createPartControl(org.eclipse.swt.widgets.Composite parent)
           
 void defineBrowserArea(org.eclipse.swt.widgets.Composite parent)
           
 void dispose()
           
 void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
           
 void doSaveAs()
           
 org.eclipse.ui.IActionBars getActionBars()
           
protected  org.eclipse.gef.ui.actions.ActionRegistry getActionRegistry()
           
 Object getAdapter(Class adapter)
           
protected  BrowserEditorInput getBrowserEditorInput()
          Returns the web editor input, if available.
 org.eclipse.gef.commands.CommandStack getCommandStack()
           
 org.eclipse.jface.action.IAction getCopyAction()
          Returns the copy action.
 Resource getCurrentResource()
           
 org.eclipse.jface.action.IAction getCutAction()
          Returns the cut action.
 org.eclipse.gef.EditDomain getEditDomain()
           
 Resource getMyResource()
          returns the Resource that this part is currently using as its input.
 org.eclipse.jface.action.IAction getPasteAction()
          Returns the paste action.
 void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input)
           
 boolean isDirty()
           
 boolean isDisposed()
           
 boolean isSaveAsAllowed()
           
 void removePropertyChangeListener(PropertyChangeListener l)
          Remove a PropertyChangeListener from this component.
 void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
           
 void setFocus()
           
 void updateCommandStackActions()
           
 void updateLocation(String newURL)
           
 void updateTitle(String title)
           
 
Methods inherited from class org.eclipse.ui.part.EditorPart
checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setInputWithNotify, setPartName
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPropertyListener, firePropertyChange, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getSite, getTitle, getTitleImage, removePropertyListener, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
 

Field Detail

webBrowser

protected BrowserViewer webBrowser

initialURL

protected String initialURL

image

protected org.eclipse.swt.graphics.Image image

cutAction

protected BrowserEditorCutCopyPasteAction cutAction

copyAction

protected BrowserEditorCutCopyPasteAction copyAction

pasteAction

protected BrowserEditorCutCopyPasteAction pasteAction

deleteAction

protected org.eclipse.gef.ui.actions.DeleteAction deleteAction

undoAction

protected org.eclipse.gef.ui.actions.UndoAction undoAction

redoAction

protected org.eclipse.gef.ui.actions.RedoAction redoAction

BROWSER_ID

public static final String BROWSER_ID
See Also:
Constant Field Values
Constructor Detail

BrowserEditor

public BrowserEditor()
Method Detail

getMyResource

public Resource getMyResource()
Description copied from interface: IResourceDrivenPart
returns the Resource that this part is currently using as its input.

Specified by:
getMyResource in interface IResourceDrivenPart
Returns:
Resource

defineBrowserArea

public void defineBrowserArea(org.eclipse.swt.widgets.Composite parent)

getCurrentResource

public Resource getCurrentResource()

getEditDomain

public org.eclipse.gef.EditDomain getEditDomain()

getCommandStack

public org.eclipse.gef.commands.CommandStack getCommandStack()

createPartControl

public void createPartControl(org.eclipse.swt.widgets.Composite parent)
Specified by:
createPartControl in interface org.eclipse.ui.IWorkbenchPart

getActionRegistry

protected org.eclipse.gef.ui.actions.ActionRegistry getActionRegistry()

createActions

protected void createActions()

dispose

public void dispose()
Specified by:
dispose in interface org.eclipse.ui.IWorkbenchPart

isDisposed

public boolean isDisposed()

doSave

public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
Specified by:
doSave in interface org.eclipse.ui.ISaveablePart

doSaveAs

public void doSaveAs()
Specified by:
doSaveAs in interface org.eclipse.ui.ISaveablePart

getCopyAction

public org.eclipse.jface.action.IAction getCopyAction()
Returns the copy action.

Returns:
org.eclipse.jface.action.IAction

getCutAction

public org.eclipse.jface.action.IAction getCutAction()
Returns the cut action.

Returns:
org.eclipse.jface.action.IAction

getBrowserEditorInput

protected BrowserEditorInput getBrowserEditorInput()
Returns the web editor input, if available. If the input was of another type, null is returned.

Returns:
org.eclipse.ui.internal.browser.IWebBrowserEditorInput

getPasteAction

public org.eclipse.jface.action.IAction getPasteAction()
Returns the paste action.

Returns:
org.eclipse.jface.action.IAction

init

public void init(org.eclipse.ui.IEditorSite site,
                 org.eclipse.ui.IEditorInput input)
          throws org.eclipse.ui.PartInitException
Specified by:
init in interface org.eclipse.ui.IEditorPart
Throws:
org.eclipse.ui.PartInitException

isDirty

public boolean isDirty()
Specified by:
isDirty in interface org.eclipse.ui.ISaveablePart

isSaveAsAllowed

public boolean isSaveAsAllowed()
Specified by:
isSaveAsAllowed in interface org.eclipse.ui.ISaveablePart

setFocus

public void setFocus()
Specified by:
setFocus in interface org.eclipse.ui.IWorkbenchPart

close

public boolean close()
Close the editor correctly.


getActionBars

public org.eclipse.ui.IActionBars getActionBars()

getAdapter

public Object getAdapter(Class adapter)
Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable

updateLocation

public void updateLocation(String newURL)

updateTitle

public void updateTitle(String title)

updateCommandStackActions

public void updateCommandStackActions()

selectionChanged

public void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
Specified by:
selectionChanged in interface org.eclipse.jface.viewers.ISelectionChangedListener

commandStackChanged

public void commandStackChanged(EventObject event)
Specified by:
commandStackChanged in interface org.eclipse.gef.commands.CommandStackListener

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Description copied from interface: IPropertyChangeObject
Attach a non-null PropertyChangeListener to this object.

Specified by:
addPropertyChangeListener in interface IPropertyChangeObject
Parameters:
l - a non-null PropertyChangeListener instance

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Description copied from interface: IPropertyChangeObject
Remove a PropertyChangeListener from this component.

Specified by:
removePropertyChangeListener in interface IPropertyChangeObject
Parameters:
l - a PropertyChangeListener instance