com.aptana.ide.core.ui.views.fileexplorer
Class FileExplorerView

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.ui.part.WorkbenchPart
          extended by org.eclipse.ui.part.ViewPart
              extended by com.aptana.ide.core.ui.views.fileexplorer.FileExplorerView
All Implemented Interfaces:
ISyncManagerChangeListener, IRefreshableView, org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.ui.IPersistable, org.eclipse.ui.IViewPart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.ui.IWorkbenchPart3, org.eclipse.ui.part.IWorkbenchPartOrientation

public class FileExplorerView
extends org.eclipse.ui.part.ViewPart
implements ISyncManagerChangeListener, IRefreshableView

This sample class demonstrates how to plug-in a new workbench view. The view shows data obtained from the model. The sample creates a dummy model on the fly, but a real implementation would connect to the model available either in this or another plug-in (e.g. the workspace). The view is connected to the model using a content provider.

The view uses a label provider to define how model objects should be presented in the view. Each view can present the same model objects using different labels and icons, if needed. Alternatively, a single label provider can be shared between views in order to ensure that objects of the same type are presented in the same way everywhere.


Nested Class Summary
protected  class FileExplorerView.NewButtonAction
           
 class FileExplorerView.NewWizardMenu
          A NewWizardMenu augments BaseNewWizardMenu with IDE-specific actions: New Project...
 
Field Summary
static java.lang.String ID
          ID
static java.lang.String lastSelected
          lastSelected
static int secondaryIdCounter
          secondaryIdCounter
protected  boolean showLocalEndpoints
          showLocalEndpoints
 
Fields inherited from interface com.aptana.ide.core.io.sync.ISyncManagerChangeListener
ADD, DELETE, EDIT
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
FileExplorerView()
          The constructor.
 
Method Summary
 void createPartControl(org.eclipse.swt.widgets.Composite parent)
          This is a callback that will allow us to create the viewer and initialize it.
protected  org.eclipse.jface.viewers.TreeViewer createViewer(org.eclipse.swt.widgets.Composite parent)
          Creates the viewer.
 void dispose()
           
 org.eclipse.swt.widgets.TreeItem findTreeItem(org.eclipse.swt.widgets.TreeItem[] treeItems, java.lang.Object dataToFind)
          Find the action set for the given name
protected  java.lang.String getStatusLineMessage(org.eclipse.jface.viewers.IStructuredSelection selection)
          Returns the message to show in the status line.
 org.eclipse.jface.viewers.TreeViewer getViewer()
           
 IVirtualFile[] getVirtualFilesProtected(IVirtualFile source)
          getVirtualFilesProtected
protected  void handleDrop(org.eclipse.swt.dnd.DropTargetEvent event)
          handleDrop
protected  void handleKeyPressed(org.eclipse.swt.events.KeyEvent event)
          Handles a key press event from the viewer.
protected  void handleKeyReleased(org.eclipse.swt.events.KeyEvent event)
          Handles a key release in the viewer.
protected  void handleSelectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
          Handles a selection changed event from the viewer.
 void init(org.eclipse.ui.IViewSite site, org.eclipse.ui.IMemento memento)
           
protected  void initLabelProvider(org.eclipse.jface.viewers.TreeViewer viewer)
          initLabelProvider
