# Class ProjectExplorer

java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.ui.part.WorkbenchPart
org.eclipse.ui.part.ViewPart
org.eclipse.ui.navigator.CommonNavigator
org.eclipse.ui.navigator.resources.ProjectExplorer

All Implemented Interfaces:
  `IAdaptable, IExecutableExtension, IPersistable, ISaveablePart, ISaveablesSource, ISecondarySaveableSource, IViewPart, IWorkbenchPart, IWorkbenchPart2, IWorkbenchPart3, ISetSelectionTarget, IShowInTarget, IWorkbenchPartOrientation`

public final class ProjectExplorer extends CommonNavigator implements ISecondarySaveableSource

Since:
  3.2
See Also:
  - `CommonNavigator`
  - `INavigatorContentService`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`PROJECTS`
`static final String`
`VIEW_ID`
Provides a constant for the standard instance of the Common Navigator.
`static final int`
`WORKING_SETS`

### Fields inherited from class CommonNavigator

`IS_LINKING_ENABLED_PROPERTY, memento`

### Fields inherited from interface ISaveablePart

`PROP_DIRTY`

### Fields inherited from interface IWorkbenchPart

`PROP_TITLE`

## Constructor Summary

Constructors
Constructor
Description
`ProjectExplorer()`

## Method Summary

Modifier and Type
Method
Description
`protected ActionGroup`
`createCommonActionGroup()`
The ActionGroup is used to populate the ActionBars of Common Navigator View Part, and the returned implementation will have an opportunity to fill the ActionBars of the view as soon as it is created
`protected CommonViewer`
`createCommonViewer(Composite aParent)`
Creates and initializes an instance of `CommonViewer`.
`void`
`createPartControl(Composite aParent)`
Create the CommonViewer part control and setup the default providers as necessary.
`Saveable[]`
`getActiveSaveables()`
Returns the saveables currently active in the workbench part.
`String`
`getFrameToolTipText(Object element)`
Returns the tool tip text for the given element.
`int`
`getRootMode()`
`Saveable[]`
`getSaveables()`
Returns the saveables presented by the workbench part.
`String`
`getWorkingSetLabel()`
`protected void`
`handleDoubleClick(DoubleClickEvent anEvent)`
Note: This method is for internal use only.
`void`
`init(IViewSite site, IMemento memento)`
Note: This method is for internal use only.
`protected void`
`initListeners(TreeViewer viewer)`
Adds the listeners to the Common Viewer.
`boolean`
`isDirtyStateSupported()`
Whether the dirty state changes should be supported by the framework if the part directly implements `ISecondarySaveableSource`.
`void`
`saveState(IMemento aMemento)`
Note: This method is for internal use only.
`void`
`setRootMode(int mode)`
`void`
`setWorkingSetLabel(String label)`
`void`
`updateTitle()`
The superclass does not deal with the content description, handle it here.

### Methods inherited from class CommonNavigator

`createCommonManager, createCommonViewerObject, dispose, doSave, doSaveAs, getAdapter, getCommonViewer, getInitialInput, getLinkHelperService, getMemento, getNavigatorActionService, getNavigatorContentService, hasSaveablesProvider, isDirty, isLinkingEnabled, isSaveAsAllowed, isSaveOnCloseNeeded, selectReveal, setFocus, setLinkingEnabled, show`

### Methods inherited from class ViewPart

`checkSite, getViewSite, init, setContentDescription, setInitializationData, setPartName`

### Methods inherited from class WorkbenchPart

`addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, getTitleToolTip, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy`

### Methods inherited from class EventManager

`addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface IWorkbenchPart

`addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener`

## Field Details

### VIEW_ID

public static final String VIEW_ID
Provides a constant for the standard instance of the Common Navigator.

See Also:
  - `PlatformUI.getWorkbench()`
  - `IWorkbench.getActiveWorkbenchWindow()`
  - `IWorkbenchWindow.getActivePage()`
  - `IWorkbenchPage.findView(String)`
  - `IWorkbenchPage.findViewReference(String)`
  - Constant Field Values

### WORKING_SETS

public static final int WORKING_SETS

Since:
  3.4
See Also:
  - Constant Field Values

### PROJECTS

public static final int PROJECTS

Since:
  3.4
See Also:
  - Constant Field Values

## Constructor Details

### ProjectExplorer

public ProjectExplorer()

## Method Details

### init

public void init(IViewSite site, IMemento memento) throws PartInitException
Description copied from class: `CommonNavigator`

Note: This method is for internal use only. Clients should not call this method.

Specified by:
  `init` in interface `IViewPart`
Overrides:
  `init` in class `CommonNavigator`
Parameters:
  `site` - the view site
  `memento` - the IViewPart state or null if there is no previous saved state
Throws:
  `PartInitException` - if this view was not initialized successfully
See Also:
  - `ViewPart.init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)`

### saveState

public void saveState(IMemento aMemento)
Description copied from class: `CommonNavigator`

Note: This method is for internal use only. Clients should not call this method.

Specified by:
  `saveState` in interface `IPersistable`
Specified by:
  `saveState` in interface `IViewPart`
Overrides:
  `saveState` in class `CommonNavigator`
Parameters:
  `aMemento` - a memento to receive the object state
See Also:
  - `ViewPart.saveState(org.eclipse.ui.IMemento)`

### createPartControl

public void createPartControl(Composite aParent)
Description copied from class: `CommonNavigator`

Create the CommonViewer part control and setup the default providers as necessary.

Specified by:
  `createPartControl` in interface `IWorkbenchPart`
Overrides:
  `createPartControl` in class `CommonNavigator`
Parameters:
  `aParent` - the parent control
See Also:
  - `WorkbenchPart.createPartControl(org.eclipse.swt.widgets.Composite)`

### createCommonActionGroup

protected ActionGroup createCommonActionGroup()
Description copied from class: `CommonNavigator`

The ActionGroup is used to populate the ActionBars of Common Navigator View Part, and the returned implementation will have an opportunity to fill the ActionBars of the view as soon as it is created. (`ActionGroup.fillActionBars(org.eclipse.ui.IActionBars)`.

The default implementation returns an action group which will add the following actions:

- Link with editor support. Allows the user to toggling linking the current selection with the active editors.

- Collapse all. Collapses all expanded nodes.

- Select Filters. Provides access to the "Select Filters" dialog that allows users to enable/disable filters and also the Content Extension activations.

Overrides:
  `createCommonActionGroup` in class `CommonNavigator`
Returns:
  The Action Group to be associated with the Common Navigator View Part.

### updateTitle

public void updateTitle()
The superclass does not deal with the content description, handle it here.

Overrides:
  `updateTitle` in class `CommonNavigator`
Restriction:
  This method is not intended to be referenced by clients.

### getFrameToolTipText

public String getFrameToolTipText(Object element)
Returns the tool tip text for the given element.

Overrides:
  `getFrameToolTipText` in class `CommonNavigator`
Parameters:
  `element` - the element
Returns:
  the tooltip
Restriction:
  This method is not intended to be referenced by clients.

### setRootMode

public void setRootMode(int mode)

Overrides:
  `setRootMode` in class `CommonNavigator`
Parameters:
  `mode` - root mode to set
Since:
  3.4
Restriction:
  This method is not intended to be referenced by clients.

### getRootMode

public int getRootMode()

Overrides:
  `getRootMode` in class `CommonNavigator`
Returns:
  the root mode
Since:
  3.4
Restriction:
  This method is not intended to be referenced by clients.

### setWorkingSetLabel

public void setWorkingSetLabel(String label)

Overrides:
  `setWorkingSetLabel` in class `CommonNavigator`
Parameters:
  `label` - working set label
Since:
  3.4
Restriction:
  This method is not intended to be referenced by clients.

### getWorkingSetLabel

public String getWorkingSetLabel()

Overrides:
  `getWorkingSetLabel` in class `CommonNavigator`
Returns:
  the working set label
Since:
  3.4
Restriction:
  This method is not intended to be referenced by clients.

### handleDoubleClick

protected void handleDoubleClick(DoubleClickEvent anEvent)
Description copied from class: `CommonNavigator`

Note: This method is for internal use only. Clients should not call this method.

Overrides:
  `handleDoubleClick` in class `CommonNavigator`
Parameters:
  `anEvent` - Supplied by the DoubleClick listener.

### createCommonViewer

protected CommonViewer createCommonViewer(Composite aParent)
Description copied from class: `CommonNavigator`
Creates and initializes an instance of `CommonViewer`. The ID of the Eclipse view part will be used to create the viewer. The ID is important as some extensions indicate they should only be used with a particular viewer ID.

Overrides:
  `createCommonViewer` in class `CommonNavigator`
Parameters:
  `aParent` - A composite parent to contain the Common Viewer
Returns:
  An initialized instance of CommonViewer

### getSaveables

public Saveable[] getSaveables()
Description copied from interface: `ISaveablesSource`
Returns the saveables presented by the workbench part. If the return value of this method changes during the lifetime of this part (i.e. after initialization and control creation but before disposal) the part must notify an implicit listener using `ISaveablesLifecycleListener.handleLifecycleEvent(SaveablesLifecycleEvent)`.

Additions of saveables to the list of saveables of this part are announced using an event of type `SaveablesLifecycleEvent.POST_OPEN`. Removals are announced in a two-stage process, first using an event of type `SaveablesLifecycleEvent.PRE_CLOSE` followed by an event of type `SaveablesLifecycleEvent.POST_CLOSE`. Since firing the `PRE_CLOSE` event may trigger prompts to save dirty saveables, the cancellation status of the event must be checked by the part after the notification. When removing only non-dirty saveables, `POST_CLOSE` notification is sufficient.

The listener is obtained from the part site by calling `partSite.getService(ISaveablesLifecycleListener.class)`.

The part must not notify from its initialization methods (e.g. `init` or `createPartControl`), or from its dispose method. Parts that implement `IReusableEditor` must notify when their input is changed through `IReusableEditor.setInput(IEditorInput)`.

Specified by:
  `getSaveables` in interface `ISaveablesSource`
Overrides:
  `getSaveables` in class `CommonNavigator`
Returns:
  the saveables presented by the workbench part
See Also:
  - `ISaveablesLifecycleListener`

### getActiveSaveables

public Saveable[] getActiveSaveables()
Description copied from interface: `ISaveablesSource`
Returns the saveables currently active in the workbench part.

Certain workbench actions, such as Save, target only the active saveables in the active part. For example, the active saveables could be determined based on the current selection in the part.

Specified by:
  `getActiveSaveables` in interface `ISaveablesSource`
Overrides:
  `getActiveSaveables` in class `CommonNavigator`
Returns:
  the saveables currently active in the workbench part

### isDirtyStateSupported

public boolean isDirtyStateSupported()
Description copied from interface: `ISecondarySaveableSource`
Whether the dirty state changes should be supported by the framework if the part directly implements `ISecondarySaveableSource`.

If the part providing the adapter is not implementing `ISecondarySaveableSource`, return value defines the default behavior of "secondary" parts connected to this part.

Specified by:
  `isDirtyStateSupported` in interface `ISecondarySaveableSource`
Returns:
  default implementation returns `false`

### initListeners

protected void initListeners(TreeViewer viewer)
Description copied from class: `CommonNavigator`

Adds the listeners to the Common Viewer.

Overrides:
  `initListeners` in class `CommonNavigator`
Parameters:
  `viewer` - The viewer