C# Class SIL.FieldWorks.XWorks.DTMenuHandler

DTMenuHandler provides context menus to the data tree. When the user (or test code) selects issues commands, this class also invokes the corresponding methods on the data tree. You may create subclasses to do smart things with menus.
Although XWorks doesn't sound Flex-specific, most of the menu commands handled in this file are specific to Flex.
Inheritance: IxCoreColleague
Afficher le fichier Open project: sillsdev/FieldWorks Class Usage Examples

Protected Properties

Свойство Type Description
m_configuration System.Xml.XmlNode
m_dataEntryForm SIL.FieldWorks.Common.Framework.DetailControls.DataTree
m_mediator XCore.Mediator

Méthodes publiques

Méthode Description
Create ( DataTree dataEntryForm, XmlNode configuration ) : DTMenuHandler

factory method which creates the correct subclass based on the XML parameters

Init ( XCore.Mediator mediator, XmlNode configurationParameters ) : void
OnConvertEntryIntoComplexForm ( object argument ) : bool

OnConvertEntryIntoVariant ( object argument ) : bool

OnDataTreeCopy ( object cmd ) : bool

This method is called when a user selects a Copy operation in on a slice.

OnDataTreeDelete ( object cmd ) : bool

This method is called when a user selects a Delete operation for a slice. The menu item is defined in DataTreeInclude.xml with message="DataTreeDelete"

OnDataTreeHelp ( object cmd ) : bool
OnDataTreeInsert ( object cmd ) : bool

This method is called when a user selects an Insert operation in on a slice.

OnDeleteMediaFile ( object cmd ) : bool
OnDisplayConvertEntryIntoComplexForm ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool

Allow only one complex form type LexEntryRef object per LexEntry.

OnDisplayConvertEntryIntoVariant ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool

Allow any number of variant type LexEntryRef objects per LexEntry.

OnDisplayDataTreeCopy ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool

decide whether to display this tree copy Menu Item

OnDisplayDataTreeHelp ( object cmd, XCore.UIItemDisplayProperties display ) : bool
OnDisplayDataTreeInsert ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool

decide whether to display this tree insert Menu Item

OnDisplayDeleteMediaFile ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool

Check whether or not to display the "Delete This Media Link" command.

OnDisplayInsertMediaFile ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool

Check whether or not to display the "Insert Sound or Movie" command.

OnDisplayInsertPicture ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool

Determine whether we can insert a picture here.

OnInsertMediaFile ( object cmd ) : bool

Called by reflection based on menu item InsertSoundFile.

OnInsertPicture ( object cmd ) : bool

Called by reflection based on menu item InsertPicture.

OnLaunchGuiControl ( object commandObject ) : bool

Launch a control dynamically from the control pointed to by the 'guicontrol' id in the command object.

Méthodes protégées

Méthode Description
CanInsert ( Command command, Slice currentSlice, int &index ) : bool

Check to see if the insertion command makes sense for the current slice and its ContainingDataTree.

CanInsertFieldIntoObj ( SIL.FieldWorks.FDO.FdoCache fdoCache, string fieldName, ICmObject parentObj, int &index ) : bool

Check if the field can be inserted into the given object.

DTMenuHandler ( ) : System
ExtractInsertCommandInfo ( Command command, string &fieldName, string &className ) : void

Get the class name and field for the given insertion command.

MakeSliceContextMenu ( Slice slice, bool fHotLinkOnly ) : ContextMenu

Private Methods

Méthode Description
AddNewLexEntryRef ( object argument, int flidTypes ) : bool
CanInsertPictureOrMediaFile ( object cmd, int &flid ) : bool
ComponentShowsComplexForm ( ICmObject component, ILexEntry cplxForm, ILexEntryRef &cfRef ) : bool

Does this component show this complex form in the dictionary? The component can be a ILexEntry or a ILexSense. The reference to the complex form from the component is outted.

DeleteObject ( Command command ) : bool
DisplayConvertLexEntry ( object commandObject ) : bool
ExtractInsertCommandParameters ( Command command ) : XmlNode
GetFlidIfPossible ( int clid, string fieldName, IFwMetaDataCacheManaged mdc ) : int

