Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] RE: Disabling Menuitems at IDE startup

Hi Malu,
The action framework enables actions by default until the plugin that contributed the action is loaded.  Additionally, retargetable actions, such as the breakpoint toggle actions also have an internal mechanism to assume that the action target is enabled until that plugin is loaded.  This is a compromise that was done to avoid loading unnecessary plugins at start up. 

If you have your own custom actions and you would like more control over their initial enablement, you should look at using the newer command framework (org.eclipse.ui.menus extension point) instead of actions.

Cheers,
Pawel

Mehregani, Navid wrote:

Malu,

 

You shouldn’t do this in ‘createInitialLaout()’.  This function is only called once when the perspective is initialized (e.g. when it’s first opened or when user resets the perspective).  Why don’t you just set the enablement of your action in the constructor of your Action class?  i.e. setEnabled(false).  This will ensure that your action will be disabled when it’s first created.  You can then enable it whenever it’s appropriate.  If the enablement of your actions depends on the debug context, listen in on IDebugContextListener to enable/disable them.

 

Navid

 


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Malu Sasi
Sent: Wednesday, January 06, 2010 11:24 PM
To: CDT General developers list.
Subject: [cdt-dev] Disabling Menuitems at IDE startup

 

Dear All,

 

            I need to show some custom action items in Run menu of eclipse IDE as disabled initially i.e; at the start up of work bench - like default action items in Run menu - Toggle Breakpoint, Toggle Line Breakpoint, Debug actions like Run, Debug,Resume etc.

 

            We have a custom perspective derived from the extension point org.eclipse.ui.perspectives. I tried to disable the required action items in createInitialLayout() function. When we run the code for the first time the control is passing through this function and the required result is obtained. But next time it’s is not entering this function. But again if we delete the runtime of previous session and run the code it works fine.

 

            Also I tried by setting the “enablesFor ” attribute of action in org.elipse.ui.actionSets as 1. But the result was unpredictable. Even though it gets disabled initially, if any item in views like breakpoint, _expression_, RSE etc is selected it gets enabled. So I can’t trust this.

 

            Can any one please suggest a method to disable the menu items initially?

 

Thanks in advance

Malu

 

 

***** Confidentiality Statement/Disclaimer *****

This message and any attachments is intended for the sole use of the intended recipient. It may contain confidential information. Any unauthorized use, dissemination or modification is strictly prohibited. If you are not the intended recipient, please notify the sender immediately then delete it from all your systems, and do not copy, use or print. Internet communications are not secure and it is the responsibility of the recipient to make sure that it is virus/malicious code exempt.

The company/sender cannot be responsible for any unauthorized alterations or modifications made to the contents. If you require any form of confirmation of the contents, please contact the company/sender. The company/sender is not liable for any errors or omissions in the content of this message.


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


Back to the top