action = getAction( RevertToReportItemPartAction.ID ); menuManager.appendToGroup( GEFActionConstants.GROUP_EDIT, action );  action = getAction( RevertToTemplatePartAction.ID ); menuManager.appendToGroup( GEFActionConstants.GROUP_EDIT, action );
	public void buildContextMenu( IMenuManager menuManager )	{		GEFActionConstants.addStandardActionGroups( menuManager );		Object firstSelectedElement = getFirstElement( );		Object selectedElements = getSelectedElement( );		Object multiSelection = getMultiSelectedElement( );		// special for dealing with multi selected elements (items).		if ( isMutilSelection( multiSelection ) )		{			menuManager.appendToGroup( GEFActionConstants.GROUP_UNDO,					getAction( ActionFactory.UNDO.getId( ) ) );			menuManager.appendToGroup( GEFActionConstants.GROUP_UNDO,					getAction( ActionFactory.REDO.getId( ) ) );			menuManager.appendToGroup( GEFActionConstants.GROUP_COPY,					new CutAction( selectedElements ) );			menuManager.appendToGroup( GEFActionConstants.GROUP_COPY,					new CopyAction( selectedElements ) );			menuManager.appendToGroup( GEFActionConstants.GROUP_COPY,					new PasteAction( selectedElements ) );			menuManager.appendToGroup( GEFActionConstants.GROUP_COPY,					new DeleteAction( selectedElements ) );			if ( isRootElementHandleClass( multiSelection ) )			{				createInsertElementMenu( menuManager,						GEFActionConstants.GROUP_EDIT );			}			if ( isListHandleCalss( multiSelection ) )			{				IAction action = getAction( CreatePlaceHolderPartAction.ID );				menuManager.appendToGroup( GEFActionConstants.GROUP_EDIT,						action );			}			createStyleMenu( menuManager, GEFActionConstants.GROUP_REST );			if ( Policy.TRACING_MENU_SHOW )			{				System.out.println( "Menu(for Editor) >> Shows for multi-selcetion." ); //$NON-NLS-1$			}		}		// -----------------------------------------------------------------		else if ( firstSelectedElement instanceof DesignElementHandle )		{			menuManager.appendToGroup( GEFActionConstants.GROUP_UNDO,					getAction( ActionFactory.UNDO.getId( ) ) );			menuManager.appendToGroup( GEFActionConstants.GROUP_UNDO,					getAction( ActionFactory.REDO.getId( ) ) );			menuManager.appendToGroup( GEFActionConstants.GROUP_COPY,					new CutAction( selectedElements ) );			menuManager.appendToGroup( GEFActionConstants.GROUP_COPY,					new CopyAction( selectedElements ) );			menuManager.appendToGroup( GEFActionConstants.GROUP_COPY,					new PasteAction( selectedElements ) );			createStyleMenu( menuManager, GEFActionConstants.GROUP_REST );			if ( ( (IStructuredSelection) getSelection( ) ).size( ) == 1 )			{				Object element = ( (IStructuredSelection) getSelection( ) ).getFirstElement( );				if ( element instanceof LabelEditPart						|| element instanceof ImageEditPart )				{					IAction action = getAction( GEFActionConstants.DIRECT_EDIT );					action.setAccelerator( SWT.F2 );					if ( element instanceof DataEditPart )					{						action.setText( Messages.getString( "SchematicContextMenuProvider.ActionText.editData" ) ); //$NON-NLS-1$					}					else					{						action.setText( Messages.getString( "SchematicContextMenuProvider.ActionText.editLabel" ) ); //$NON-NLS-1$					}					menuManager.appendToGroup( GEFActionConstants.GROUP_EDIT,							action );				}				if ( firstSelectedElement instanceof ReportItemHandle )				{					IAction action = getAction( CreatePlaceHolderPartAction.ID );					menuManager.appendToGroup( GEFActionConstants.GROUP_EDIT,							action );				}				if ( firstSelectedElement instanceof TemplateReportItemHandle )				{					IAction action = getAction( RevertToReportItemPartAction.ID );					menuManager.appendToGroup( GEFActionConstants.GROUP_EDIT,							action );				}			}			if ( firstSelectedElement instanceof RowHandle )			{				if ( getRowHandles( ).size( ) != 0 )				{					MenuManager insertMenu = new MenuManager( INSERT_MENU_ITEM_TEXT );					MenuManager rowMenu = new MenuManager( INSERT_ROW_MENU_ITEM_TEXT );					rowMenu.add( getAction( InsertRowAboveAction.ID ) );					rowMenu.add( getAction( InsertRowBelowAction.ID ) );					RowHandle row = (RowHandle) getRowHandles( ).get( 0 );					if ( !( row.getContainer( ) instanceof GridHandle ) )					{						insertMenu.add( getAction( IncludeHeaderAction.ID ) );						insertMenu.add( getAction( IncludeDetailAction.ID ) );						insertMenu.add( getAction( IncludeFooterAction.ID ) );					}					insertMenu.add( rowMenu );					menuManager.appendToGroup( GEFActionConstants.GROUP_EDIT,							insertMenu );				}				// delete row action.				menuManager.appendToGroup( GEFActionConstants.GROUP_COPY,						getAction( DeleteRowAction.ID ) );				menuManager.appendToGroup( GEFActionConstants.GROUP_EDIT,						getAction( MergeAction.ID ) );				menuManager.appendToGroup( GEFActionConstants.GROUP_EDIT,						getAction( SplitAction.ID ) );			}			else if ( firstSelectedElement instanceof ColumnHandle )			{				menuManager.appendToGroup( GEFActionConstants.GROUP_EDIT,						new InsertPasteColumnAction( selectedElements ) );				if ( getColumnHandles( ).size( ) != 0 )				{					MenuManager subMenu = new MenuManager( INSERT_MENU_ITEM_TEXT );					subMenu.add( getAction( InsertColumnRightAction.ID ) );					subMenu.add( getAction( InsertColumnLeftAction.ID ) );					menuManager.appendToGroup( GEFActionConstants.GROUP_EDIT,							subMenu );				}				// delete column action.				menuManager.appendToGroup( GEFActionConstants.GROUP_COPY,						getAction( DeleteColumnAction.ID ) );				menuManager.appendToGroup( GEFActionConstants.GROUP_EDIT,						getAction( MergeAction.ID ) );				menuManager.appendToGroup( GEFActionConstants.GROUP_EDIT,						getAction( SplitAction.ID ) );			}			else if ( firstSelectedElement instanceof CellHandle )			{				createInsertElementMenu( menuManager,						GEFActionConstants.GROUP_EDIT );				menuManager.appendToGroup( GEFActionConstants.GROUP_EDIT,						getAction( MergeAction.ID ) );				menuManager.appendToGroup( GEFActionConstants.GROUP_EDIT,						getAction( SplitAction.ID ) );				// delete action in cell				menuManager.appendToGroup( GEFActionConstants.GROUP_COPY,						new DeleteAction( selectedElements ) );			}			else			{				// common delete action				menuManager.appendToGroup( GEFActionConstants.GROUP_COPY,						new DeleteAction( selectedElements ) );			}			if ( Policy.TRACING_MENU_SHOW )			{				System.out.println( "Menu(for Editor) >> Shows for " //$NON-NLS-1$						+ ( (DesignElementHandle) firstSelectedElement ).getDefn( )								.getDisplayName( ) );			}		}		else if ( firstSelectedElement instanceof SlotHandle )		{			menuManager.appendToGroup( GEFActionConstants.GROUP_UNDO,					getAction( ActionFactory.UNDO.getId( ) ) );			menuManager.appendToGroup( GEFActionConstants.GROUP_UNDO,					getAction( ActionFactory.REDO.getId( ) ) );			menuManager.appendToGroup( GEFActionConstants.GROUP_COPY,					new CutAction( selectedElements ) );			menuManager.appendToGroup( GEFActionConstants.GROUP_COPY,					new CopyAction( selectedElements ) );			menuManager.appendToGroup( GEFActionConstants.GROUP_COPY,					new PasteAction( selectedElements ) );			menuManager.appendToGroup( GEFActionConstants.GROUP_COPY,					new DeleteAction( selectedElements ) );			createInsertElementMenu( menuManager, GEFActionConstants.GROUP_EDIT );			if ( Policy.TRACING_MENU_SHOW )			{				System.out.println( "Menu(for Editor) >> Shows for the slot " //$NON-NLS-1$						+ ( (SlotHandle) firstSelectedElement ).getSlotID( )						+ " of " //$NON-NLS-1$						+ ( (SlotHandle) firstSelectedElement ).getElementHandle( )								.getDefn( )								.getDisplayName( ) );			}		}		else		{			//		}		if ( !getTableEditParts( ).isEmpty( ) )		{			createInsertGroupMenu( menuManager, GEFActionConstants.GROUP_ADD );			menuManager.appendToGroup( GEFActionConstants.GROUP_ADD,					getAction( DeleteTableGroupAction.ID ) );			if ( getTableEditParts( ).size( ) == 1 )			{				createEditGroupMenu( menuManager, GEFActionConstants.GROUP_ADD );				Separator separator = new Separator( EditBindingAction.ID );				menuManager.add( separator );				menuManager.appendToGroup( EditBindingAction.ID,						getAction( EditBindingAction.ID ) );			}		}		if ( !getListEditParts( ).isEmpty( ) )		{			createInsertGroupMenu( menuManager, GEFActionConstants.GROUP_ADD );			menuManager.appendToGroup( GEFActionConstants.GROUP_ADD,					getAction( DeleteListGroupAction.ID ) );			if ( getListEditParts( ).size( ) == 1 )			{				createEditGroupMenu( menuManager, GEFActionConstants.GROUP_ADD );			}		}		if ( getElements( ).size( ) == 1 || isMutilSelection( multiSelection ) )		{			if ( firstSelectedElement instanceof DesignElementHandle )			{				String elementName = ( (DesignElementHandle) firstSelectedElement ).getDefn( )						.getName( );				IMenuBuilder menuBuilder = ExtensionPointManager.getInstance( )						.getMenuBuilder( elementName );				if ( menuBuilder != null )				{					menuBuilder.buildMenu( menuManager, getElements( ) );				}			}		}	}