Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [pde-dev] Diasabling Menuitems by code

Hi Darin,

It seems that I had sent emails into inappropriate places. I am not sure about the difference between mailing list and newsgroup. Is p2-dev mailing list intended for p2 contribution developers? If I have development questions about p2, I should post to the equinox newsgroup, right? Thank you for the clarification~~

Thanks a lot,
Frank



On Fri, Nov 21, 2008 at 10:59 AM, Darin Wright <Darin_Wright@xxxxxxxxxx> wrote:
This sort of question should be asked on the newsgroups rather than the
developer mailing list. It actually deals with the workbench frameworks
rather than PDE.

Darin



Sven Schwerin <schender2@xxxxxxxxxx>
Sent by: pde-dev-bounces@xxxxxxxxxxx
11/21/2008 03:05 AM
Please respond to
"Eclipse PDE general developers list." <pde-dev@xxxxxxxxxxx>


To
<pde-dev@xxxxxxxxxxx>
cc

Subject
[pde-dev] Diasabling Menuitems by code






Hi all,

cann someone exlain me how to get a reference to a menuitem by code to
enable/disable it.

Problem is when i want to disable a single menu item e.g. File -> Save
with following code i can only disable
the whole menu instead of single menuitems.

I tried to achieve this with following code:

       Menu menuBar =
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
               .getShell().getMenuBar();

       MenuItem [] items = menuBar.getItems();
       items[0].setEnabled(false);


With this code i can disable the file menu.


       MenuItem fileMenuItems [] =  items[0].getMenu().getItems();

when i add this line fileMenuItems are null after execution.

Can someone help me with this problem?

Sven



Rundum-Schutz für den PC - Windows Live OneCare: 90 Tage kostenlos!
_______________________________________________
pde-dev mailing list
pde-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/pde-dev


_______________________________________________
pde-dev mailing list
pde-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/pde-dev



--
Best Regards,
Frank Du

Back to the top