Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.port80.eclipse.jdt.annotation
Class AnnotationView  view AnnotationView download AnnotationView.java

java.lang.Object
  extended byorg.eclipse.ui.part.WorkbenchPart
      extended byorg.eclipse.ui.part.ViewPart
          extended bycom.port80.eclipse.jdt.annotation.AnnotationView
All Implemented Interfaces:
java.util.EventListener, org.eclipse.core.runtime.IAdaptable, IAnnotationModelListener, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.jface.util.IPropertyChangeListener, org.eclipse.ui.IViewPart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.swt.events.KeyListener, org.eclipse.swt.internal.SWTEventListener

public class AnnotationView
extends org.eclipse.ui.part.ViewPart
implements org.eclipse.swt.events.KeyListener, IAnnotationModelListener, org.eclipse.jface.util.IPropertyChangeListener

A TreeViewer that shows content of the AnnotationModel. The View provides various filter and sorting functions for inspecting and searching in the Annotation. The Annotation machanism automatically maintain the set of IResource/IJavaElement visited in various way with access information. The Annotation can be used for backtracing to previous location and for annotation.


Field Summary
private static int ACTION_KEYMASK
           
private static boolean DEBUG
           
private static int DELETE_ACTION_KEYCHAR
           
private  org.eclipse.jface.action.Action fActionAbout
           
private  org.eclipse.jface.action.Action fActionAdd
           
private  org.eclipse.jface.action.Action fActionClipboard
           
private  org.eclipse.jface.action.Action fActionCopy
           
private  org.eclipse.jface.action.Action fActionDelete
           
private  org.eclipse.jface.action.Action fActionEdit
           
private  org.eclipse.jface.action.Action fActionHeader
           
private  org.eclipse.jface.action.Action fActionMove
           
private  org.eclipse.jface.action.Action fActionResolve
           
private  org.eclipse.jface.action.Action fActionSetInbox
           
private  org.eclipse.jface.action.Action fActionSort
           
private  AnnotationManager fAnnotationManager
           
private  java.lang.String fDefaultFolderName
           
private  com.port80.eclipse.util.IncrementalFindTreeTarget fFindTarget
          Current folder.
private static int FIND_BACKWARD_KEYCHAR
           
private static int FIND_FORWARD_KEYCHAR
           
private static int FIND_KEYMASK
           
private  org.eclipse.ui.IPartListener fPartListener
           
private  java.lang.String fSortKey
           
private  org.eclipse.jface.viewers.TreeViewer fViewer
           
static java.lang.String ID
           
private static java.lang.String NAME
           
private static boolean TRACE
           
private static java.lang.String VERSION
           
 
Fields inherited from class org.eclipse.ui.part.ViewPart
 
Fields inherited from class org.eclipse.ui.part.WorkbenchPart
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
AnnotationView()
          The constructor.
 
Method Summary
(package private)  void addAction()
           
 void addAnnotation(java.lang.Object a)
          Add and edit annotation on a object.
private  void addFromEditor(org.eclipse.ui.IEditorPart editor, java.lang.String folder)
           
 void beginSession(boolean forward)
           
(package private)  void clipboardAction()
           
private  void contributeToActionBars()
           
(package private)  void copyAction()
           
 void createPartControl(org.eclipse.swt.widgets.Composite parent)
          This is a callback that will allow us to create the viewer and initialize it.
(package private)  void deleteAction()
           
 void dispose()
          Disposes of this workbench part.
(package private)  void editAction()
           
 java.lang.String editAnnotation(com.port80.eclipse.jdt.util.PersistentItem item)
          Popup a dialog to edit the given item's annotation.
(package private)  void editorActivation(org.eclipse.ui.IWorkbenchPart part)
          Select the IResources for the activated editor if it exists in the AnnotationModel.
(package private)  void fillContextMenu(org.eclipse.jface.action.IMenuManager manager)
           
private  void fillLocalPullDown(org.eclipse.jface.action.IMenuManager manager)
           
private  void fillLocalToolBar(org.eclipse.jface.action.IToolBarManager manager)
           
private  java.lang.String getSelectedItemText()
           
