uk.ac.kcl.cch.jb.pliny.controls
Class ZoomControlContributionItem
java.lang.Object
org.eclipse.jface.action.ContributionItem
org.eclipse.jface.action.ControlContribution
uk.ac.kcl.cch.jb.pliny.controls.ZoomControlContributionItem
- All Implemented Interfaces:
- EventListener, org.eclipse.jface.action.IContributionItem, org.eclipse.swt.events.MouseListener, PropertyChangeListener, org.eclipse.swt.internal.SWTEventListener
- public class ZoomControlContributionItem
- extends org.eclipse.jface.action.ControlContribution
- implements org.eclipse.swt.events.MouseListener, PropertyChangeListener
this object extends JFACE's
ControlContribution
to provide a control in the Editor menubar that can control the size
of an image in a Pliny image-oriented editor.
An editor that wishes to use this control must implement the interface
IZoomableImageEditor
,
and then this control must be set up in the editor's ActionBarContributor which
in turn must invoke method setActiveEditor()
which notifies
the control which Resource is currently being edited, and allows it to set the
control to the appropriate point to reflect the current image size. See
example of the use of this code in the uk.ac.kcl.jb.pliny.imageRes
This object also tracks the Resource object which must implement interface
IZoomableImageResource
which gives access to the zoom parameter for that resource, and allows it to be
reset. This means that if the zoom parameter is changed elsewhere the position
of this tracker can be moved to track it.
There is also code here to handle situations where the Editor is of a kind
where the Resource can be changed during a single editor session (thereby
changing the image to be displayed, and the current zoom size). To make
sure this code is invoked the editor must implement the interface
IResourceChangeablePart
- Author:
- John Bradley
- See Also:
ImageEditorActionBarContributor
Methods inherited from class org.eclipse.jface.action.ControlContribution |
computeWidth, fill, fill, fill |
Methods inherited from class org.eclipse.jface.action.ContributionItem |
fill, getId, getParent, isDirty, isDynamic, isEnabled, isGroupMarker, isSeparator, isVisible, saveWidgetState, setParent, setVisible, toString, update, update |
ZoomControlContributionItem
public ZoomControlContributionItem(String zoom_id)
createControl
protected org.eclipse.swt.widgets.Control createControl(org.eclipse.swt.widgets.Composite parent)
dispose
public void dispose()
- Specified by:
dispose
in interface org.eclipse.jface.action.IContributionItem
setActiveEditor
public void setActiveEditor(IZoomableImageEditor newEditor)
- the ActionBarContributor must invoke this method whenever the active
editor instance changes.
- Parameters:
newEditor
- IZoomableImageEditor the new activated editor
mouseDoubleClick
public void mouseDoubleClick(org.eclipse.swt.events.MouseEvent e)
- Specified by:
mouseDoubleClick
in interface org.eclipse.swt.events.MouseListener
mouseDown
public void mouseDown(org.eclipse.swt.events.MouseEvent e)
- Specified by:
mouseDown
in interface org.eclipse.swt.events.MouseListener
mouseUp
public void mouseUp(org.eclipse.swt.events.MouseEvent e)
- Specified by:
mouseUp
in interface org.eclipse.swt.events.MouseListener
propertyChange
public void propertyChange(PropertyChangeEvent arg0)
- Specified by:
propertyChange
in interface PropertyChangeListener