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

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




Back to the top