Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

javax.ide.editor
Class EditorManager

java.lang.Object
  extended by javax.ide.Service
      extended by javax.ide.editor.EditorManager

public abstract class EditorManager
extends Service

The EditorManager manages the life cycle of Editors. It is also the registry of information about what editors can be used with particular documents.

Clients use this class to open an editor on a Document. When clients request to open an editor on a specific document, the editor manager performs the following tasks:

Similarly, the editor manager closeEditor(javax.ide.editor.Editor) method should be called by clients to request closing an editor. When closing an editor the editor manager performs the following tasks:

Extensions that need to know when editors are opened, closed, activated, and/or deactivated can add EditorListeners to the editor manager. Listener implementations are declared in the editor-listener section of the extension manifest.

IDE service providers must provide a concrete implementation of this class.


Constructor Summary
EditorManager()
           
 
Method Summary
 void addEditorListener(EditorListener listener, java.lang.String editorClass)
          Add an EditorListener.
abstract  void closeEditor(Editor editor)
          Close the specified Editor.
protected  void fireEditorActivated(Editor editor)
          Notifies all editor listeners that the specified editor was activated.
protected  void fireEditorClosed(Editor editor)
          Notifies all editor listeners that the specified editor was closed.
protected  void fireEditorDeactivated(Editor editor)
          Notifies all editor listeners that the specified editor was deactivated.
protected  void fireEditorOpened(Editor editor)
          Notifies all editor listeners that the specified editor was opened.
abstract  Editor getActiveEditor()
          Returns the Editor that is currently active.
abstract  java.util.Set getAllOpenEditors()
          Returns all currently open editors.
static EditorManager getEditorManager()
          Get the editor manager implementation for this IDE.
 java.util.Set getOpenEditors(Document document)
          Get all open editors on a specific document.
 boolean isOpen(Document document)
          Get whether the specified document is open.
abstract  Editor openEditor(Context context, java.lang.String typeID)
          Opens a document in the editor identified by the given editor type identifier.
 void removeEditorListener(EditorListener l, java.lang.String editorClass)
          Remove an EditorListener.
 
Methods inherited from class javax.ide.Service
getService, initialize, resetAllServices
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EditorManager

public EditorManager()
Method Detail

getActiveEditor

public abstract Editor getActiveEditor()
Returns the Editor that is currently active.

Returns:
the currently active editor, or null if no editor is currently active.

getAllOpenEditors

public abstract java.util.Set getAllOpenEditors()
Returns all currently open editors.

Returns:
a set of Editor instances for all currently open editors. Must not return null, may return an empty collection. The collection is immutable.

isOpen

public boolean isOpen(Document document)
Get whether the specified document is open.

Parameters:
document - a document. Must not be null.
Returns:
true if there is at least one open editor on this document.

getOpenEditors

public java.util.Set getOpenEditors(Document document)
Get all open editors on a specific document.

Parameters:
document - a document instance. Must not be null.
Returns:
an unmodifiable collection of all open editors on the specified document. Must never be null, but may be empty.

openEditor

public abstract Editor openEditor(Context context,
                                  java.lang.String typeID)
Opens a document in the editor identified by the given editor type identifier. If type is null, the IDE will open the document with the most appropriate editor.

If the document is already open using that editor, the editor will be made active.

Parameters:
context - the context to open an editor for. Must not be null.
typeID - the id of an editor type to open the context document in. If null, the IDE will open the document with the default editor.
Returns:
the editor that was opened or activated.
Throws:
java.lang.UnsupportedOperationException - when the document cannot be opened by any editor.

closeEditor

public abstract void closeEditor(Editor editor)
Close the specified Editor.

Parameters:
editor - The editor to be closed. Must not be null.

addEditorListener

public final void addEditorListener(EditorListener listener,
                                    java.lang.String editorClass)
Add an EditorListener.

Parameters:
listener - the EditorListener to add. Must not be null.
editorClass - Only events for this class of editor will be dispatched to the specified listener. May be null, indicating that all editor events will be dispatched.

removeEditorListener

public final void removeEditorListener(EditorListener l,
                                       java.lang.String editorClass)
Remove an EditorListener.

Parameters:
l - The EditorListener to remove.
editorClass - The class of editors from which listener should be removed. May be null, indicating that all editor events will be dispatched.

fireEditorOpened

protected final void fireEditorOpened(Editor editor)
Notifies all editor listeners that the specified editor was opened.

Parameters:
editor - the editor which was opened.

fireEditorClosed

protected final void fireEditorClosed(Editor editor)
Notifies all editor listeners that the specified editor was closed.

Parameters:
editor - the editor which was closed.

fireEditorActivated

protected final void fireEditorActivated(Editor editor)
Notifies all editor listeners that the specified editor was activated.

Parameters:
editor - the editor which was activated.

fireEditorDeactivated

protected final void fireEditorDeactivated(Editor editor)
Notifies all editor listeners that the specified editor was deactivated.

Parameters:
editor - the editor which was deactivated.

getEditorManager

public static EditorManager getEditorManager()
Get the editor manager implementation for this IDE.

Returns:
the editor manager implementation.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

Copyright © 1997, 2009, Oracle. All rights reserved.