Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


oracle.ide.editor
Class EditorManager

java.lang.Object
  extended by oracle.ide.editor.EditorManager

All Implemented Interfaces:
Addin, Controller

public abstract class EditorManager
extends java.lang.Object
implements Controller, Addin

The EditorManager serves as the registry for Editor that want to register themselves with specific Node types.


Field Summary
static int SHOW_DROPDOWN_CMD_ID
          The show dropdown command.

 

Fields inherited from interface oracle.ide.controller.Controller
UPDATE_FROM_ACTION_PERFORMED, UPDATE_FROM_ACTIVE_VIEW_CHANGED, UPDATE_FROM_UNDO, UPDATE_FROM_USER_EXTENSION, UPDATE_FROM_VIEW_SELECTION_CHANGED

 

Constructor Summary
EditorManager()
           

 

Method Summary
abstract  void activateCurrentEditorFrame()
          Activates the top-most editor frame and editor within it.
abstract  void activateEditor(EditorInfo editorInfo)
          Activates the editor corresponding to the editorInfo.
abstract  void addEditorListener(EditorListener listener)
          Adds a registered listener as an EditorListener.
abstract  void addLayoutListener(java.lang.String editorId, BaseLayoutListener listener)
          Add a LayoutListener for one of our child Editor instances
abstract  void closeEditors(java.util.List listEditors)
          Close the editors contained in the list.
abstract  void extend(EditorAddin addin, java.lang.Class[] types)
          Associate the Element types supported given with the given EditorAddin.
abstract  java.util.List<Editor> findEditors(Context context)
           
abstract  java.util.List<Editor> getAllEditors()
          Returns a list of all open Editor.
abstract  EditorAddin getBestEditorAddin(Context context)
           
abstract  EditorAddin getBestEditorAddin(Node node)
          Retrieves the best EditorAddin based on the default editor preference for the Node, or by querying the editor addin registry.
abstract  ContextMenu getContextMenu()
          Get the ContextMenu to be shared by all Editors.
abstract  Editor getCurrentEditor()
          Returns the currently active editor.
abstract  EditorAddin getDefaultAddin(Context context)
           
abstract  EditorAddin getDefaultAddin(Element element)
          Gets the default registered EditorAddin for the element.
abstract  javax.swing.JComponent getDesktopComponent()
           
abstract  EditorAddin getEditorAddin(java.lang.Class cls)
          Get the EditorAddin instance which represents the Editor type provided.
static EditorManager getEditorManager()
          Returns the EditorManager instance that is active in the IDE.
abstract  java.util.List<EditorInfo> getEditorsInfo()
           
abstract  EditorAddin[] getStaticAddins(java.lang.Class elementClass)
          Deprecated. replaced by getStaticAddins(String).
abstract  EditorAddin[] getStaticAddins(java.lang.String elementClassName)
          Gets all the statically registered EditorAddins which are associated with the given Element class.
abstract  java.lang.String[] getStaticElementClassNames()
          Gets all the Element types which are associated with statically registered EditorAddins, excluding inherited EditorAddin associations.
abstract  java.lang.Class[] getStaticElementTypes()
          Deprecated. replaced by getStaticElementClassNames().
 boolean hasEditors(Element element)
          Returns true if there are any registered editors for the specified element.
abstract  void initialize()
          Invoked by the AddinManager after the instance of the Addin is instantiated.
abstract  boolean isEditorRegistered(java.lang.Class cls)
          Determine whether an Editor implementation has been registered.
abstract  Editor openDefaultEditorInFrame(Context context)
          The new openEditor(oracle.ide.editor.OpenEditorOptions) is now the preferred way to open an editor.
 Editor openDefaultEditorInFrame(java.net.URL url)
          Open the specified URL using the default editor.
abstract  Editor openEditor(OpenEditorOptions openEditorOptions)
          Opens an editor.
abstract  Editor openEditorInFrame(java.lang.Class editorClass, Context context)
          The new openEditor(oracle.ide.editor.OpenEditorOptions) is now the preferred way to open an editor.
abstract  void register(EditorAddin addin, java.lang.Class[] types)
          Registers a EditorAddin for inclusion the editor tabs for the given Node types.
abstract  void registerDynamic(EditorAddin editorAddin)
          Registers a EditorAddin for possible inclusion the editor tabs.
abstract  void registerPreferredLayoutListener(java.lang.Class nodeClass, java.lang.Class editorClass, java.lang.String preferredLayoutBaseName, PreferredLayoutListener listener)
          Register a PreferredLayoutListener for the specified nodeClass.
abstract  void removeEditorListener(EditorListener listener)
          Removes a registered listener as an EditorListener.
abstract  void removeLayoutListener(java.lang.String editorId)
          Remove the LayoutListener for one of our child Editor instances
abstract  void replaceEditors(Context oldContext, Context newContext)
           
abstract  EditorPath searchEditor(Node node)
           
static void setEditorManager(EditorManager editorManager)
          Publishes the specified EditorManager as the active instance in the IDE.
abstract  void setExplicit(Editor editor, boolean bExplicit)
          Set the editor as explicit or implicit.
abstract  void unregister(EditorAddin editorAddin)
          Removes the specified editorAddin from the list on known EditorAddins.
abstract  void unregisterDynamic(EditorAddin editorAddin)
          Removes the specificed editor addin from the list of dynamically registered addins.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Methods inherited from interface oracle.ide.controller.Controller
handleEvent, update

 

Field Detail

SHOW_DROPDOWN_CMD_ID

public static final int SHOW_DROPDOWN_CMD_ID
The show dropdown command.
Since:
11.1.1

Constructor Detail

EditorManager

public EditorManager()

Method Detail

getEditorManager

public static EditorManager getEditorManager()
Returns the EditorManager instance that is active in the IDE.

setEditorManager

public static void setEditorManager(EditorManager editorManager)
Publishes the specified EditorManager as the active instance in the IDE.

register

public abstract void register(EditorAddin addin,
                              java.lang.Class[] types)
Registers a EditorAddin for inclusion the editor tabs for the given Node types. The types array should contain the Class objects for each known Node type supported by the Editor represented by the EditorAddin being registered. If multiple Node types all extend a common class, only the Class object for that common class need be included in the Class array as retrievals will be attempted all the way up a given Node's inheritance path until a match can be found or the search fails.
Parameters:
addin - the EditorAddin to register
types - the Node classes supported by the addin being registered

unregister

public abstract void unregister(EditorAddin editorAddin)
Removes the specified editorAddin from the list on known EditorAddins. Removing an addin does not affect the already open editors.
Parameters:
editorAddin -

registerDynamic

public abstract void registerDynamic(EditorAddin editorAddin)
Registers a EditorAddin for possible inclusion the editor tabs. When a FlatEditorAddin is registered with this method, every time a Node is open, EditorAddin.getEditorWeight(oracle.ide.model.Element) is called to determine if and where the editor tab must be placed.

An addin can be registered both statically and dynamically. In that case, the dynamic addins will be queried only if they were not registered for the Node type.

Parameters:
editorAddin - the EditorAddin to register

unregisterDynamic

public abstract void unregisterDynamic(EditorAddin editorAddin)
Removes the specificed editor addin from the list of dynamically registered addins.
Parameters:
editorAddin -

extend

public abstract void extend(EditorAddin addin,
                            java.lang.Class[] types)
Associate the Element types supported given with the given EditorAddin.
Parameters:
addin - The EditorAddin to which the extension has been associated.
types - The Element types being associated with addin.

isEditorRegistered

public abstract boolean isEditorRegistered(java.lang.Class cls)
Determine whether an Editor implementation has been registered.
Parameters:
cls - The Editor class upon which the query is being applied.

getEditorAddin

public abstract EditorAddin getEditorAddin(java.lang.Class cls)
Get the EditorAddin instance which represents the Editor type provided. If more than one EditorAddin has been registered for the same Editor class, the first one found will be returned.
Parameters:
cls - the Editor class for which an EditorAddin is desired.

