|
Eclipse Platform Release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jface.text.link.LinkedModeModel
A LinkedModeModel
umbrellas several
LinkedPositionGroup
s. Once installed, the model
propagates any changes to a position to all its siblings in the same position
group.
Setting up a model consists of first adding
LinkedPositionGroup
s to it, and then installing the
model by either calling forceInstall()
or
tryInstall()
. After installing the model, it becomes
sealed and no more groups may be added.
If the document is changed outside any linked position, the model is
torn down and all positions are deleted. The same happens upon calling
exit(int)
.
A LinkedModeModel
may be nested into another model. This
happens when installing a model the positions of which all fit into a
single position in a parent model that has previously been installed on
the same document(s).
Clients may instantiate instances of this class.
Constructor Summary | |
LinkedModeModel()
|
Method Summary | |
void |
addGroup(LinkedPositionGroup group)
Adds a position group to this LinkedModeModel . |
void |
addLinkingListener(ILinkedModeListener listener)
Adds listener to the set of listeners that are informed
upon state changes. |
boolean |
anyPositionContains(int offset)
Returns whether an offset is contained by any position in this model. |
static void |
closeAllModels(IDocument document)
Cancels any linked mode model on the specified document. |
void |
exit(int flags)
Causes this model to exit. |
LinkedPosition |
findPosition(LinkedPosition toFind)
Finds the position in this model that is closest after toFind . |
void |
forceInstall()
Installs this model, which includes registering as document listener on all involved documents and storing global information about this model. |
LinkedPositionGroup |
getGroupForPosition(Position position)
Returns the linked position group that contains position ,
or null if position is not contained in any
group within this model. |
static LinkedModeModel |
getModel(IDocument document,
int offset)
Returns the model currently active on document at
offset , or null if there is none. |
List |
getTabStopSequence()
Returns the positions in this model that have a tab stop, in the order they were added. |
static boolean |
hasInstalledModel(IDocument document)
Checks whether there is already a model installed on document . |
static boolean |
hasInstalledModel(IDocument[] documents)
Checks whether there is already a linked mode model installed on any of the documents . |
boolean |
isNested()
Returns whether this model is nested. |
void |
removeLinkingListener(ILinkedModeListener listener)
Removes listener from the set of listeners that are
informed upon state changes. |
boolean |
tryInstall()
Installs this model, which includes registering as document listener on all involved documents and storing global information about this model. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LinkedModeModel()
Method Detail |
public static boolean hasInstalledModel(IDocument document)
document
.
document
- the IDocument
of interest
true
if there is an existing model, false
otherwisepublic static boolean hasInstalledModel(IDocument[] documents)
documents
.
documents
- the IDocument
s of interest
true
if there is an existing model, false
otherwisepublic static void closeAllModels(IDocument document)
document
- the document whose LinkedModeModel
should
be cancelledpublic static LinkedModeModel getModel(IDocument document, int offset)
document
at
offset
, or null
if there is none.
document
- the document for which the caller asks for a
modeloffset
- the offset into document
, as there may be
several models on a document
document
, or
null
public void exit(int flags)
This method part of the private protocol between
LinkedUIControl
and LinkedModeModel
.
flags
- the exit flags.public void addGroup(LinkedPositionGroup group) throws BadLocationException
LinkedModeModel
. This
method may not be called if the model has been installed. Also, if
a UI has been set up for this model, it may not pick up groups
added afterwards.
If the positions in group
conflict with any other group in
this model, a BadLocationException
is thrown. Also,
if this model is nested inside another one, all positions in all
groups of the child model have to reside within a single position in the
parent model, otherwise a BadLocationException
is thrown.
If group
already exists, nothing happens.
group
- the group to be added to this model
BadLocationException
- if the group conflicts with the other groups
in this model or violates the nesting requirements.
IllegalStateException
- if the method is called when the
model is already sealedpublic void forceInstall() throws BadLocationException
If an exception is thrown, the installation failed and the model is unusable.
BadLocationException
- if some of the positions of this model
were not valid positions on their respective documentspublic boolean tryInstall() throws BadLocationException
The return value states whether installation was successful; if not, the model is not installed and will not work.
true
if installation was successful,
false
otherwise
BadLocationException
- if some of the positions of this model
were not valid positions on their respective documentspublic boolean isNested()
This method is part of the private protocol between
LinkedUIControl
and LinkedModeModel
.
true
if this model is nested,
false
otherwisepublic List getTabStopSequence()
This method is part of the private protocol between
LinkedUIControl
and LinkedModeModel
.
public void addLinkingListener(ILinkedModeListener listener)
listener
to the set of listeners that are informed
upon state changes.
listener
- the new listenerpublic void removeLinkingListener(ILinkedModeListener listener)
listener
from the set of listeners that are
informed upon state changes.
listener
- the new listenerpublic LinkedPosition findPosition(LinkedPosition toFind)
toFind
. toFind
needs not be a position in
this model and serves merely as an offset.
This method part of the private protocol between
LinkedUIControl
and LinkedModeModel
.
toFind
- the position to search from
toFind
after the offset of toFind
, or null
public boolean anyPositionContains(int offset)
offset
- the offset to check
true
if offset
is included by any
position (see LinkedPosition.includes(int)
) in this
model, false
otherwisepublic LinkedPositionGroup getGroupForPosition(Position position)
position
,
or null
if position
is not contained in any
group within this model. Group containment is tested by calling
group.contains(position)
for every group
in
this model.
This method part of the private protocol between
LinkedUIControl
and LinkedModeModel
.
position
- the position the group of which is requested
group.contains(position)
returns true
,
or null
if no group contains position
|
Eclipse Platform Release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.