[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: ActionSet visibility

reindheer wrote:

But when the user selects th perspective when he is not connected to a database, all the views are empty. Now i want the db actions except connect to be disabled. We initially thought of using an Action registry to enable\disable actions.

With no action registry, some of the other options available are:
1) have your IActionDelegates check for DB connection on every selectionChange(*) call to have them enabled when connected


2) move your DB-connect actions into a different action set, and use IWorkbenchPage show and hide action set methods to make them show up when your DB is connected. This will make them appear/disappear

3) if using commands/handlers, you can write a property tester applied to the current selection to check if your DB is connected ... that can then be used in org.eclipse.ui.handlers - activeWhen/enabledWhen to enable/disable the commands or in org.eclipse.ui.menus - visibleWhen to make them appear/disappear.

Later,
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