Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] tool visibility / actionsets example (jesse design constraint help)

So because of this, the first if condition is never met (if( contextService.getDefinedContextIds().contains(categoryId)))

So I must not be understanding the other code; or it must be wrong :( 

Is there a list of tools that can not be used on a regular image (no features) that we could check against instead? If not might have to make one.

Good question: The CustomApplication document covers this let me check ...

9. Repeat this process for the following additional entries:
net.refractions.udig.project.ui.layer.menu (actionSet)
net.refractions.udig.project.ui.map.menu  (actionSet)
net.refractions.udig.catalog.ui.data.menu (actionSet)

So not quite what we were looking for... I went looking at the tool extension point and could not find the information there. So it must not exist.

Jesse Eichar provided the following constraint: "How to filter out tools from the toolbar manager (unless a migration plan is provided)"
Since it is not done with AcitonSets I am not sure how it is done ... so we will have to ask him what he meant.

I did look up the "context id" information; it is part of how menus work here:
http://help.eclipse.org/galileo/topic/org.eclipse.platform.doc.isv/guide/workbench_advext_contexts.htm

As usual the eclipse wiki is a bit more readable:
http://wiki.eclipse.org/Platform_Command_Framework#Contexts

Jody

From: udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx [mailto:udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf Of Jody Garnett
Sent: Thursday, August 18, 2011 11:28 AM
To: User-friendly Internet GIS
Subject: [udig-devel] tool visibility / actionsets example

 

Hi John:

 

So we are down to two things before docs a) visibility b) enablement

 

I found a decent code example for visibility. It is controlled with ActionSets (which is something that is part of the perspective definition; so the perspective can turn off tool categories that would otherwise annoy users).

 

Inside MentuToolcategory.contirbute(IMenuManager) the have the following:

 

1) looking up the current action sets

 

        IWorkbench workbench = PlatformUI.getWorkbench();

        IContextService contextService = (IContextService) workbench.getService(IContextService.class);

        Collection<String> active = (Collection<String> )contextService.getActiveContextIds();

 

2) when "contributing" tools

 

        for( ModalItem item : this ) {

            ToolProxy tool = (ToolProxy) item;

            String categoryId = tool.getCategoryId();

            if( contextService.getDefinedContextIds().contains(categoryId)){

                // we have an context for this tool category

                if( !active.contains( categoryId )){

                    continue; // skip this category please!

                }                

            }

 

We should be able to do something similar when defining our paletteRoot :-) Please reply to this email and tell me if the above works for you...
-- 
Jody Garnett



The contents of this email are confidential and may be subject to legal or professional privilege and copyright. No representation is made that this email is free of viruses or other defects. If you have received this communication in error, you may not copy or distribute any part of it or otherwise disclose its contents to anyone. Please advise the sender of your incorrect receipt of this correspondence.
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel


Back to the top