public class LinkedModeUI extends Object
LinkedModeUI relies on all added
LinkedModeUITargets to provide implementations of
ITextViewer that implement ITextViewerExtension,
and the documents being edited to implement IDocumentExtension3.
Clients may instantiate and extend this class.
| Modifier and Type | Class and Description |
|---|---|
static class |
LinkedModeUI.ExitFlags
Exit flags returned if a custom exit policy wants to exit linked mode.
|
static interface |
LinkedModeUI.IExitPolicy
An exit policy can be registered by a caller to get custom exit
behavior.
|
static interface |
LinkedModeUI.ILinkedModeUIFocusListener
Listener that gets notified when the linked mode UI switches its focus position.
|
static class |
LinkedModeUI.LinkedModeUITarget
A link target consists of a viewer and gets notified if the linked mode UI on
it is being shown.
|
| Modifier and Type | Field and Description |
|---|---|
static Object |
CYCLE_ALWAYS
Constant indicating that this UI should always cycle from the last
position to the first and vice versa.
|
static Object |
CYCLE_NEVER
Constant indicating that this UI should never cycle from the last
position to the first and vice versa.
|
static Object |
CYCLE_WHEN_NO_PARENT
Constant indicating that this UI should cycle from the last position to
the first and vice versa if its model is not nested.
|
| Constructor and Description |
|---|
LinkedModeUI(LinkedModeModel model,
ITextViewer viewer)
Convenience constructor for just one viewer.
|
LinkedModeUI(LinkedModeModel model,
ITextViewer[] viewers)
Convenience constructor for multiple viewers.
|
LinkedModeUI(LinkedModeModel model,
LinkedModeUI.LinkedModeUITarget target)
Convenience constructor for one target.
|
LinkedModeUI(LinkedModeModel model,
LinkedModeUI.LinkedModeUITarget[] targets)
Creates a new UI on the given model and the set of viewers.
|
| Modifier and Type | Method and Description |
|---|---|
void |
enter()
Starts this UI on the first position.
|
IRegion |
getSelectedRegion()
Returns the currently selected region or
null. |
void |
setCyclingMode(Object mode)
Sets the cycling mode to either of
CYCLING_ALWAYS,
CYCLING_NEVER, or CYCLING_WHEN_NO_PARENT,
which is the default. |
void |
setDoContextInfo(boolean doContextInfo)
Sets the context info property.
|
void |
setExitPolicy(LinkedModeUI.IExitPolicy policy)
Sets an
IExitPolicy to customize the exit behavior of
this linked mode UI. |
void |
setExitPosition(ITextViewer viewer,
int offset,
int length,
int sequence)
Sets the exit position to move the caret to when linked mode is exited.
|
void |
setExitPosition(LinkedModeUI.LinkedModeUITarget target,
int offset,
int length,
int sequence)
Sets the exit position to move the caret to when linked mode mode is
exited.
|
protected void |
setPositionListener(LinkedModeUI.ILinkedModeUIFocusListener listener)
Sets the focus callback which will get informed when the focus of the
linked mode UI changes.
|
void |
setSimpleMode(boolean simple)
Sets the "simple" mode of the receiver.
|
public static final Object CYCLE_NEVER
public static final Object CYCLE_ALWAYS
public static final Object CYCLE_WHEN_NO_PARENT
public LinkedModeUI(LinkedModeModel model, LinkedModeUI.LinkedModeUITarget[] targets)
model - the linked mode modeltargets - the non-empty list of targets upon which the linked mode
UI should actpublic LinkedModeUI(LinkedModeModel model, ITextViewer viewer)
model - the linked mode modelviewer - the viewer upon which the linked mode UI should actpublic LinkedModeUI(LinkedModeModel model, ITextViewer[] viewers)
model - the linked mode modelviewers - the non-empty list of viewers upon which the linked mode
UI should actpublic LinkedModeUI(LinkedModeModel model, LinkedModeUI.LinkedModeUITarget target)
model - the linked mode modeltarget - the target upon which the linked mode UI should actpublic void enter()
public void setExitPolicy(LinkedModeUI.IExitPolicy policy)
IExitPolicy to customize the exit behavior of
this linked mode UI.policy - the exit policy to use.public void setExitPosition(LinkedModeUI.LinkedModeUITarget target, int offset, int length, int sequence) throws BadLocationException
target - the target where the exit position is locatedoffset - the offset of the exit positionlength - the length of the exit position (in case there should be a
selection)sequence - set to the tab stop position of the exit position, or
LinkedPositionGroup.NO_STOP if there should be no
tab stop.BadLocationException - if the position is not valid in the viewer's
documentpublic void setExitPosition(ITextViewer viewer, int offset, int length, int sequence) throws BadLocationException
viewer - the viewer where the exit position is locatedoffset - the offset of the exit positionlength - the length of the exit position (in case there should be a
selection)sequence - set to the tab stop position of the exit position, or
LinkedPositionGroup.NO_STOP if there should be no tab stop.BadLocationException - if the position is not valid in the
viewer's documentpublic void setCyclingMode(Object mode)
CYCLING_ALWAYS,
CYCLING_NEVER, or CYCLING_WHEN_NO_PARENT,
which is the default.mode - the new cycling mode.public IRegion getSelectedRegion()
null.nullpublic void setDoContextInfo(boolean doContextInfo)
true, context
info will be invoked on the current target's viewer whenever a position
is switched.doContextInfo - true if context information should be
displayedprotected void setPositionListener(LinkedModeUI.ILinkedModeUIFocusListener listener)
If there is a listener installed already, it will be replaced.
listener - the new listener, never null.public void setSimpleMode(boolean simple)
false. This method must be called
before it is entered.simple - true if the UI should be in simple mode.Guidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.