Object selectedPart = lst.get( 0 ); if ( selectedPart instanceof DrawerEditPart && ( (DrawerEditPart) selectedPart ).canBePinned( ) ) { menu.appendToGroup( GEFActionConstants.MB_ADDITIONS, new PinDrawerAction( (DrawerEditPart) selectedPart ) ); }
	protected PaletteViewerProvider createPaletteViewerProvider( )	{		return new PaletteViewerProvider( getEditDomain( ) ) {			protected void configurePaletteViewer( PaletteViewer viewer )			{				//super.configurePaletteViewer( viewer );				/**				 * Hack to remove the Change Icon Size menu item and relative				 * dialog components.				 */				viewer.setContextMenu( new PaletteContextMenuProvider( viewer ) {					public void buildContextMenu( IMenuManager menu )					{						GEFActionConstants.addStandardActionGroups( menu );						List lst = getPaletteViewer( ).getSelectedEditParts( );						if ( lst.size( ) == 0 )						{							return;						}						Object selectedPart = lst.get( 0 );						if ( selectedPart instanceof DrawerEditPart								&& ( (DrawerEditPart) selectedPart ).canBePinned( ) )						{							menu.appendToGroup( GEFActionConstants.MB_ADDITIONS,									new PinDrawerAction( (DrawerEditPart) selectedPart ) );						}						menu.appendToGroup( GEFActionConstants.GROUP_VIEW,								new LayoutAction( getPaletteViewer( ).getPaletteViewerPreferences( ) ) );						if ( getPaletteViewer( ).getCustomizer( ) != null )						{							menu.appendToGroup( GEFActionConstants.GROUP_REST,									new CustomizeAction( getPaletteViewer( ) ) );						}						final PaletteViewer paletteViewer = getPaletteViewer( );						menu.appendToGroup( GEFActionConstants.GROUP_REST,								new SettingsAction( paletteViewer ) {									public void run( )									{										final PaletteViewerPreferences prefs = paletteViewer.getPaletteViewerPreferences( );										Dialog settings = new PaletteSettingsDialog( paletteViewer.getControl( )												.getShell( ),												prefs ) {											protected Control createLayoutSettings(													Composite parent )											{												Composite composite = new Composite( parent,														SWT.NONE );												composite.setFont( parent.getFont( ) );												GridLayout layout = new GridLayout( 1,														false );												composite.setLayout( layout );												Control layoutOptions = createLayoutOptions( composite );												GridData data = new GridData( GridData.VERTICAL_ALIGN_BEGINNING );												layoutOptions.setLayoutData( data );												handleLayoutSettingChanged( prefs.getLayoutSetting( ) );												return composite;											}											protected void handleLayoutSettingChanged(													int newSetting )											{												prefs.setLayoutSetting( newSetting );											}										};										settings.open( );									}								} );					}				} );				viewer.addDragSourceListener( new TemplateTransferDragSourceListener( viewer ) );			}			/*			 * (non-Javadoc)			 * 			 * @see org.eclipse.gef.ui.palette.PaletteViewerProvider#createPaletteViewer(org.eclipse.swt.widgets.Composite)			 */			public PaletteViewer createPaletteViewer( Composite parent )			{				PaletteViewer pViewer = new PaletteViewer( );				//Replace with new factory				pViewer.setEditPartFactory( new PaletteEditPartFactory( ) {					/*					 * (non-Javadoc)					 * 					 * @see org.eclipse.gef.ui.palette.PaletteEditPartFactory#createEntryEditPart(org.eclipse.gef.EditPart,					 *      java.lang.Object)					 */					protected EditPart createEntryEditPart(							EditPart parentEditPart, Object model )					{						if ( model instanceof ReportCombinedTemplateCreationEntry )						{							return new PaletteToolEntryEditPart( (ReportCombinedTemplateCreationEntry) model );						}						return super.createEntryEditPart( parentEditPart, model );					}				} );				pViewer.createControl( parent );				configurePaletteViewer( pViewer );				hookPaletteViewer( pViewer );				return pViewer;			}		};	}