Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.ui.views.navigator
Class ResourceNavigator

    java.lang.Object
      org.eclipse.ui.part.WorkbenchPart
          org.eclipse.ui.part.ViewPart
              org.eclipse.ui.views.navigator.ResourceNavigator

All Implemented Interfaces:
  IAdaptable, IExecutableExtension, IResourceNavigator, ISetSelectionTarget, IViewPart, IWorkbenchPart, IWorkbenchPart2

public class ResourceNavigator
extends ViewPart
implements ISetSelectionTarget, IResourceNavigator

Implements the Resource Navigator view.

Field Summary
`static String` | `NAVIGATOR_VIEW_HELP_ID` Deprecated. No longer used but preserved to avoid an api change.

Fields inherited from interface org.eclipse.ui.IWorkbenchPart
`PROP_TITLE`

Constructor Summary
`ResourceNavigator()` Constructs a new resource navigator view.

Method Summary
`protected FrameList` | `createFrameList()` Creates the frame source and frame list, and connects them.
`void` | `createPartControl(Composite parent)` Creates the SWT controls for this workbench part.
`protected TreeViewer` | `createViewer(Composite parent)` Creates the viewer.
`void` | `dispose()` Disposes of this workbench part.
`protected void` | `editorActivated(IEditorPart editor)` An editor has been activated.
`protected void` | `fillContextMenu(IMenuManager menu)` Called when the context menu is about to open.
`protected ResourceNavigatorActionGroup` | `getActionGroup()` Returns the action group.
`Object` | `getAdapter(Class adapter)` Returns an object which is an instance of the given class associated with this object.
`FrameList` | `getFrameList()` Returns the frame list for this navigator.
`protected String` | `getHelpContextId()` Returns the help context id to use for this view.
`protected IAdaptable` | `getInitialInput()` Returns the initial input for the viewer.
`ResourcePatternFilter` | `getPatternFilter()` Returns the pattern filter for this view.
`AbstractUIPlugin` | `getPlugin()` Returns the navigator's plugin.
`Shell` | `getShell()` Deprecated. use getViewSite().getShell()
`protected IShowInSource` | `getShowInSource()` Returns the `IShowInSource` for this view.
`protected IShowInTarget` | `getShowInTarget()` Returns the `IShowInTarget` for this view.
`ResourceSorter` | `getSorter()` Returns the sorter.
`protected String` | `getStatusLineMessage(IStructuredSelection selection)` Returns the message to show in the status line.
`TreeViewer` | `getTreeViewer()` Returns the tree viewer which shows the resource hierarchy.
`TreeViewer` | `getViewer()` Returns the resource viewer which shows the resource hierarchy.
`IWorkingSet` | `getWorkingSet()` Returns the working set for this view.
`protected void` | `handleDoubleClick(DoubleClickEvent event)` Handles a double-click event from the viewer.
`protected void` | `handleKeyPressed(KeyEvent event)` Handles a key press event from the viewer.
`protected void` | `handleKeyReleased(KeyEvent event)` Handles a key release in the viewer.
`protected void` | `handleOpen(OpenEvent event)` Handles an open event from the viewer.
`protected void` | `handleSelectionChanged(SelectionChangedEvent event)` Handles a selection changed event from the viewer.
`void` | `init(IViewSite site, IMemento memento)` Initializes this view with the given view site.
`protected void` | `initContentProvider(TreeViewer viewer)` Sets the content provider for the viewer.
`protected void` | `initContextMenu()` Initializes and registers the context menu.
`protected void` | `initDragAndDrop()` Adds drag and drop support to the navigator.
`protected void` | `initFilters(TreeViewer viewer)` Adds the filters to the viewer.
`protected void` | `initLabelProvider(TreeViewer viewer)` Sets the label provider for the viewer.
`protected void` | `initListeners(TreeViewer viewer)` Adds the listeners to the viewer.
`protected void` | `initResourceSorter()` Initializes the sorter.
`boolean` | `isLinkingEnabled()` Returns whether the navigator selection automatically tracks the active editor.
`protected void` | `linkToEditor(IStructuredSelection selection)` Activates the editor if the selected resource is open.
`protected void` | `makeActions()` Creates the action group, which encapsulates all actions for the view.
`protected void` | `restoreState(IMemento memento)` Restores the state of the receiver to the state described in the specified memento.
`void` | `saveState(IMemento memento)` Saves the object state within a memento.
`void` | `selectReveal(ISelection selection)` Selects and reveals the specified elements.
`protected void` | `setActionGroup(ResourceNavigatorActionGroup actionGroup)` Sets the action group.
`void` | `setFiltersPreference(String[] patterns)` Saves the filters defined as strings in `patterns` in the preference store.
`void` | `setFocus()` Asks this part to take focus within the workbench.
`void` | `setLabelDecorator(ILabelDecorator decorator)` Deprecated. use the decorators extension point instead; see IWorkbench.getDecoratorManager()
`void` | `setLinkingEnabled(boolean enabled)` Sets whether this navigator's selection automatically tracks the active editor.
`void` | `setSorter(ResourceSorter sorter)` Sets the resource sorter.
`void` | `setWorkingSet(IWorkingSet workingSet)` Sets the working set for this view, or `null` to clear it.
`protected void` | `updateActionBars(IStructuredSelection selection)` Updates the action bar actions.
`protected void` | `updateStatusLine(IStructuredSelection selection)` Updates the message shown in the status line.
`void` | `updateTitle()` Updates the title text and title tool tip.

