Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Enable/disable commands on the basis of a view's content
Enable/disable commands on the basis of a view's content [message #756124] Fri, 11 November 2011 06:03 Go to next message
Elvie DSouza is currently offline Elvie DSouzaFriend
Messages: 5
Registered: September 2010
Junior Member
Hi,

I have a menu with commands based menuitems. I have created a source provider by extending AbstractSourceProvider class to enable/disable the commands.

I am enabling them by setting the state of the variable as 'enabled' when I add a particular file to a custom view (created in the base product, we don't have the source code for it).

The view has a context menu in which there is a delete action to delete the contents.

My problem is that I am not able to detect the delete of the files, which in turn keeps the menuitems/commands in enabled state even if the file is not present in the view.

The workaround for this is to add a 'Show' listener to the top menu & set the variable as enabled/disabled. But there are different source providers for different file types. It's becoming cumbersome to use this approach.

I want to know a way in which I can detect the delete in the view and set my variables accordingly.

Pls help.

Thanks
Elvie
Re: Enable/disable commands on the basis of a view's content [message #756529 is a reply to message #756124] Mon, 14 November 2011 08:43 Go to previous message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 428
Registered: July 2009
Senior Member
Hi Elvie,

Your view should act as a listener to the model on which you are working.So any modification in the model should send notification to the view.
The view then should change it accordingly.EMF has a very nice way of implementing the same behaviour through its notification mechanism for its models.

cheers,
Saurav


Previous Topic:Error occurs in OSX but not in Windows
Next Topic:Open a java-source file from a plugin?
Goto Forum:
  


Current Time: Sun Jun 20 01:18:25 GMT 2021

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

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

Back to the top