editorListener.handlers
Class EditorListener

java.lang.Object
  extended by java.util.Observable
      extended by editorListener.handlers.EditorListener

public class EditorListener
extends java.util.Observable

This singleton class is part of an extensible observer pattern providing a concrete class for all listening capabilities of this plug-in. Possible functionality to add: - Reporting of all open windows. Note: Eclipse will not allow the same resource to be opened by the same editor in the same workbench multiple times. This does not apply across perspectives or windows in the same instance.

Version:
3/8/2009
Author:
Matthew Harward

Method Summary
 void changeFocus(org.eclipse.jface.text.IDocument doc)
          Method to be called by dispatches when a document is brought into focus.
 void documentClosed(org.eclipse.jface.text.IDocument doc)
          Method to be called by dispatches when a document is closed.
 void documentOpen(org.eclipse.jface.text.IDocument doc)
          Method to be called by dispatches when a document is opened.
static org.eclipse.ui.IWorkbenchPart getActiveJavaEditor()
          Attempts to get the currently the active JavaEditor.
static EditorListener getInstance()
          Singleton instantiation.
 AcceptableFileTypeHandler getTypeHandler()
           
static org.eclipse.ui.IWorkbenchPart getWorkbenchPart(org.eclipse.jface.text.IDocument doc, boolean restore)
          A static method to get the workbench part from a document.
 void setTypeHandler(AcceptableFileTypeHandler typeHandler)
           
 void updateCurrentDocument(org.eclipse.jface.text.IDocument doc)
          Method to be called by dispatches when a document is modified.
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static EditorListener getInstance()
Singleton instantiation.

Returns:
the instance of this class.

documentOpen

public void documentOpen(org.eclipse.jface.text.IDocument doc)
Method to be called by dispatches when a document is opened. Provides an observer notification.

Parameters:
doc - the document

documentClosed

public void documentClosed(org.eclipse.jface.text.IDocument doc)
Method to be called by dispatches when a document is closed.

Parameters:
doc - the document

changeFocus

public void changeFocus(org.eclipse.jface.text.IDocument doc)
Method to be called by dispatches when a document is brought into focus. Provides an observer notification.

Parameters:
doc - the document

updateCurrentDocument

public void updateCurrentDocument(org.eclipse.jface.text.IDocument doc)
Method to be called by dispatches when a document is modified. Provides an observer notification.

Parameters:
doc - the document

getWorkbenchPart

public static org.eclipse.ui.IWorkbenchPart getWorkbenchPart(org.eclipse.jface.text.IDocument doc,
                                                             boolean restore)
A static method to get the workbench part from a document. Attempts a dynamic method first.

Parameters:
doc - the document
Returns:
the workbench part corresponding to the document

getActiveJavaEditor

public static org.eclipse.ui.IWorkbenchPart getActiveJavaEditor()
Attempts to get the currently the active JavaEditor.

Returns:
the workbench part of the editor, if there is one open and visible, else null.

getTypeHandler

public AcceptableFileTypeHandler getTypeHandler()
Returns:
the current file type handler.

setTypeHandler

public void setTypeHandler(AcceptableFileTypeHandler typeHandler)
Parameters:
typeHandler - set the file type handler. This can be used to provide non-Java listening abilities.