private  org.eclipse.jface.viewers.IStructuredSelection getSelection()
           
 java.lang.String getSortKey()
           
 java.lang.String[] getSortKeys()
           
 org.eclipse.jface.viewers.TreeViewer getViewer()
           
 void handleSelectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent e)
          Update status message on viewer selection changes.
private  void hookContextMenu()
           
private  void hookDoubleClickAction()
           
private  void hookKeyListener()
          Temporary hack to do the incremental search.
private  void hookPartListener()
          Listen to any part activation and update the method view if an editor part is activated.
 void init(org.eclipse.ui.IViewSite site, org.eclipse.ui.IMemento memento)
          Initializes this view with the given view site.
 void keyPressed(org.eclipse.swt.events.KeyEvent event)
          Sent when a key is pressed on the system keyboard.
 void keyReleased(org.eclipse.swt.events.KeyEvent event)
          Sent when a key is released on the system keyboard.
private  void makeActions()
           
(package private)  void moveAction()
           
private  java.lang.String promptForFolder()
           
 void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event)
          Notification that a property has changed.
 void refresh()
           
 void refresh(com.port80.eclipse.jdt.util.PersistentItem item)
           
(package private)  void resolveAction()
           
private  void resolveAction(java.lang.Object a, java.util.List ret)
           
 void saveState(org.eclipse.ui.IMemento memento)
          Saves the object state within a memento.
 void setFocus()
          Passing the focus request to the viewer's control.
private  void setInbox(java.lang.String name)
           
(package private)  void setInboxAction()
           
 void setSelection(org.eclipse.jface.viewers.ISelection selection, boolean reveal)
           
 void setSortKey(java.lang.String key)
           
(package private)  void showInEditorAction()
           
(package private)  void showMessage(java.lang.String message)
           
 
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, getAdapter, 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.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

ID

public static final java.lang.String ID
See Also:
Constant Field Values

NAME

private static final java.lang.String NAME
See Also:
Constant Field Values

VERSION

private static final java.lang.String VERSION
See Also:
Constant Field Values

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

TRACE

private static final boolean TRACE
See Also:
Constant Field Values

FIND_KEYMASK

private static final int FIND_KEYMASK
See Also:
Constant Field Values

FIND_FORWARD_KEYCHAR

private static final int FIND_FORWARD_KEYCHAR
See Also:
Constant Field Values

FIND_BACKWARD_KEYCHAR

private static final int FIND_BACKWARD_KEYCHAR
See Also:
Constant Field Values

ACTION_KEYMASK

private static final int ACTION_KEYMASK
See Also:
Constant Field Values

DELETE_ACTION_KEYCHAR

private static final int DELETE_ACTION_KEYCHAR
See Also:
Constant Field Values

fViewer

private org.eclipse.jface.viewers.TreeViewer fViewer

fAnnotationManager

private AnnotationManager fAnnotationManager

fSortKey

private java.lang.String fSortKey

fDefaultFolderName

private java.lang.String fDefaultFolderName

fFindTarget

private com.port80.eclipse.util.IncrementalFindTreeTarget fFindTarget
Current folder.


fActionHeader

private org.eclipse.jface.action.Action fActionHeader

fActionEdit

private org.eclipse.jface.action.Action fActionEdit

fActionClipboard

private org.eclipse.jface.action.Action fActionClipboard

fActionAdd

private org.eclipse.jface.action.Action fActionAdd

fActionCopy

private org.eclipse.jface.action.Action fActionCopy

fActionMove

private org.eclipse.jface.action.Action fActionMove

fActionDelete

private org.eclipse.jface.action.Action fActionDelete

fActionSort

private org.eclipse.jface.action.Action fActionSort

fActionResolve

private org.eclipse.jface.action.Action fActionResolve

fActionSetInbox

private org.eclipse.jface.action.Action fActionSetInbox

fActionAbout

private org.eclipse.jface.action.Action fActionAbout

fPartListener

private org.eclipse.ui.IPartListener fPartListener
Constructor Detail

AnnotationView

public AnnotationView()
The constructor.

Method Detail

init

public void init(org.eclipse.ui.IViewSite site,
                 org.eclipse.ui.IMemento memento)
          throws org.eclipse.ui.PartInitException
Description copied from interface: org.eclipse.ui.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 org.eclipse.ui.IViewPart

dispose