This seems a bit clumsy, but the metadata cache now throws an exception if the class id/field name pair isn't valid for GetFieldId2(). So we check first in cases where we want a zero if not found.

GetMessageTargets ( ) : IxCoreColleague[]
GetSelectedComplexFormHvo ( Slice complexFormsSlice ) : int

Intended to get a selected complex form, but it can probably get other selections from entries or senses.

GetSelectedComponentHvo ( ) : int
GetSelectionHvoFromControls ( Slice slice ) : int

Gets the selection HVO from a slice control.

InsertMediaFile ( object cmd, string filter, string keyCaption, string defaultCaption ) : bool
OnAddComponentToPrimary ( object argument ) : bool
OnDataTreeAddReference ( object cmd ) : bool
OnDataTreeDeleteReference ( object cmd ) : bool
OnDataTreeEdit ( object cmd ) : bool
OnDataTreeMerge ( object cmd ) : bool
OnDataTreeSplit ( object cmd ) : bool
OnDisplayAddComponentToPrimary ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
OnDisplayDataTreeDelete ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
OnDisplayDataTreeDeleteReference ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
OnDisplayDataTreeEdit ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
OnDisplayDataTreeMerge ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
OnDisplayDataTreeSplit ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
OnDisplayMoveDownObjectInSequence ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
OnDisplayMoveUpObjectInSequence ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
OnDisplayVisibleComplexForm ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
OnMoveDownObjectInSequence ( object cmd ) : bool
OnMoveUpObjectInSequence ( object cmd ) : bool
OnVisibleComplexForm ( object argument ) : bool
ShowContextMenu2Id ( XmlNode caller, bool fHotLinkOnly ) : string
ShowSliceContextMenu ( object sender, SliceMenuRequestArgs e ) : ContextMenu
SliceConfiguredForField ( XmlNode node, string field ) : bool

Method Details

CanInsert() protected méthode

Check to see if the insertion command makes sense for the current slice and its ContainingDataTree.
protected CanInsert ( Command command, Slice currentSlice, int &index ) : bool
command Command insertion command
currentSlice Slice current selected slice on the ContainingDataTree
index int 0-based position for insert, if known, or -1
Résultat bool

CanInsertFieldIntoObj() protected méthode

Check if the field can be inserted into the given object.
protected CanInsertFieldIntoObj ( SIL.FieldWorks.FDO.FdoCache fdoCache, string fieldName, ICmObject parentObj, int &index ) : bool
fdoCache SIL.FieldWorks.FDO.FdoCache
fieldName string name of the field to be inserted
parentObj ICmObject The object where the item would be inserted, if possible.
index int index (0-based) where it will be inserted. -1 if atomic or returns false
Résultat bool

Create() public static méthode

factory method which creates the correct subclass based on the XML parameters
public static Create ( DataTree dataEntryForm, XmlNode configuration ) : DTMenuHandler
dataEntryForm SIL.FieldWorks.Common.Framework.DetailControls.DataTree
configuration System.Xml.XmlNode
Résultat DTMenuHandler

DTMenuHandler() protected méthode

protected DTMenuHandler ( ) : System
Résultat System

ExtractInsertCommandInfo() static protected méthode

Get the class name and field for the given insertion command.
static protected ExtractInsertCommandInfo ( Command command, string &fieldName, string &className ) : void
command Command insertion command
fieldName string
className string
Résultat void

Init() public méthode

public Init ( XCore.Mediator mediator, XmlNode configurationParameters ) : void
mediator XCore.Mediator
configurationParameters System.Xml.XmlNode
Résultat void

MakeSliceContextMenu() protected méthode

protected MakeSliceContextMenu ( Slice slice, bool fHotLinkOnly ) : ContextMenu
slice Slice
fHotLinkOnly bool
Résultat System.Windows.Forms.ContextMenu

OnConvertEntryIntoComplexForm() public méthode

public OnConvertEntryIntoComplexForm ( object argument ) : bool
argument object
Résultat bool

