public abstract class TextEditorBasedStructureViewModel extends java.lang.Object implements StructureViewModel, ProvidingTreeModel
StructureViewModel
implementation which is linked to a text editor.StructureViewModel.ElementInfoProvider, StructureViewModel.ExpandInfoProvider
Disposable.Parent
Modifier | Constructor and Description |
---|---|
protected |
TextEditorBasedStructureViewModel(Editor editor)
Creates a structure view model instance linked to the specified text editor.
|
protected |
TextEditorBasedStructureViewModel(Editor editor,
PsiFile file) |
protected |
TextEditorBasedStructureViewModel(PsiFile psiFile)
Creates a structure view model instance linked to a text editor displaying the specified
file.
|
Modifier and Type | Method and Description |
---|---|
void |
addEditorPositionListener(FileEditorPositionListener listener)
Adds a listener which gets notified when the selection in the editor linked to the
structure view moves to a different element visible in the structure view.
|
void |
addModelListener(ModelListener modelListener)
Adds a listener which gets notified when the data represented by the structure view
is changed and the structure view needs to be rebuilt.
|
void |
dispose()
Disposes of the model.
|
protected java.lang.Object |
findAcceptableElement(PsiElement element) |
void |
fireModelUpdate() |
java.lang.Object |
getCurrentEditorElement()
Returns the element currently selected in the editor linked to the structure view.
|
protected Editor |
getEditor() |
Filter [] |
getFilters()
Returns the array of actions for filtering items in the tree.
|
Grouper [] |
getGroupers()
Returns the list of actions for grouping items in the tree.
|
java.util.Collection<NodeProvider> |
getNodeProviders() |
protected PsiFile |
getPsiFile() |
Sorter [] |
getSorters()
Returns the array of actions for sorting items in the tree.
|
protected java.lang.Class [] |
getSuitableClasses()
Returns the list of PSI element classes which are shown as structure view elements.
|
boolean |
isEnabled(NodeProvider provider) |
protected boolean |
isSuitable(PsiElement element) |
void |
removeEditorPositionListener(FileEditorPositionListener listener)
Removes a listener which gets notified when the selection in the editor linked to the
structure view moves to a different element visible in the structure view.
|
void |
removeModelListener(ModelListener modelListener)
Removes a listener which gets notified when the data represented by the structure view
is changed and the structure view needs to be rebuilt.
|
boolean |
shouldEnterElement(java.lang.Object element) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRoot
protected TextEditorBasedStructureViewModel(PsiFile psiFile)
psiFile
- the file for which the structure view model is requested.protected TextEditorBasedStructureViewModel(Editor editor)
editor
- the editor for which the structure view model is requested.public final void addEditorPositionListener(FileEditorPositionListener listener)
StructureViewModel
addEditorPositionListener
in interface StructureViewModel
listener
- the listener to add.public final void removeEditorPositionListener(FileEditorPositionListener listener)
StructureViewModel
removeEditorPositionListener
in interface StructureViewModel
listener
- the listener to remove.public void dispose()
StructureViewModel
dispose
in interface StructureViewModel
dispose
in interface Disposable
public void fireModelUpdate()
public boolean shouldEnterElement(java.lang.Object element)
shouldEnterElement
in interface StructureViewModel
public java.lang.Object getCurrentEditorElement()
StructureViewModel
getCurrentEditorElement
in interface StructureViewModel
protected java.lang.Object findAcceptableElement(PsiElement element)
protected PsiFile getPsiFile()
protected boolean isSuitable(PsiElement element)
public void addModelListener(ModelListener modelListener)
StructureViewModel
addModelListener
in interface StructureViewModel
modelListener
- the listener to add.public void removeModelListener(ModelListener modelListener)
StructureViewModel
removeModelListener
in interface StructureViewModel
modelListener
- the listener to remove.protected java.lang.Class [] getSuitableClasses()
protected Editor getEditor()
public Grouper [] getGroupers()
TreeModel
getGroupers
in interface TreeModel
Grouper.EMPTY_ARRAY
public Sorter [] getSorters()
TreeModel
getSorters
in interface TreeModel
Sorter.EMPTY_ARRAY
public Filter [] getFilters()
TreeModel
getFilters
in interface TreeModel
Filter.EMPTY_ARRAY
public java.util.Collection<NodeProvider> getNodeProviders()
getNodeProviders
in interface ProvidingTreeModel
public boolean isEnabled(NodeProvider provider)
isEnabled
in interface ProvidingTreeModel