Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Modifying Menu inside Job/Display.asyncExec()
Modifying Menu inside Job/Display.asyncExec() [message #330422] Mon, 28 July 2008 15:11 Go to next message
Srimathi is currently offline SrimathiFriend
Messages: 5
Registered: July 2009
Junior Member
Hi,

I used the following to add MenuItems to an existing Menu object. In
which, createMenuDescriptor(), method is time consuming operation. So i
had to put this in a Job thread. But whatever changes applied to the Menu
object is not visible in the UI. Note that the same code worked in
eclipse3.2 but not in eclipse 3.4. A help would be really great. Thanks in
advance.

public void constructMenu( final Menu parent) {
MenuItem[] menuItems = parent.getItems();
for (int i = 0; i < menuItems.length; i++) {
menuItems[i].dispose();
}
MenuItem item = new MenuItem(parent, SWT.PUSH);
item.setText(Messages.getString("MenuBuilder.Loading"));
//$NON-NLS-1$
item.setEnabled(false);
Job job = new Job( "") {
@Override
protected IStatus run(IProgressMonitor monitor) {
final MenuDescriptor descriptor =
createMenuDescriptor(); //Time consuming operation
if (!parent.isDisposed()) {
parent.getDisplay().syncExec(new Runnable() {
public void run() {
if (!parent.isDisposed()) {
constructMenu( parent,
descriptor); //Which adds and diposes some of the menu-items in parent
object.
}
}
});
}
return Status.OK_STATUS;
}
};
job.setPriority(Job.SHORT);
job.schedule();
}

Regards,
Mathi
Re: Modifying Menu inside Job/Display.asyncExec() [message #330429 is a reply to message #330422] Mon, 28 July 2008 16:47 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

I would open a bug against
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=SWT
with a small snippet that works in 3.2 but not in 3.4

Don't forget to post the bug number here when submitted.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: Modifying Menu inside Job/Display.asyncExec() [message #330445 is a reply to message #330429] Tue, 29 July 2008 10:14 Go to previous messageGo to next message
Srimathi is currently offline SrimathiFriend
Messages: 5
Registered: July 2009
Junior Member
I have created a bug for this. #242357
Re: Modifying Menu inside Job/Display.asyncExec() [message #330447 is a reply to message #330445] Tue, 29 July 2008 12:51 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Srimathi wrote:
> I have created a bug for this. #242357

Thanz. This is probably related to the delayed loading code added to
ActionContributionItem.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Previous Topic:Using eclipse launch framework
Next Topic:Executing a command in an External Tool console
Goto Forum:
  


Current Time: Thu Dec 26 14:45:43 GMT 2024

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

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

Back to the top