dsto.dfc.swt.commands
Class CommandViewMenuProvider

java.lang.Object
  extended by dsto.dfc.swt.commands.CommandViewMenuProvider
All Implemented Interfaces:
CommandViewNodeListener, EventListener, org.eclipse.swt.widgets.Listener

public final class CommandViewMenuProvider
extends Object
implements CommandViewNodeListener, org.eclipse.swt.widgets.Listener

Synchronizes a popup menu with a CommandView.

Version:
$Revision$

Constructor Summary
CommandViewMenuProvider(org.eclipse.swt.widgets.Menu menu, org.eclipse.swt.widgets.Widget control, CommandView commandView)
          Create a new instance.
CommandViewMenuProvider(org.eclipse.swt.widgets.Menu menu, org.eclipse.swt.widgets.Widget control, CommandView commandView, CommandViewNode root)
          Create a new instance.
 
Method Summary
 void childAdded(CommandViewNodeEvent e)
          Fired when a child is added to the node.
 void childMoved(CommandViewNodeEvent e)
          Fired when a child is moved within the node.
 void childRemoved(CommandViewNodeEvent e)
          Fired when a child is removed from the node.
 void commandChanged(CommandViewNodeEvent e)
          Fired when a child is moved within the node.
 void dispose()
          Remove all listeners and references created for menu synchronisation.
 void handleEvent(org.eclipse.swt.widgets.Event e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandViewMenuProvider

public CommandViewMenuProvider(org.eclipse.swt.widgets.Menu menu,
                               org.eclipse.swt.widgets.Widget control,
                               CommandView commandView)
Create a new instance.

Parameters:
menu - The menu to manage.
control - The control hosting the menu (may be null). If non-null, this control is monitored for double-clicks to invoke the default command. This option will usually only be used by context menus.
commandView - The command view backing the menu.

CommandViewMenuProvider

public CommandViewMenuProvider(org.eclipse.swt.widgets.Menu menu,
                               org.eclipse.swt.widgets.Widget control,
                               CommandView commandView,
                               CommandViewNode root)
Create a new instance.

Parameters:
menu - The menu to manage.
control - The control hosting the menu (may be null). If non-null, this control is monitored for double-clicks to invoke the default command. This option will usually only be used by context menus.
commandView - The command view backing the menu.
root - The root of the command tree.
Method Detail

dispose

public void dispose()
Remove all listeners and references created for menu synchronisation.


handleEvent

public void handleEvent(org.eclipse.swt.widgets.Event e)
Specified by:
handleEvent in interface org.eclipse.swt.widgets.Listener

childAdded

public void childAdded(CommandViewNodeEvent e)
Description copied from interface: CommandViewNodeListener
Fired when a child is added to the node.

Specified by:
childAdded in interface CommandViewNodeListener
Parameters:
e - The event. e e.getNode () == new node, e.getOldIndex () == -1, e.getNewIndex () == index of new node.

childRemoved

public void childRemoved(CommandViewNodeEvent e)
Description copied from interface: CommandViewNodeListener
Fired when a child is removed from the node.

Specified by:
childRemoved in interface CommandViewNodeListener
Parameters:
e - The event. e.getNode () == removed node, e.getOldIndex () == old index of node, e.getNewIndex () == -1.

childMoved

public void childMoved(CommandViewNodeEvent e)
Description copied from interface: CommandViewNodeListener
Fired when a child is moved within the node.

Specified by:
childMoved in interface CommandViewNodeListener
Parameters:
e - The event. e.getNode () == moved node, e.getOldIndex () == old index of node, e.getNewIndex () == new index.

commandChanged

public void commandChanged(CommandViewNodeEvent e)
Description copied from interface: CommandViewNodeListener
Fired when a child is moved within the node.

Specified by:
commandChanged in interface CommandViewNodeListener
Parameters:
e - The event. e.getSourceNode () == node that changed, e.getNode () == null, e.getOldCommand () == old command (may be null), e.getNewCommand () == new command.


Copyright © 2008 Commonwealth of Australia