OnConvertEntryIntoVariant() public méthode

public OnConvertEntryIntoVariant ( object argument ) : bool
argument object
Résultat bool

OnDataTreeCopy() public méthode

This method is called when a user selects a Copy operation in on a slice.
public OnDataTreeCopy ( object cmd ) : bool
cmd object
Résultat bool

OnDataTreeDelete() public méthode

This method is called when a user selects a Delete operation for a slice. The menu item is defined in DataTreeInclude.xml with message="DataTreeDelete"
public OnDataTreeDelete ( object cmd ) : bool
cmd object
Résultat bool

OnDataTreeHelp() public méthode

public OnDataTreeHelp ( object cmd ) : bool
cmd object
Résultat bool

OnDataTreeInsert() public méthode

This method is called when a user selects an Insert operation in on a slice.
public OnDataTreeInsert ( object cmd ) : bool
cmd object
Résultat bool

OnDeleteMediaFile() public méthode

public OnDeleteMediaFile ( object cmd ) : bool
cmd object
Résultat bool

OnDisplayConvertEntryIntoComplexForm() public méthode

Allow only one complex form type LexEntryRef object per LexEntry.
public OnDisplayConvertEntryIntoComplexForm ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
commandObject object
display XCore.UIItemDisplayProperties
Résultat bool

OnDisplayConvertEntryIntoVariant() public méthode

Allow any number of variant type LexEntryRef objects per LexEntry.
public OnDisplayConvertEntryIntoVariant ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
commandObject object
display XCore.UIItemDisplayProperties
Résultat bool

OnDisplayDataTreeCopy() public méthode

decide whether to display this tree copy Menu Item
public OnDisplayDataTreeCopy ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
commandObject object
display XCore.UIItemDisplayProperties
Résultat bool

OnDisplayDataTreeHelp() public méthode

public OnDisplayDataTreeHelp ( object cmd, XCore.UIItemDisplayProperties display ) : bool
cmd object
display XCore.UIItemDisplayProperties
Résultat bool

OnDisplayDataTreeInsert() public méthode

decide whether to display this tree insert Menu Item
public OnDisplayDataTreeInsert ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
commandObject object
display XCore.UIItemDisplayProperties
Résultat bool

OnDisplayDeleteMediaFile() public méthode

Check whether or not to display the "Delete This Media Link" command.
public OnDisplayDeleteMediaFile ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
commandObject object
display XCore.UIItemDisplayProperties
Résultat bool

OnDisplayInsertMediaFile() public méthode

Check whether or not to display the "Insert Sound or Movie" command.
public OnDisplayInsertMediaFile ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
commandObject object
display XCore.UIItemDisplayProperties
Résultat bool

OnDisplayInsertPicture() public méthode

Determine whether we can insert a picture here.
public OnDisplayInsertPicture ( object commandObject, XCore.UIItemDisplayProperties &display ) : bool
commandObject object
display XCore.UIItemDisplayProperties
Résultat bool

OnInsertMediaFile() public méthode

Called by reflection based on menu item InsertSoundFile.
public OnInsertMediaFile ( object cmd ) : bool
cmd object
Résultat bool

OnInsertPicture() public méthode

Called by reflection based on menu item InsertPicture.
public OnInsertPicture ( object cmd ) : bool
cmd object
Résultat bool

OnLaunchGuiControl() public méthode

Launch a control dynamically from the control pointed to by the 'guicontrol' id in the command object.
public OnLaunchGuiControl ( object commandObject ) : bool
commandObject object
Résultat bool

Property Details

m_configuration protected_oe property

COnfiguration information.
protected XmlNode,System.Xml m_configuration
Résultat System.Xml.XmlNode

m_dataEntryForm protected_oe property

Tree form.
protected DataTree,SIL.FieldWorks.Common.Framework.DetailControls m_dataEntryForm
Résultat SIL.FieldWorks.Common.Framework.DetailControls.DataTree

m_mediator protected_oe property

Mediator that passes off messages.
protected Mediator,XCore m_mediator
Résultat XCore.Mediator