Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Application Menu bar disappears when used OLEControlSite
Application Menu bar disappears when used OLEControlSite [message #504315] Fri, 18 December 2009 10:00 Go to next message
Mahesh is currently offline Mahesh
Messages: 4
Registered: July 2009
Junior Member
Hi,
I have a requirement to open word 2007 document with content controls in it in SWT. I have used org.eclipse.swt.ole.win32 classes for this.
I have followed following procedure to open a document
1. Created a new view in my application extending from ViewPart
2. In createPartControl method , I have created a OleFrame in the parent composite. Added File and Windows menu on the frame.
oleFrame = new OleFrame( parent, SWT.NULL );
oleFrame.setBackground( JFaceColors.getBannerBackground( oleFrame.getDisplay() ) );
IMenuManager fileMenu = AIFUtility.getWorkbenchWindowMenuManager().findMenuUsingPath ( IWorkbenchActionConstants.M_FILE );
oleFrame.setFileMenus( new MenuItem[] {((MenuManager)fileMenu).getMenu().getParentItem() } );
IMenuManager windowsMenu = AIFUtility.getWorkbenchWindowMenuManager().findMenuUsingPath ( IWorkbenchActionConstants.M_WINDOW );
oleFrame.setWindowMenus( new MenuItem[] {((MenuManager)windowsMenu).getMenu().getParentItem() } );

3. Created a file
File file = new File("D:\\Demo\\ContentControl.docx");
4. Created a new ControlSite
OleControlSite oleControlSite = new OleControlSite( oleFrame, SWT.NONE, file);
5. Activated a control site
oleControlSite.doVerb( OLE.OLEIVERB_SHOW );

After this new View open is opened and my application menu bar displays only File and Windows Menus (as set in step 2)
6. When I close the view I am performing oleControlSite.deactivateInPlaceClient(); and disposing the oleFrame
7. Once dispose Menu Bar disappears from the application.
8. Same thing when I do with the OleClientSite instead of OleControlSite, thing works fine and applications old menu bar (with File,Edit,View,Window,Help menus) is restored when new view created by me is closed.

I need to use OleControlSite as I have to take advantage of events for content control listeners, which I believe I can do only if I use OleControlSite.

Any help in this regard is appreciated.


Thanks and Regards,
Mahesh
Re: Application Menu bar disappears when used OLEControlSite [message #505630 is a reply to message #504315] Sun, 03 January 2010 17:16 Go to previous message
Wim Jongman is currently offline Wim Jongman
Messages: 418
Registered: July 2009
Senior Member
Hi Mahes,

You should try the SWT group (eclipse.platform.swt).

Best regards,

Wim Jongman


> Hi,
> I have a requirement to open word 2007 document with content controls in it
in SWT. I have used org.eclipse.swt.ole.win32 classes for this.
> I have followed following procedure to open a document
> 1. Created a new view in my application extending from ViewPart
> 2. In createPartControl method , I have created a OleFrame in the parent
composite. Added File and Windows menu on the frame.
> oleFrame = new OleFrame( parent, SWT.NULL );
> oleFrame.setBackground( JFaceColors.getBannerBackground(
oleFrame.getDisplay() ) );
> IMenuManager fileMenu =
AIFUtility.getWorkbenchWindowMenuManager().findMenuUsingPath (
IWorkbenchActionConstants.M_FILE );
> oleFrame.setFileMenus( new MenuItem[]
{((MenuManager)fileMenu).getMenu().getParentItem() } );
> IMenuManager windowsMenu =
AIFUtility.getWorkbenchWindowMenuManager().findMenuUsingPath (
IWorkbenchActionConstants.M_WINDOW );
> oleFrame.setWindowMenus( new MenuItem[]
{((MenuManager)windowsMenu).getMenu().getParentItem() } );
>
> 3. Created a file
> File file = new File("D:\\Demo\\ContentControl.docx");
> 4. Created a new ControlSite
> OleControlSite oleControlSite = new OleControlSite( oleFrame, SWT.NONE,
file);
> 5. Activated a control site
> oleControlSite.doVerb( OLE.OLEIVERB_SHOW );
>
> After this new View open is opened and my application menu bar displays
only File and Windows Menus (as set in step 2)
> 6. When I close the view I am performing
oleControlSite.deactivateInPlaceClient(); and disposing the oleFrame
> 7. Once dispose Menu Bar disappears from the application.
> 8. Same thing when I do with the OleClientSite instead of OleControlSite,
thing works fine and applications old menu bar (with
File,Edit,View,Window,Help menus) is restored when new view created by me is
closed.
>
> I need to use OleControlSite as I have to take advantage of events for
content control listeners, which I believe I can do only if I use
OleControlSite.
>
> Any help in this regard is appreciated.
>
>
> Thanks and Regards,
> Mahesh
Previous Topic:Eclipse product export missing executable binary
Next Topic:Re: org.eclipse.equinox.ds missing contraint
Goto Forum:
  


Current Time: Sat Oct 25 23:04:30 GMT 2014

Powered by FUDForum. Page generated in 0.03013 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software