Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Application Menu bar disappears when used OLEControlSite(Application Menu bar disappears when used OLEControlSite)
Application Menu bar disappears when used OLEControlSite [message #506631] Fri, 08 January 2010 12:44
Mahesh is currently offline MaheshFriend
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
Previous Topic:How can I disable XULRunner/firefox Embedded Browser offline mode
Next Topic:OpenSolaris: Eclipse/SWT hangs in GTK OS call when trying to change fonts
Goto Forum:
  


Current Time: Fri Mar 29 06:00:41 GMT 2024

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

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

Back to the top