dsto.dfc.swt.commands
Class Commands

java.lang.Object
  extended by dsto.dfc.swt.commands.Commands

public final class Commands
extends Object

Generic command utility methods.

Version:
$Revision$
Author:
mpp

Field Summary
static Object SHOW_NAME_KEY
           
 
Method Summary
static void createMenu(org.eclipse.swt.widgets.Decorations shell, CommandView view)
           
static void createToolbar(org.eclipse.swt.widgets.CoolBar coolbar, CommandView commandView)
          Create a toolbar from the specified command view.
static Command findCommand(org.eclipse.swt.widgets.Control control, Class commandClass)
          Find a command in the context or toolbar view for a control.
static Command findCommand(org.eclipse.swt.widgets.Control control, String name)
          Find a command in the context or toolbar view for a control.
static CommandView getCommandView(org.eclipse.swt.widgets.Control control, String viewName)
          Get/create the menu view for a control.
static CommandView getContextView(org.eclipse.swt.widgets.Control control)
          Get/create the context menu view for a control.
static CommandView getMenuView(org.eclipse.swt.widgets.Decorations shell)
          Get/create the main menu view for a control.
static CommandView getToolbarView(org.eclipse.swt.widgets.Control control)
           
static void setContextMenuView(org.eclipse.swt.widgets.Control control, CommandView view)
           
static void setMenuView(org.eclipse.swt.widgets.Control control, CommandView view)
           
static void setToolbarView(org.eclipse.swt.widgets.Control control, CommandView view)
           
static void showName(CommandView view, Command command)
          Shortcut to set the SHOW_NAME_KEY command property to true.
static void showName(CommandView view, String commandName)
          Shortcut to set the SHOW_NAME_KEY command property to true.
static void syncMenu(CommandView view, org.eclipse.swt.widgets.Menu menu)
          Connect a command view with a menu.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHOW_NAME_KEY

public static final Object SHOW_NAME_KEY
Method Detail

syncMenu

public static void syncMenu(CommandView view,
                            org.eclipse.swt.widgets.Menu menu)
Connect a command view with a menu. The menu is synchronised with entries from the view.

Parameters:
view - The command view. Must be a context menu view.
menu - The menu.
Throws:
IllegalArgumentException - if command view is not a context menu view.
See Also:
CommandViewMenuProvider

getContextView

public static CommandView getContextView(org.eclipse.swt.widgets.Control control)
Get/create the context menu view for a control. The context menu created from the view is installed as the control's menu via setMenu ().


setContextMenuView

public static void setContextMenuView(org.eclipse.swt.widgets.Control control,
                                      CommandView view)

getMenuView

public static CommandView getMenuView(org.eclipse.swt.widgets.Decorations shell)
Get/create the main menu view for a control. The menu bar created from the view is installed shell's menu bar.


createMenu

public static void createMenu(org.eclipse.swt.widgets.Decorations shell,
                              CommandView view)

setMenuView

public static void setMenuView(org.eclipse.swt.widgets.Control control,
                               CommandView view)

getToolbarView

public static CommandView getToolbarView(org.eclipse.swt.widgets.Control control)

setToolbarView

public static void setToolbarView(org.eclipse.swt.widgets.Control control,
                                  CommandView view)

getCommandView

public static CommandView getCommandView(org.eclipse.swt.widgets.Control control,
                                         String viewName)
Get/create the menu view for a control.


createToolbar

public static void createToolbar(org.eclipse.swt.widgets.CoolBar coolbar,
                                 CommandView commandView)
Create a toolbar from the specified command view.


showName

public static void showName(CommandView view,
                            Command command)
Shortcut to set the SHOW_NAME_KEY command property to true. This will hint to the toolbar UI generator to show the command's name as well as its icon on the toolbar. Tip: you should call this before adding the command to the view for the toolbar UI to honor it.


showName

public static void showName(CommandView view,
                            String commandName)
Shortcut to set the SHOW_NAME_KEY command property to true. This will hint to the toolbar UI generator to show the command's name as well as its icon on the toolbar. Tip: you should call this before adding the command to the view for the toolbar UI to honor it.


findCommand

public static Command findCommand(org.eclipse.swt.widgets.Control control,
                                  String name)
Find a command in the context or toolbar view for a control.


findCommand

public static Command findCommand(org.eclipse.swt.widgets.Control control,
                                  Class commandClass)
Find a command in the context or toolbar view for a control.



Copyright © 2008 Commonwealth of Australia