com.tensegrity.skeleton.swt.launch
Class SwtMenuLaunchTask

java.lang.Object
  extended bycom.tensegrity.gui.launch.LaunchTask
      extended bycom.tensegrity.skeleton.swing.launch.AbstractLaunchTask
          extended bycom.tensegrity.skeleton.swt.launch.SwtMenuLaunchTask
Direct Known Subclasses:
SwtEditMenuLaunchTask, SwtFileMenuLaunchTask, SwtGraphPanelPopupMenuLaunchTask, SwtToolsMenuLaunchTask, SwtViewMenuLaunchTask

public abstract class SwtMenuLaunchTask
extends AbstractLaunchTask

This AbstractLaunchTask is the base class for launch tasks creating menus in the context of SWT applications. It contains several methods useful in order to create menus or menu items.

Version:
$Id: SwtMenuLaunchTask.java,v 1.29 2005/08/08 16:36:36 BurkhardWick Exp $
Author:
S�bastien Guyon

Nested Class Summary
protected  class SwtMenuLaunchTask.menuItemsListener
           This SelectionListener is used in order to perform the BaseCommand associated to a given MenuItem when it is selected, if the BaseCommand is enabled.
 
Field Summary
 
Fields inherited from class com.tensegrity.gui.launch.LaunchTask
lasterror, LAUNCHTASKSTATUS_FATAL, LAUNCHTASKSTATUS_FATAL_RETRY, LAUNCHTASKSTATUS_SERIOUS, LAUNCHTASKSTATUS_SERIOUS_RETRY, LAUNCHTASKSTATUS_SHUTDOWN, LAUNCHTASKSTATUS_SUCCESS, LAUNCHTASKSTATUS_WARNING
 
Constructor Summary
SwtMenuLaunchTask(SwtApplicationFrame applicationFrame)
          Creates the SwtMenuLaunchTask which intends to initialize default menus for a given SwtApplicationFrame.
SwtMenuLaunchTask(SwtApplicationFrame applicationFrame, java.lang.String nameKey)
          Creates the SwtMenuLaunchTask which intends to initialize default menus for a given SwtApplicationFrame.
 
Method Summary
protected  org.eclipse.swt.widgets.MenuItem addMenuItem(org.eclipse.swt.widgets.Menu parentMenu, java.lang.String commandId, SwtKeyStroke swtkeystroke)
           This routine adds to the passed parentMenu and returns a MenuItem associated to the BaseCommand with identifier commandId.
protected  org.eclipse.swt.widgets.MenuItem addMenuItem(org.eclipse.swt.widgets.Menu parentMenu, java.lang.String commandId, SwtKeyStroke swtkeystroke, org.eclipse.swt.widgets.Display display, java.lang.String iconurl, java.lang.Class referenceClass)
           This routine adds to the passed parentMenu and returns a MenuItem associated to the BaseCommand with identifier commandId.
protected  org.eclipse.swt.widgets.MenuItem addSeparator(org.eclipse.swt.widgets.Menu parentMenu)
           Adds a separator to the passed Menu.
protected  org.eclipse.swt.widgets.Menu createMenu(java.lang.String id)
           This routine adds a new Menu to the application's menu bar.
protected  org.eclipse.swt.widgets.Menu createSubMenu(org.eclipse.swt.widgets.Menu parentMenu, java.lang.String id)
           This routine adds a new Menu to the passed Menu.
 void postCreate(java.lang.Object object)
          This method is invoked once the LaunchTask.run() method is about to return.
 
Methods inherited from class com.tensegrity.skeleton.swing.launch.AbstractLaunchTask
findResourceText, getApplicationFrame, getName, getStatusPrefix, getStatusPrefixResourceKey
 
Methods inherited from class com.tensegrity.gui.launch.LaunchTask
getError, getStatusDetails, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwtMenuLaunchTask

public SwtMenuLaunchTask(SwtApplicationFrame applicationFrame)
Creates the SwtMenuLaunchTask which intends to initialize default menus for a given SwtApplicationFrame.

Parameters:
applicationFrame - Application context for this LaunchTask.

SwtMenuLaunchTask

public SwtMenuLaunchTask(SwtApplicationFrame applicationFrame,
                         java.lang.String nameKey)
Creates the SwtMenuLaunchTask which intends to initialize default menus for a given SwtApplicationFrame.

Parameters:
applicationFrame - Application context for this LaunchTask.
nameKey - the resource key for the name of this launch task
Method Detail

addMenuItem

protected org.eclipse.swt.widgets.MenuItem addMenuItem(org.eclipse.swt.widgets.Menu parentMenu,
                                                       java.lang.String commandId,
                                                       SwtKeyStroke swtkeystroke)

This routine adds to the passed parentMenu and returns a MenuItem associated to the BaseCommand with identifier commandId.

Parameters:
parentMenu - the Menu to which the MenuItem is to be added.
commandId - a BaseCommand identifier.
swtkeystroke - the SwtKeyStroke associated to the BaseCommand with identifier commandId. Can be null if no accelerator should be added to the MenuItem.
Returns:
a new MenuItem associated to the BaseCommand with identifier commandId.

addMenuItem

protected org.eclipse.swt.widgets.MenuItem addMenuItem(org.eclipse.swt.widgets.Menu parentMenu,
                                                       java.lang.String commandId,
                                                       SwtKeyStroke swtkeystroke,
                                                       org.eclipse.swt.widgets.Display display,
                                                       java.lang.String iconurl,
                                                       java.lang.Class referenceClass)

This routine adds to the passed parentMenu and returns a MenuItem associated to the BaseCommand with identifier commandId.

Parameters:
parentMenu - the Menu to which the MenuItem is to be added.
commandId - a BaseCommand identifier.
swtkeystroke - the SwtKeyStroke associated to the BaseCommand with identifier commandId. Can be null if no accelerator should be added to the MenuItem.
display - the Display required to load the icon. Can be null if no icon should be added to the MenuItem.
iconurl - the icon path. Can be null if no icon should be added to the MenuItem.
referenceClass - the Class used as reference in order to load the icon. Can be null if no icon should be added to the MenuItem.
Returns:
a new MenuItem associated to the BaseCommand with identifier commandId.

addSeparator

protected org.eclipse.swt.widgets.MenuItem addSeparator(org.eclipse.swt.widgets.Menu parentMenu)

Adds a separator to the passed Menu.

Parameters:
parentMenu - the Menu to which the separator is added.
Returns:
the separator.

createMenu

protected org.eclipse.swt.widgets.Menu createMenu(java.lang.String id)

This routine adds a new Menu to the application's menu bar. The passed id is the unique identifier for the Menu and is used in order to retrieve its localized text.

Parameters:
id - unique identifier for the Menu used in order to retrieve its localized text.
Returns:
the newly created Menu.
See Also:
ApplicationFrame.getMenuBar()

createSubMenu

protected org.eclipse.swt.widgets.Menu createSubMenu(org.eclipse.swt.widgets.Menu parentMenu,
                                                     java.lang.String id)

This routine adds a new Menu to the passed Menu. The passed id is the unique identifier for the Menu and is used in order to retrieve its localized text.

Parameters:
parentMenu - the parent Menu.
id - unique identifier for the Menu used in order to retrieve its localized text.
Returns:
the newly created Menu.

postCreate

public void postCreate(java.lang.Object object)
This method is invoked once the LaunchTask.run() method is about to return. The parameter is the Menu initialized by this launch task.

Specified by:
postCreate in class AbstractLaunchTask
Parameters:
object - the Menu initialized by this launch task.
See Also:
AbstractLaunchTask.postCreate(Object)


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.