Extension SDK 10.1.3.36.73

oracle.ide.controller
Class ContextMenu

java.lang.Object
  extended byoracle.ide.controller.MenuManager
      extended byoracle.ide.controller.ContextMenu

public final class ContextMenu
extends MenuManager

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


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, 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()
          Gets 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.controller.MenuManager
add, add, createMenu, createMenu, createMenu, createMenuItem, createMenuItem, createSubMenu, createSubMenu, createSubMenu, getChildById, getIndexOfChild, getIndexOfCommandId, getJMenu, putJMenu, remove, remove, removeMenuManagerMenuListener, 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 class: MenuManager
Appends a component into the MenuManager's GUI.

Overrides:
add in class MenuManager
Parameters:
child - the child to add.

add

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

Overrides:
add in class MenuManager
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.

Specified by:
getGUI in class MenuManager
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()
Gets the current context.

Returns:
The current context from where this menu was poppped-up.

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 10.1.3.36.73

 

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