public void dispose()
Description copied from interface: org.eclipse.ui.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 org.eclipse.ui.IWorkbenchPart

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

propertyChange

public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event)
Description copied from interface: org.eclipse.jface.util.IPropertyChangeListener
Notification that a property has changed.

This method gets called when the observed object fires a property change event.

Specified by:
propertyChange in interface org.eclipse.jface.util.IPropertyChangeListener

hookPartListener

private void hookPartListener()
Listen to any part activation and update the method view if an editor part is activated.


editorActivation

void editorActivation(org.eclipse.ui.IWorkbenchPart part)
Select the IResources for the activated editor if it exists in the AnnotationModel. Otherwise, do nothing. //FIXME: For now, this only works for IJavaElement.


saveState

public void saveState(org.eclipse.ui.IMemento memento)
Description copied from interface: org.eclipse.ui.IViewPart
Saves the object state within a memento.

Specified by:
saveState in interface org.eclipse.ui.IViewPart

getViewer

public org.eclipse.jface.viewers.TreeViewer getViewer()

addAnnotation

public void addAnnotation(java.lang.Object a)
Add and edit annotation on a object. If user cancel editing, item is not added and if item already exists, it is not modified.


editAnnotation

public java.lang.String editAnnotation(com.port80.eclipse.jdt.util.PersistentItem item)
Popup a dialog to edit the given item's annotation.


setFocus

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

Specified by:
setFocus in interface org.eclipse.ui.IWorkbenchPart

setSortKey

public void setSortKey(java.lang.String key)

getSortKey

public java.lang.String getSortKey()

getSortKeys

public java.lang.String[] getSortKeys()

refresh

public void refresh()
Specified by:
refresh in interface IAnnotationModelListener

refresh

public void refresh(com.port80.eclipse.jdt.util.PersistentItem item)
Specified by:
refresh in interface IAnnotationModelListener

setSelection

public void setSelection(org.eclipse.jface.viewers.ISelection selection,
                         boolean reveal)
Specified by:
setSelection in interface IAnnotationModelListener

handleSelectionChanged

public void handleSelectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent e)
Update status message on viewer selection changes. This can also be used to execute action on single click selection.


keyPressed

public void keyPressed(org.eclipse.swt.events.KeyEvent event)
Description copied from interface: org.eclipse.swt.events.KeyListener
Sent when a key is pressed on the system keyboard.

Specified by:
keyPressed in interface org.eclipse.swt.events.KeyListener

keyReleased

public void keyReleased(org.eclipse.swt.events.KeyEvent event)
Description copied from interface: org.eclipse.swt.events.KeyListener
Sent when a key is released on the system keyboard.

Specified by:
keyReleased in interface org.eclipse.swt.events.KeyListener

beginSession

public void beginSession(boolean forward)

makeActions

private void makeActions()

contributeToActionBars

private void contributeToActionBars()

fillLocalPullDown

private void fillLocalPullDown(org.eclipse.jface.action.IMenuManager manager)

fillLocalToolBar

private void fillLocalToolBar(org.eclipse.jface.action.IToolBarManager manager)

hookContextMenu

private void hookContextMenu()

fillContextMenu

void fillContextMenu(org.eclipse.jface.action.IMenuManager manager)

hookDoubleClickAction

private void hookDoubleClickAction()

hookKeyListener

private void hookKeyListener()
Temporary hack to do the incremental search. Should move to StructuredViewer later.


showMessage

void showMessage(java.lang.String message)

clipboardAction

void clipboardAction()

addAction

void addAction()

addFromEditor

private void addFromEditor(org.eclipse.ui.IEditorPart editor,
                           java.lang.String folder)

copyAction

void copyAction()

moveAction

void moveAction()

promptForFolder

private java.lang.String promptForFolder()

deleteAction

void deleteAction()

editAction

void editAction()

resolveAction

void resolveAction()

setInboxAction

void setInboxAction()

setInbox

private void setInbox(java.lang.String name)

resolveAction

private void resolveAction(java.lang.Object a,
                           java.util.List ret)

showInEditorAction

void showInEditorAction()

getSelection

private org.eclipse.jface.viewers.IStructuredSelection getSelection()

getSelectedItemText

private java.lang.String getSelectedItemText()