Methods inherited from class org.eclipse.ui.part.ViewPart
`getViewSite, init, setContentDescription, setInitializationData, setPartName`

Methods inherited from class org.eclipse.ui.part.WorkbenchPart
`addPropertyListener, firePropertyChange, getConfigurationElement, getContentDescription, getDefaultImage, getPartName, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.eclipse.ui.IViewPart
`getViewSite, init`

Methods inherited from interface org.eclipse.ui.IWorkbenchPart
`addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener`

Field Detail

### NAVIGATOR_VIEW_HELP_ID

    public static final String NAVIGATOR_VIEW_HELP_ID

  Deprecated. No longer used but preserved to avoid an api change.

  See Also:
    Constant Field Values

Constructor Detail

### ResourceNavigator

    public ResourceNavigator()

  Constructs a new resource navigator view.

Method Detail

### createPartControl

    public void createPartControl(Composite parent)

  Description copied from interface: `IWorkbenchPart`
  Creates the SWT controls for this workbench part.

  Clients should not call this method (the workbench calls this method when it needs to, which may be never).

  For implementors this is a multi-step process:

  1. Create one or more controls within the parent.
  2. Set the parent layout as needed.
  3. Register any global actions with the `IActionService`.
  4. Register any popup menus with the `IActionService`.
  5. Register a selection provider with the `ISelectionService` (optional).

  Specified by:
    `createPartControl` in interface `IWorkbenchPart`
  Specified by:
    `createPartControl` in class `WorkbenchPart`

### getHelpContextId

    protected String getHelpContextId()

  Returns the help context id to use for this view.

  Since:
    2.0

### initContextMenu

    protected void initContextMenu()

  Initializes and registers the context menu.

  Since:
    2.0

### createViewer

    protected TreeViewer createViewer(Composite parent)

  Creates the viewer.

  Parameters:
    `parent` - the parent composite
  Since:
    2.0

### initContentProvider

    protected void initContentProvider(TreeViewer viewer)

  Sets the content provider for the viewer.

  Parameters:
    `viewer` - the viewer
  Since:
    2.0

### initLabelProvider

    protected void initLabelProvider(TreeViewer viewer)

  Sets the label provider for the viewer.

  Parameters:
    `viewer` - the viewer
  Since:
    2.0

### initFilters

    protected void initFilters(TreeViewer viewer)

  Adds the filters to the viewer.

  Parameters:
    `viewer` - the viewer
  Since:
    2.0

### initListeners

    protected void initListeners(TreeViewer viewer)

  Adds the listeners to the viewer.

  Parameters:
    `viewer` - the viewer
  Since:
    2.0

### dispose

    public void dispose()

  Description copied from interface: `IWorkbenchPart`
  Disposes of this workbench part.

  This is the last method called on the `IWorkbenchPart`. At this point the part controls (if they were ever created) have been disposed as part of an SWT composite. There is no guarantee that createPartControl() has been called, so the part controls may never have been created.

  Within this method a part may release any resources, fonts, images, etc. held by this part. It is also very important to deregister all listeners from the workbench.

  Clients should not call this method (the workbench calls this method at appropriate times).

  Specified by:
    `dispose` in interface `IWorkbenchPart`
  Overrides:
    `dispose` in class `WorkbenchPart`

### editorActivated

    protected void editorActivated(IEditorPart editor)

  An editor has been activated. Sets the selection in this navigator to be the editor's input, if linking is enabled.

  Parameters:
    `editor` - the active editor
  Since:
    2.0

### fillContextMenu

    protected void fillContextMenu(IMenuManager menu)

  Called when the context menu is about to open. Delegates to the action group using the viewer's selection as the action context.

  Since:
    2.0

### getFrameList

    public FrameList getFrameList()

  Description copied from interface: `IResourceNavigator`
  Returns the frame list for this navigator.

  Specified by:
    `getFrameList` in interface `IResourceNavigator`

### getInitialInput

    protected IAdaptable getInitialInput()

  Returns the initial input for the viewer. Tries to convert the page input to a resource, either directly or via IAdaptable. If the resource is a container, it uses that. If the resource is a file, it uses its parent folder. If a resource could not be obtained, it uses the workspace root.

  Since:
    2.0

### getPatternFilter

    public ResourcePatternFilter getPatternFilter()

  Returns the pattern filter for this view.

  Specified by:
    `getPatternFilter` in interface `IResourceNavigator`
  Returns:
    the pattern filter
  Since:
    2.0

### getWorkingSet

    public IWorkingSet getWorkingSet()

  Returns the working set for this view.

  Specified by:
    `getWorkingSet` in interface `IResourceNavigator`
  Returns:
    the working set
  Since:
    2.0

### getPlugin

    public AbstractUIPlugin getPlugin()

  Returns the navigator's plugin.

### getSorter

    public ResourceSorter getSorter()

  Returns the sorter.

  Specified by:
    `getSorter` in interface `IResourceNavigator`
  Since:
    2.0

### getViewer

    public TreeViewer getViewer()

  Returns the resource viewer which shows the resource hierarchy.

  Specified by:
    `getViewer` in interface `IResourceNavigator`
  Since:
    2.0

### getTreeViewer

    public TreeViewer getTreeViewer()

  Returns the tree viewer which shows the resource hierarchy.

  Since:
    2.0

### getShell

    public Shell getShell()

  Deprecated. use getViewSite().getShell()

  Returns the shell to use for opening dialogs. Used in this class, and in the actions.

### getStatusLineMessage

    protected String getStatusLineMessage(IStructuredSelection selection)

  Returns the message to show in the status line.

  Parameters:
    `selection` - the current selection
  Returns:
    the status line message
  Since:
    2.0

### handleOpen

    protected void handleOpen(OpenEvent event)

  Handles an open event from the viewer. Opens an editor on the selected file.

  Parameters:
    `event` - the open event
  Since:
    2.0

### handleDoubleClick

    protected void handleDoubleClick(DoubleClickEvent event)

  Handles a double-click event from the viewer. Expands or collapses a folder when double-clicked.

  Parameters:
    `event` - the double-click event
  Since:
    2.0

### handleSelectionChanged

    protected void handleSelectionChanged(SelectionChangedEvent event)

  Handles a selection changed event from the viewer. Updates the status line and the action bars, and links to editor (if option enabled).

  Parameters:
    `event` - the selection event
  Since:
    2.0

### handleKeyPressed

    protected void handleKeyPressed(KeyEvent event)

  Handles a key press event from the viewer. Delegates to the action group.

  Parameters:
    `event` - the key event
  Since:
    2.0

### handleKeyReleased

    protected void handleKeyReleased(KeyEvent event)

  Handles a key release in the viewer. Does nothing by default.

  Parameters:
    `event` - the key event
  Since:
    2.0

### init

    public void init(IViewSite site,
                     IMemento memento)
              throws PartInitException

  Description copied from interface: `IViewPart`
  Initializes this view with the given view site. A memento is passed to the view which contains a snapshot of the views state from a previous session. Where possible, the view should try to recreate that state within the part controls.

  This method is automatically called by the workbench shortly after the part is instantiated. It marks the start of the views's lifecycle. Clients must not call this method.

  Specified by:
    `init` in interface `IViewPart`
  Overrides:
    `init` in class `ViewPart`
  Throws:
    `PartInitException`

### initDragAndDrop

    protected void initDragAndDrop()

  Adds drag and drop support to the navigator.

  Since:
    2.0

### createFrameList

    protected FrameList createFrameList()

  Creates the frame source and frame list, and connects them.

  Since:
    2.0

### initResourceSorter

    protected void initResourceSorter()

  Initializes the sorter.

### isLinkingEnabled

    public boolean isLinkingEnabled()

  Returns whether the navigator selection automatically tracks the active editor.

  Specified by:
    `isLinkingEnabled` in interface `IResourceNavigator`
  Returns:
    `true` if linking is enabled, `false` if not
  Since:
    2.0 (this was protected in 2.0, but was made public in 2.1)

### linkToEditor

    protected void linkToEditor(IStructuredSelection selection)

  Activates the editor if the selected resource is open.

  Since:
    2.0

### makeActions

    protected void makeActions()

  Creates the action group, which encapsulates all actions for the view.

### restoreState

    protected void restoreState(IMemento memento)

  Restores the state of the receiver to the state described in the specified memento.

  Parameters:
    `memento` - the memento
  Since:
    2.0

### saveState

    public void saveState(IMemento memento)

  Description copied from interface: `IViewPart`
  Saves the object state within a memento.

  Specified by:
    `saveState` in interface `IViewPart`
  Overrides:
    `saveState` in class `ViewPart`
  See Also:
    `ViewPart.saveState(org.eclipse.ui.IMemento)`

### selectReveal

    public void selectReveal(ISelection selection)

  Selects and reveals the specified elements.

  Specified by:
    `selectReveal` in interface `ISetSelectionTarget`
  Parameters:
    `selection` - the new element to select

### setFiltersPreference

    public void setFiltersPreference(String[] patterns)

  Saves the filters defined as strings in `patterns` in the preference store.

  Specified by:
    `setFiltersPreference` in interface `IResourceNavigator`

### setFocus

    public void setFocus()

  Description copied from interface: `IWorkbenchPart`
  Asks this part to take focus within the workbench.

  Clients should not call this method (the workbench calls this method at appropriate times). To have the workbench activate a part, use `IWorkbenchPage.activate(IWorkbenchPart) instead`.

  Specified by:
    `setFocus` in interface `IWorkbenchPart`
  Specified by:
    `setFocus` in class `WorkbenchPart`
  See Also:
    `IWorkbenchPart.setFocus()`

### setLabelDecorator

    public void setLabelDecorator(ILabelDecorator decorator)

  Deprecated. use the decorators extension point instead; see IWorkbench.getDecoratorManager()

  Note: For experimental use only. Sets the decorator for the navigator.

  As of 2.0, this method no longer has any effect.

  Parameters:
    `decorator` - a label decorator or `null` for no decorations.

### setLinkingEnabled

    public void setLinkingEnabled(boolean enabled)

  Description copied from interface: `IResourceNavigator`
  Sets whether this navigator's selection automatically tracks the active editor.

  Specified by:
    `setLinkingEnabled` in interface `IResourceNavigator`
  Parameters:
    `enabled` - `true` to enable, `false` to disable
  Since:
    2.1
  See Also:
    `IResourceNavigator.setLinkingEnabled(boolean)`

### setSorter

    public void setSorter(ResourceSorter sorter)

  Sets the resource sorter.

  Specified by:
    `setSorter` in interface `IResourceNavigator`
  Parameters:
    `sorter` - the resource sorter
  Since:
    2.0

### setWorkingSet

    public void setWorkingSet(IWorkingSet workingSet)

  Description copied from interface: `IResourceNavigator`
  Sets the working set for this view, or `null` to clear it.

  Specified by:
    `setWorkingSet` in interface `IResourceNavigator`
  Parameters:
    `workingSet` - the working set, or `null` to clear it

### updateActionBars

    protected void updateActionBars(IStructuredSelection selection)

  Updates the action bar actions.

  Parameters:
    `selection` - the current selection
  Since:
    2.0

### updateStatusLine

    protected void updateStatusLine(IStructuredSelection selection)

  Updates the message shown in the status line.

  Parameters:
    `selection` - the current selection

### updateTitle

    public void updateTitle()

  Updates the title text and title tool tip. Called whenever the input of the viewer changes. Called whenever the input of the viewer changes.

  Since:
    2.0

### getActionGroup

    protected ResourceNavigatorActionGroup getActionGroup()

  Returns the action group.

  Returns:
    the action group

### setActionGroup

    protected void setActionGroup(ResourceNavigatorActionGroup actionGroup)

  Sets the action group.

  Parameters:
    `actionGroup` - the action group

### getAdapter

    public Object getAdapter(Class adapter)

  Description copied from interface: `IAdaptable`
  Returns an object which is an instance of the given class associated with this object. Returns `null` if no such object can be found.

  Specified by:
    `getAdapter` in interface `IAdaptable`
  Overrides:
    `getAdapter` in class `WorkbenchPart`

### getShowInSource

    protected IShowInSource getShowInSource()

  Returns the `IShowInSource` for this view.

### getShowInTarget

    protected IShowInTarget getShowInTarget()

  Returns the `IShowInTarget` for this view.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| 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.