Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT OLE doVerb makes application menu disappear
SWT OLE doVerb makes application menu disappear [message #897338] Mon, 23 July 2012 16:10 Go to next message
Binko Binev is currently offline Binko Binev
Messages: 20
Registered: June 2012
Junior Member
Hi all,

I have the following problem.
I am using OleControlSite in an RCP app. When I call control.doVerb on the OleControlSite, the application menu disappears.
I get the menu at the end of the process, but I cannot make it visible.
If I dispose the oleControlSite then I get the menu, but then I lose the Excel sheets.

has anyone encountered such a problem. I have google for a solution and someone else has had a similar problem. But I have found no solution.

so any ideas?

Binko
Re: SWT OLE doVerb makes application menu disappear [message #897582 is a reply to message #897338] Tue, 24 July 2012 15:14 Go to previous messageGo to next message
Binko Binev is currently offline Binko Binev
Messages: 20
Registered: June 2012
Junior Member
Well, It works with this additiona method, which I call at the end of processing

/*
* OleControlSite destroys RCP menus.
* so they have to be created again.
*/
static void addFileMenu(OleFrame frame) {
final Shell shell = frame.getShell();
Menu shellMenuBar = shell.getMenuBar();
MenuItem[] menuItems = shellMenuBar.getItems();
Menu menuBar = new Menu(shell,SWT.BAR);
shell.setMenuBar(menuBar);
for (int i = 0; i < menuItems.length; i++){
MenuItem fileMenu = new MenuItem(menuBar, SWT.CASCADE);
fileMenu.setText(menuItems[i].getText());
fileMenu.setMenu(menuItems[i].getMenu());
}
}

if anyone has better ideas is welcome.
Re: SWT OLE doVerb makes application menu disappear [message #988965 is a reply to message #897582] Tue, 04 December 2012 05:59 Go to previous messageGo to next message
Nitin Singhal is currently offline Nitin Singhal
Messages: 2
Registered: November 2012
Junior Member
Hi,

Instead of the code you mentioned, you can do the following:
While creating the object of frame you can add the following code:

frame.setContainerMenus( shell.getMenuBar().getItems() );

It will merge the application menus to the ole document's menu and it will do the same work.

-Nitin
Re: SWT OLE doVerb makes application menu disappear [message #1027205 is a reply to message #988965] Tue, 26 March 2013 17:40 Go to previous message
Binko Binev is currently offline Binko Binev
Messages: 20
Registered: June 2012
Junior Member
Hi,

I have the follwoing problem.

I have created a table in an emebedde Word document.
Then I get its rows for processing in the following method.

/**
	 * Returns the row in the table with the given index
	 * @param tableVar - table variant
	 * @param rowIndex - row index
	 * @return rowVariant - row Variant
	 * @throws OleException
	 */
	public static Variant getRow(Variant tableVar, int rowIndex) throws OleException {
		OleAutomation tableAuto = tableAuto = tableVar.getAutomation();
		OleUtils.printAutomation(tableAuto);
		Variant rowsVar = null;
		while (rowsVar == null){
			rowsVar = tableAuto.getProperty(101/*Rows*/);
		}
		OleAutomation rowsAuto = rowsVar.getAutomation();
		Variant rowVar = rowsAuto.invoke(0/*Item*/, new Variant[]{new Variant(rowIndex)});
		return rowVar;
	}


Sometimes it functions for over 70 rows, sometimes the Word application crashes and rowsVar is returned as null.

The OLE Exception is the usual 0x80020009 (Exception).

How can I prevent the Word application from crashing?
Any ideas?
Previous Topic:SWT source code for 32-bit Eclipse 4.3
Next Topic:Word crashes in getting table row
Goto Forum:
  


Current Time: Sat Oct 25 01:40:16 GMT 2014

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

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