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

java.lang.Object
  extended byorg.eclipse.core.commands.common.EventManager
      extended byorg.eclipse.jface.action.AbstractAction
          extended byorg.eclipse.jface.action.Action
              extended byuk.ac.kcl.cch.jb.pliny.browser.BrowserAction
All Implemented Interfaces:
org.eclipse.jface.action.IAction

public class BrowserAction
extends org.eclipse.jface.action.Action

Text actions (cut, copy, paste) for the Web browser. This code had to be copied from org.eclipse.ui.internal.browser because access to it from other bundles is restricted.

This code is borrowed from the internal browser code (org.eclipse.ui.internal.browser) by John Bradley. It needed to be duplicated because the code was internal and not available for reuse outside in its original form.


Field Summary
protected  BrowserViewer browser
           
static byte COPY
           
static byte CUT
           
static byte PASTE
           
protected  byte type
           
 
Fields inherited from interface org.eclipse.jface.action.IAction
AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, AS_RADIO_BUTTON, AS_UNSPECIFIED, CHECKED, DESCRIPTION, ENABLED, HANDLED, IMAGE, RESULT, TEXT, TOOL_TIP_TEXT
 
Constructor Summary
protected BrowserAction(BrowserViewer browser, byte type)
          TextAction constructor comment.
 
Method Summary
 void copy()
          Copies the selected text to the clipboard.
 void cut()
          Moves the selected text to the clipboard.
 void delete()
          Deletes the character to the right of the caret.
 void paste()
          Replaces the selection with the clipboard text or insert the text at the current caret offset if there is no selection.
 void run()
          Implementation of method defined on IAction.
 
Methods inherited from class org.eclipse.jface.action.Action
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 
Methods inherited from class org.eclipse.jface.action.AbstractAction
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
 
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.jface.action.IAction
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

browser

protected BrowserViewer browser

type

protected byte type

CUT

public static final byte CUT
See Also:
Constant Field Values

COPY

public static final byte COPY
See Also:
Constant Field Values

PASTE

public static final byte PASTE
See Also:
Constant Field Values
Constructor Detail

BrowserAction

protected BrowserAction(BrowserViewer browser,
                        byte type)
TextAction constructor comment.

Method Detail

copy

public void copy()
Copies the selected text to the clipboard. The text will be put in the clipboard in plain text format.

Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

cut

public void cut()
Moves the selected text to the clipboard. The text will be put in the clipboard in plain text format and RTF format.

Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

delete

public void delete()
Deletes the character to the right of the caret. Delete the selected text if any.


paste

public void paste()
Replaces the selection with the clipboard text or insert the text at the current caret offset if there is no selection. If the widget has the SWT.SINGLE style and the clipboard text contains more than one line, only the first line without line delimiters is inserted in the widget.

Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

run

public void run()
Implementation of method defined on IAction.