public class ModelSearchResultViewPage
extends org.eclipse.ui.part.Page
implements org.eclipse.search.ui.ISearchResultPage, org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor, org.eclipse.core.runtime.IAdaptable
Modifier and Type | Field and Description |
---|---|
protected static ModelSearchMatch[] |
EMPTY_MATCH_ARRAY |
static int |
FLAG_LAYOUT_FLAT
Flag (
value 1 ) denoting flat list layout. |
static int |
FLAG_LAYOUT_TREE
Flag (
value 2 ) denoting tree layout. |
protected java.util.Set<org.eclipse.ui.views.properties.IPropertySheetPage> |
propertySheetPages |
Constructor and Description |
---|
ModelSearchResultViewPage() |
ModelSearchResultViewPage(int supportedLayouts)
This constructor must be passed a combination of layout flags combined with bitwise or.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
canRemoveMatchesWith(org.eclipse.jface.viewers.ISelection selection)
Determines whether the provided selection can be used to remove matches from the result.
|
protected void |
clear() |
protected void |
configureTableViewer(org.eclipse.jface.viewers.TableViewer tableViewer) |
protected void |
configureTreeViewer(org.eclipse.jface.viewers.TreeViewer treeViewer) |
void |
createControl(org.eclipse.swt.widgets.Composite parent) |
protected org.eclipse.jface.viewers.TableViewer |
createTableViewer(org.eclipse.swt.widgets.Composite parent)
Creates the table viewer to be shown on this page.
|
protected org.eclipse.jface.viewers.TreeViewer |
createTreeViewer(org.eclipse.swt.widgets.Composite parent)
Creates the tree viewer to be shown on this page.
|
protected void |
elementsChanged(java.lang.Object[] updatedElements) |
protected void |
evaluateChangedElements(ModelSearchMatch[] matches,
java.util.Set<java.lang.Object> changedElements)
Evaluates the elements to that are later passed to
elementsChanged(Object[]) . |
protected void |
fillContextMenu(org.eclipse.jface.action.IMenuManager mgr)
Fills the context menu for this page.
|
protected void |
fillToolbar(org.eclipse.jface.action.IToolBarManager tbm)
Fills the toolbar contribution for this page.
|
java.lang.Object |
getAdapter(java.lang.Class adapter) |
java.lang.String |
getContributorId() |
org.eclipse.swt.widgets.Control |
getControl() |
ModelSearchMatch |
getCurrentMatch()
Returns the currently selected match.
|
int |
getDisplayedMatchCount(java.lang.Object element) |
ModelSearchMatch[] |
getDisplayedMatches(java.lang.Object element)
Returns the matches that are currently displayed for the given element.
|
java.lang.Integer |
getElementLimit()
Gets the maximal number of top level elements to be shown in a viewer.
|
java.lang.String |
getID() |
ModelSearchResult |
getInput()
Returns the currently shown result.
|
java.lang.String |
getLabel() |
int |
getLayout()
Return the layout this page is currently using.
|
org.eclipse.ui.views.properties.IPropertySheetPage |
getPropertySheetPage()
This creates a new property sheet page instance and manages it in the cache.
|
protected org.eclipse.jface.dialogs.IDialogSettings |
getSettings()
Returns a dialog settings object for this search result page.
|
java.lang.Object |
getUIState() |
org.eclipse.jface.viewers.StructuredViewer |
getViewer()
Returns the viewer currently used in this page.
|
protected org.eclipse.search.ui.ISearchResultViewPart |
getViewPart()
Returns the view part set with
setViewPart(ISearchResultViewPart) . |
void |
gotoNextMatch()
Selects the element corresponding to the next match and shows the match in an editor.
|
void |
gotoPreviousMatch()
Selects the element corresponding to the previous match and shows the match in an editor.
|
protected void |
handleOpen(org.eclipse.jface.viewers.OpenEvent event)
This method is called when the search page gets an 'open' event from its underlying viewer (for example on double
click).
|
protected void |
handleSearchResultChanged(org.eclipse.search.ui.SearchResultEvent e)
Handles a search result event for the current search result.
|
void |
internalRemoveSelected()
Note: this is internal API and should not be called from clients outside of the search plug-in.
|
boolean |
isLayoutSupported(int layout)
Determines whether a certain layout is supported by this search result page.
|
protected void |
postEnsureSelection()
Posts a UI update to make sure an element is selected.
|
void |
restoreState(org.eclipse.ui.IMemento memento) |
void |
saveState(org.eclipse.ui.IMemento memento) |
void |
setElementLimit(java.lang.Integer limit)
Sets the maximal number of top level elements to be shown in a viewer.
|
void |
setFocus() |
void |
setID(java.lang.String id) |
void |
setInput(org.eclipse.search.ui.ISearchResult newSearch,
java.lang.Object uiState) |
void |
setLayout(int layout)
Sets the layout of this search result page.
|
void |
setViewPart(org.eclipse.search.ui.ISearchResultViewPart part) |
dispose, getSite, init, makeContributions, setActionBars
protected static final ModelSearchMatch[] EMPTY_MATCH_ARRAY
protected java.util.Set<org.eclipse.ui.views.properties.IPropertySheetPage> propertySheetPages
public static final int FLAG_LAYOUT_FLAT
value 1
) denoting flat list layout.public static final int FLAG_LAYOUT_TREE
value 2
) denoting tree layout.public ModelSearchResultViewPage(int supportedLayouts)
supportedLayouts
- flags determining which layout options this page supports. Must not be 0FLAG_LAYOUT_FLAT
,
FLAG_LAYOUT_TREE
public ModelSearchResultViewPage()
public java.lang.Object getUIState()
getUIState
in interface org.eclipse.search.ui.ISearchResultPage
public void setInput(org.eclipse.search.ui.ISearchResult newSearch, java.lang.Object uiState)
setInput
in interface org.eclipse.search.ui.ISearchResultPage
public boolean isLayoutSupported(int layout)
layout
- the layout to test forModelSearchResultViewPage(int)
public void gotoNextMatch()
public void gotoPreviousMatch()
public ModelSearchResult getInput()
null
setInput(ISearchResult, Object)
public int getDisplayedMatchCount(java.lang.Object element)
protected org.eclipse.search.ui.ISearchResultViewPart getViewPart()
setViewPart(ISearchResultViewPart)
.null
if the view part hasn't been set yet (or set to null).public void setViewPart(org.eclipse.search.ui.ISearchResultViewPart part)
setViewPart
in interface org.eclipse.search.ui.ISearchResultPage
public void restoreState(org.eclipse.ui.IMemento memento)
restoreState
in interface org.eclipse.search.ui.ISearchResultPage
public void saveState(org.eclipse.ui.IMemento memento)
saveState
in interface org.eclipse.search.ui.ISearchResultPage
public void setID(java.lang.String id)
setID
in interface org.eclipse.search.ui.ISearchResultPage
public java.lang.String getID()
getID
in interface org.eclipse.search.ui.ISearchResultPage
public java.lang.String getLabel()
getLabel
in interface org.eclipse.search.ui.ISearchResultPage
protected org.eclipse.jface.dialogs.IDialogSettings getSettings()
getID()
public org.eclipse.jface.viewers.StructuredViewer getViewer()
null
if none has been created yet.public void internalRemoveSelected()
Removes the currently selected match. Does nothing if no match is selected.
public void createControl(org.eclipse.swt.widgets.Composite parent)
createControl
in interface org.eclipse.ui.part.IPage
createControl
in class org.eclipse.ui.part.Page
protected void configureTreeViewer(org.eclipse.jface.viewers.TreeViewer treeViewer)
protected void configureTableViewer(org.eclipse.jface.viewers.TableViewer tableViewer)
protected void handleOpen(org.eclipse.jface.viewers.OpenEvent event)
This method is called when the search page gets an 'open' event from its underlying viewer (for example on double click). The default implementation will open the first match on any element that has matches. If the element to be opened is an inner node in the tree layout, the node will be expanded if it's collapsed and vice versa. Subclasses are allowed to override this method.
event
- the event sent for the currently shown viewerIOpenListener
protected void fillToolbar(org.eclipse.jface.action.IToolBarManager tbm)
tbm
- the tool bar manager representing the view's toolbarpublic void setLayout(int layout)
FLAG_LAYOUT_FLAT
or
FLAG_LAYOUT_TREE
and it must be one of the values passed during construction of this search result
page.layout
- the new layoutisLayoutSupported(int)
protected org.eclipse.jface.viewers.TreeViewer createTreeViewer(org.eclipse.swt.widgets.Composite parent)
parent
- the parent widgetTreeViewer
.protected org.eclipse.jface.viewers.TableViewer createTableViewer(org.eclipse.swt.widgets.Composite parent)
parent
- the parent widgetTableViewer
protected void postEnsureSelection()
protected void fillContextMenu(org.eclipse.jface.action.IMenuManager mgr)
mgr
- the menu manager representing the context menuprotected boolean canRemoveMatchesWith(org.eclipse.jface.viewers.ISelection selection)
selection
- the selection to testtrue
if the elements in the current selection can be removed.public int getLayout()
FLAG_LAYOUT_FLAT
,
FLAG_LAYOUT_TREE
public ModelSearchMatch getCurrentMatch()
null
if none are selectedpublic ModelSearchMatch[] getDisplayedMatches(java.lang.Object element)
ModelSearchResult#getActiveMatchFilters()
is not null, only matches are returned that are not filtered by
the match filters. If ModelSearchResult#getActiveMatchFilters()
is null all matches of the given element
are returned. Any action operating on the visible matches in the search result page should use this method to get
the matches for a search result (instead of asking the search result directly).element
- The element to get the matches fornull
, an
empty array is returnedModelSearchResult.getMatches(Object)
public org.eclipse.swt.widgets.Control getControl()
getControl
in interface org.eclipse.ui.part.IPage
getControl
in class org.eclipse.ui.part.Page
public void setFocus()
setFocus
in interface org.eclipse.ui.part.IPage
setFocus
in class org.eclipse.ui.part.Page
public void setElementLimit(java.lang.Integer limit)
null
is set, the view page
does not support to limit the elements and will not provide UI to configure it. If a non-null value is set,
configuration UI will be provided. The limit value must be a positive number or -1
to not limit top
level element. If enabled, the element limit has to be enforced by the content provider that is implemented by
the client. The view page just manages the value and configuration.limit
- the element limit. Valid values are:
null
to not limit and not provide configuration UI-1
to not limit and provide configuration UIpositive integer
to limit by the given value and provide configuration UIpublic java.lang.Integer getElementLimit()
null
means the view page does
not limit the elements and will not provide UI to configure it. If a non-null value is set, configuration UI will
be provided. The limit value must be a positive number or -1
to not limit top level element.null
to not limit and not provide configuration UI (default value)-1
to not limit and provide configuration UIpositive integer
to limit by the given value and provide configuration UIprotected void handleSearchResultChanged(org.eclipse.search.ui.SearchResultEvent e)
e
- the event to handleprotected void evaluateChangedElements(ModelSearchMatch[] matches, java.util.Set<java.lang.Object> changedElements)
elementsChanged(Object[])
. By default the element to
change are the elements received by (ModelSearchMatch.getElement()
). Client implementations can modify
this behavior.matches
- the matches that were added or removedchangedElements
- the set that collects the elements to change. Clients should only add elements to the set.protected void elementsChanged(java.lang.Object[] updatedElements)
protected void clear()
public java.lang.Object getAdapter(java.lang.Class adapter)
getAdapter
in interface org.eclipse.core.runtime.IAdaptable
public org.eclipse.ui.views.properties.IPropertySheetPage getPropertySheetPage()
public java.lang.String getContributorId()
getContributorId
in interface org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor