Extension SDK 10.1.2

oracle.ide
Class ContextMenu

java.lang.Object
  extended byoracle.ide.AbstractMenuManager
      extended byoracle.ide.ContextMenu
All Implemented Interfaces:
java.awt.event.ContainerListener, java.util.EventListener, javax.swing.event.MenuListener, MenuManager

public class ContextMenu
extends AbstractMenuManager

ContextMenu class. Use this class to menu items to context menus such as the navigator, log window, and/or code editor context menus.


Field Summary
 
Fields inherited from class oracle.ide.AbstractMenuManager
containerListener, menuListener
 
Fields inherited from interface oracle.ide.MenuManager
ALPHA_SORT_SECTION_KEY, LAST_POSITION
 
Constructor Summary
ContextMenu()
          Default constructor.
ContextMenu(MnemonicSolver solver)
          Constructor.
 
Method Summary
 void add(java.awt.Component child)
          Appends a component into the MenuManager's GUI.
 void add(java.awt.Component child, boolean fixed)
          Add the specified child to the end of this context menu.
 void add(java.awt.Component child, float sectionId)
          Add the specified child to the end of this context menu.
 void add(java.awt.Component child, float sectionId, boolean fixed)
          Add the specified child to the end of this context menu.
 void addContextMenuListener(ContextMenuListener l)
          Adds a context menu listener.
 void addContextMenuListener(ContextMenuListener l, java.lang.Class cls)
          Adds a ContextMenuListener that is called when the type of the data represented by the current Context is assignable to a variable whose type is of the specified Class.
 void addSeparator()
          Adds a Menu separator to the context menu.
 boolean fireDefaultAction(Context context)
          Invoke this method to fire the deault action associated with this context menu.
 Context getContext()
          Geth the current context.
 java.awt.Container getGUI(boolean create)
          Creates the actual popup menu.
 int getMenuCount()
          Returns the number of elements in the menu.
 MnemonicSolver getMnemonicSolver()
          Get the menu item mnemonic solver.
 void removeAll()
          Removes all menu items from the popup menu.
 void removeContextMenuListener(ContextMenuListener l)
          Removes a context menu listener.
 void show(Context context)
          Shows the popup menu.
 
Methods inherited from class oracle.ide.AbstractMenuManager
add, add, componentAdded, componentRemoved, createMenu, createMenu, createMenu, createMenu, createMenuItem, createMenuItem, createSubMenu, createSubMenu, createSubMenu, getChildById, getIndexOfChild, getIndexOfCommandId, insert, insert, menuCanceled, menuDeselected, menuSelected, remove, remove, setErrorWeight, sortContainer, sortSectionByName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextMenu

public ContextMenu()
Default constructor.


ContextMenu

public ContextMenu(MnemonicSolver solver)
Constructor.

Parameters:
solver - an instance of the MnemonicSolver class. This instance will be used to resolve mnemonic conflicts between context menu items.
Method Detail

add

public void add(java.awt.Component child)
Description copied from interface: MenuManager
Appends a component into the MenuManager's GUI.

Specified by:
add in interface MenuManager
Overrides:
add in class AbstractMenuManager

add

public void add(java.awt.Component child,
                boolean fixed)
Add the specified child to the end of this context menu.

Parameters:
child - menu item to add.
fixed - indicates that the mnemonics used by the specified child should be respected by any active MnemonicSolver.

add

public void add(java.awt.Component child,
                float sectionId)
Add the specified child to the end of this context menu.

Specified by:
add in interface MenuManager
Overrides:
add in class AbstractMenuManager
Parameters:
child - menu item to add.
sectionId - floating point number used to group commands by section. Each section is automatically surrounded with JSeparators.

add

public void add(java.awt.Component child,
                float sectionId,
                boolean fixed)
Add the specified child to the end of this context menu.

Parameters:
child - menu item to add.
sectionId - floating point number used to group commands by section. Each section is automatically surrounded with JSeparators.
fixed - indicates that the mnemonics used by the specified child should be respected by any active MnemonicSolver.

addContextMenuListener

public void addContextMenuListener(ContextMenuListener l)
Adds a context menu listener. Context menu listeners listen for notification of when the menu is about to become visible or invisible.

Parameters:
l - the context menu listener.

addContextMenuListener

public void addContextMenuListener(ContextMenuListener l,
                                   java.lang.Class cls)
Adds a ContextMenuListener that is called when the type of the data represented by the current Context is assignable to a variable whose type is of the specified Class.

Parameters:
l - the ContextMenuListener to add.
cls - if non-null, the ContextMenuListener will only be notified if the current Context's data object type is assignable to a variable whose type is of the specified Class.

removeContextMenuListener

public void removeContextMenuListener(ContextMenuListener l)
Removes a context menu listener. Context menu listeners listen for notification of when the menu is about to become visible or invisible.

Parameters:
l - the context menu listener.

getGUI

public java.awt.Container getGUI(boolean create)
Creates the actual popup menu. Callers should store the returned value for use when calling the show method.

Parameters:
create - force a creation of the GUI if it does not yet exist.
Returns:
the newly create popup menu.

getMenuCount

public int getMenuCount()
Returns the number of elements in the menu.


removeAll

public void removeAll()
Removes all menu items from the popup menu.


show

public final void show(Context context)
Shows the popup menu.

Parameters:
context - the current context. context cannot be null and the context's event object must be a MouseEvent.

getContext

public final Context getContext()
Geth the current context. A copy of the current context is returned since some addins where modifying the original.

Returns:
The current context from where this menu was poppped-up. A copy of the context is returned.

addSeparator

public void addSeparator()
Adds a Menu separator to the context menu.


fireDefaultAction

public boolean fireDefaultAction(Context context)
Invoke this method to fire the deault action associated with this context menu. This is the action triggered when the user double clicks on the object from where the context menu is popped-up.

Parameters:
context - The current context.

getMnemonicSolver

public MnemonicSolver getMnemonicSolver()
Get the menu item mnemonic solver. This object can be used to make sure that the context menu does not have any conflicting mnemonics. Returns null if none available.


Extension SDK

 

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