protected  void initListeners(org.eclipse.jface.viewers.TreeViewer viewer)
          Adds the listeners to the viewer.
 void openFileInEditor(IVirtualFile file)
          openFileInEditor
 void refresh()
          Deprecated. (use refresh with passing in an object
 void refresh(java.lang.Object toRefresh)
          refresh
 void saveState(org.eclipse.ui.IMemento memento)
           
 void setFocus()
          Passing the focus request to the viewer's control.
 void setViewer(org.eclipse.jface.viewers.TreeViewer viewer)
           
 void syncManagerEvent(java.lang.Object obj, int actionId)
          syncManagerEvent
protected  void updateActionBars(org.eclipse.jface.viewers.IStructuredSelection selection)
          Updates the action bar actions.
protected  void updateStatusLine(org.eclipse.jface.viewers.IStructuredSelection selection)
          Updates the message shown in the status line.
 
Methods inherited from class org.eclipse.ui.part.ViewPart
checkSite, getViewSite, init, setContentDescription, setInitializationData, setPartName
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, getTitleToolTip, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
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.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

lastSelected

public static java.lang.String lastSelected
lastSelected


secondaryIdCounter

public static int secondaryIdCounter
secondaryIdCounter


ID

public static final java.lang.String ID
ID

See Also:
Constant Field Values

showLocalEndpoints

protected boolean showLocalEndpoints
showLocalEndpoints

Constructor Detail

FileExplorerView

public FileExplorerView()
The constructor.

Method Detail

dispose

public void dispose()
Specified by:
dispose in interface org.eclipse.ui.IWorkbenchPart
Overrides:
dispose in class org.eclipse.ui.part.WorkbenchPart
See Also:
WorkbenchPart.dispose()

syncManagerEvent

public void syncManagerEvent(java.lang.Object obj,
                             int actionId)
syncManagerEvent

Specified by:
syncManagerEvent in interface ISyncManagerChangeListener
Parameters:
obj -
actionId -

createPartControl

public void createPartControl(org.eclipse.swt.widgets.Composite parent)
This is a callback that will allow us to create the viewer and initialize it.

Specified by:
createPartControl in interface org.eclipse.ui.IWorkbenchPart
Specified by:
createPartControl in class org.eclipse.ui.part.WorkbenchPart
Parameters:
parent -

createViewer

protected org.eclipse.jface.viewers.TreeViewer createViewer(org.eclipse.swt.widgets.Composite parent)
Creates the viewer.

Parameters:
parent - the parent composite
Returns:
TreeViewer
Since:
2.0

initLabelProvider

protected void initLabelProvider(org.eclipse.jface.viewers.TreeViewer viewer)
initLabelProvider

Parameters:
viewer -

initListeners

protected void initListeners(org.eclipse.jface.viewers.TreeViewer viewer)
Adds the listeners to the viewer.

Parameters:
viewer - the viewer
Since:
2.0

handleKeyPressed

protected void handleKeyPressed(org.eclipse.swt.events.KeyEvent event)
Handles a key press event from the viewer. Delegates to the action group.

Parameters:
event - the key event
Since:
2.0

handleSelectionChanged

protected void handleSelectionChanged(org.eclipse.jface.viewers.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

updateActionBars

protected void updateActionBars(org.eclipse.jface.viewers.IStructuredSelection selection)
Updates the action bar actions.

Parameters:
selection - the current selection
Since:
2.0

updateStatusLine

protected void updateStatusLine(org.eclipse.jface.viewers.IStructuredSelection selection)
Updates the message shown in the status line.

Parameters:
selection - the current selection

getStatusLineMessage

protected java.lang.String getStatusLineMessage(org.eclipse.jface.viewers.IStructuredSelection selection)
Returns the message to show in the status line.

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

handleKeyReleased

protected void handleKeyReleased(org.eclipse.swt.events.KeyEvent event)
Handles a key release in the viewer. Does nothing by default.

Parameters:
event - the key event
Since:
2.0

handleDrop

protected void handleDrop(org.eclipse.swt.dnd.DropTargetEvent event)
handleDrop

Parameters:
event -

getVirtualFilesProtected

public IVirtualFile[] getVirtualFilesProtected(IVirtualFile source)
                                        throws java.io.IOException
getVirtualFilesProtected

Parameters:
source -
Returns:
IVirtualFile[]
Throws:
java.io.IOException

refresh

public void refresh()
Deprecated. (use refresh with passing in an object

refresh

Specified by:
refresh in interface IRefreshableView

refresh

public void refresh(java.lang.Object toRefresh)
refresh

Parameters:
toRefresh -

openFileInEditor

public void openFileInEditor(IVirtualFile file)
openFileInEditor

Parameters:
file -

setFocus

public void setFocus()
Passing the focus request to the viewer's control.

Specified by:
setFocus in interface org.eclipse.ui.IWorkbenchPart
Specified by:
setFocus in class org.eclipse.ui.part.WorkbenchPart

init

public void init(org.eclipse.ui.IViewSite site,
                 org.eclipse.ui.IMemento memento)
          throws org.eclipse.ui.PartInitException
Specified by:
init in interface org.eclipse.ui.IViewPart
Overrides:
init in class org.eclipse.ui.part.ViewPart
Throws:
org.eclipse.ui.PartInitException
See Also:
IViewPart.init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)

saveState

public void saveState(org.eclipse.ui.IMemento memento)
Specified by:
saveState in interface org.eclipse.ui.IPersistable
Specified by:
saveState in interface org.eclipse.ui.IViewPart
Overrides:
saveState in class org.eclipse.ui.part.ViewPart
See Also:
IPersistable.saveState(org.eclipse.ui.IMemento)

getViewer

public org.eclipse.jface.viewers.TreeViewer getViewer()
Returns:
Returns the viewer.

setViewer

public void setViewer(org.eclipse.jface.viewers.TreeViewer viewer)
Parameters:
viewer - The viewer to set.

findTreeItem

public org.eclipse.swt.widgets.TreeItem findTreeItem(org.eclipse.swt.widgets.TreeItem[] treeItems,
                                                     java.lang.Object dataToFind)
Find the action set for the given name

Parameters:
treeItems -
dataToFind -
Returns:
Returns the matching action set or null;