getBestEditorAddin

public abstract EditorAddin getBestEditorAddin(Node node)
Retrieves the best EditorAddin based on the default editor preference for the Node, or by querying the editor addin registry.
Parameters:
node - the current Node
Returns:
the best EditorAddin for the given Node.

getBestEditorAddin

public abstract EditorAddin getBestEditorAddin(Context context)

getDefaultAddin

public abstract EditorAddin getDefaultAddin(Element element)
Gets the default registered EditorAddin for the element. In general, the default is the last one registered as being default, else the first one registered for that Element type.
Parameters:
element - the element for which a default is desired.
Returns:
the default EditorAddin for the given Element.

getDefaultAddin

public abstract EditorAddin getDefaultAddin(Context context)

getStaticAddins

@Deprecated
public abstract EditorAddin[] getStaticAddins(java.lang.Class elementClass)
Deprecated. replaced by getStaticAddins(String).
Gets all the statically registered EditorAddins which are associated with the given Element class.
Parameters:
elementClass - the class of the Element.
Returns:
the array of statically registered, associated EditorAddins.

getStaticAddins

public abstract EditorAddin[] getStaticAddins(java.lang.String elementClassName)
Gets all the statically registered EditorAddins which are associated with the given Element class.
Parameters:
elementClassName - the classname of the Element. Note that the given classname is used to identify the element type and will never be used to load or instantiate this class.
Returns:
the array of statically registered, associated EditorAddins.

getStaticElementTypes

@Deprecated
public abstract java.lang.Class[] getStaticElementTypes()
Deprecated. replaced by getStaticElementClassNames().
Gets all the Element types which are associated with statically registered EditorAddins, excluding inherited EditorAddin associations.
Returns:
the array of Element classes.

getStaticElementClassNames

public abstract java.lang.String[] getStaticElementClassNames()
Gets all the Element types which are associated with statically registered EditorAddins, excluding inherited EditorAddin associations.
Returns:
the array of Element class names. Note that the returned classname can be used to identify the element type but should never be used to load or instantiate those classes.

addEditorListener

public abstract void addEditorListener(EditorListener listener)
Adds a registered listener as an EditorListener.
Parameters:
listener - the listener to register

removeEditorListener

public abstract void removeEditorListener(EditorListener listener)
Removes a registered listener as an EditorListener.
Parameters:
listener - the listener to de-register

activateCurrentEditorFrame

public abstract void activateCurrentEditorFrame()
Activates the top-most editor frame and editor within it. It is up to the editor to do what it needs to in order to request focus - for example, the code editor calls requestFocus() on activate().

openDefaultEditorInFrame

public Editor openDefaultEditorInFrame(java.net.URL url)
Open the specified URL using the default editor. This will create a node for the file, and from that node, we can figure out what kind of editor we can open. This lets the NodeFactory take care of recognizing the file type.
Parameters:
url - the URL of the file to open
Returns:
the Editor instance that was opened

openDefaultEditorInFrame

public abstract Editor openDefaultEditorInFrame(Context context)
The new openEditor(oracle.ide.editor.OpenEditorOptions) is now the preferred way to open an editor. Replace
   Editor editor = editorManager.openDefaultEditorInFrame(ctx);
 
with
   Editor editor = editorManager.openEditor(new OpenEditorOptions(ctx));
 
Opens the specified file (context) using the default registered editor class for this node type. If the file is already open in another editor, this will just activate the current editor.
Parameters:
context - the context describing the node to open
Returns:
the opened Editor instance
See Also:
openEditorInFrame( Class, Context )

openEditorInFrame

public abstract Editor openEditorInFrame(java.lang.Class editorClass,
                                         Context context)
The new openEditor(oracle.ide.editor.OpenEditorOptions) is now the preferred way to open an editor. Replace
   Editor editor = editorManager.openEditorInFrame(cls, ctx);
 
with
   Editor editor = editorManager.openEditor(new OpenEditorOptions(ctx, cls));
 
Opens the specified file (context) using the specified editor class (editorClass.) The new editor frame will be opened in the active editor tabbed frame (if one exists.) If there is no active editor desktop, or editor tabbed frame, one will be created automatically. If the editorClass does not correspond to any of the editorAddins declared for that context, the default editor will be used.
Parameters:
editorClass - the editor class to use for opening the node
context - the context describing the node to oen
Returns:
the Editor that was opened

openEditor

public abstract Editor openEditor(OpenEditorOptions openEditorOptions)
Opens an editor. This method is preferred over the different openDefaultEditorInFrame(java.net.URL) and #openEditorInFrame(java.lang.Class, oracle.ide.addin.Context) variants which will eventually be deprecated
Parameters:
openEditorOptions -
Returns:

replaceEditors

public abstract void replaceEditors(Context oldContext,
                                    Context newContext)

findEditors

public abstract java.util.List<Editor> findEditors(Context context)

getAllEditors

public abstract java.util.List<Editor> getAllEditors()
Returns a list of all open Editor.

getDesktopComponent

public abstract javax.swing.JComponent getDesktopComponent()
Returns:
the top level JComponent that makes the editor windowing desktop

getCurrentEditor

public abstract Editor getCurrentEditor()
Returns the currently active editor.

initialize

public abstract void initialize()
Description copied from interface: Addin
Invoked by the AddinManager after the instance of the Addin is instantiated. When invoked, The Addin should register and menu items, and actions required for use during this classes lifecycle. Addin authors should take care to ensure that any extraneous initialization is not preformed on this method, and any startup code that can be delayed until a later time is delayed, as the Addin's are synchronously initialized during the startup of the IDE, and each Addin has the potential to negatively impact the startup time of the product.
Specified by:
initialize in interface Addin
See Also:
AddinManager

addLayoutListener

public abstract void addLayoutListener(java.lang.String editorId,
                                       BaseLayoutListener listener)
Add a LayoutListener for one of our child Editor instances
Parameters:
editorId - the id of the editor
listener - the LayoutListener instance

removeLayoutListener

public abstract void removeLayoutListener(java.lang.String editorId)
Remove the LayoutListener for one of our child Editor instances
Parameters:
editorId - the id of the editor

getContextMenu

public abstract ContextMenu getContextMenu()
Get the ContextMenu to be shared by all Editors.

closeEditors

public abstract void closeEditors(java.util.List listEditors)
Close the editors contained in the list.
Parameters:
listEditors - a List of Editor or EditorInfo.

getEditorsInfo

public abstract java.util.List<EditorInfo> getEditorsInfo()
Returns:
a List of EditorInfo.

activateEditor

public abstract void activateEditor(EditorInfo editorInfo)
Activates the editor corresponding to the editorInfo.

setExplicit

public abstract void setExplicit(Editor editor,
                                 boolean bExplicit)
Set the editor as explicit or implicit.

Note that the explicit/implicit behavior changed. The user now explicitely assigns accelerators to a Node and the "Close Implicit" command changed to only close the files that have no accelerator. This method will probably be deprecated soon.


registerPreferredLayoutListener

public abstract void registerPreferredLayoutListener(java.lang.Class nodeClass,
                                                     java.lang.Class editorClass,
                                                     java.lang.String preferredLayoutBaseName,
                                                     PreferredLayoutListener listener)
Register a PreferredLayoutListener for the specified nodeClass. When an editor belonging to a given editorClass opens a Node of type nodeClass the listener will be called. The listener is responsible for initializing the preferred layout. The preferredLayoutBaseName will be used as the name of the layout.

searchEditor

public abstract EditorPath searchEditor(Node node)

hasEditors

public boolean hasEditors(Element element)
Returns true if there are any registered editors for the specified element.
Parameters:
element - an element. Must not be null.
Returns:
true if there are any registered editors for the specified element.
Since:
11.0

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


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