Hi Jody, I picked this up from John but have not had too much luck with it.
In case it helps, the categories are: net.refractions.udig.tool.category.zoom net.refractions.udig.tool.category.pan net.refractions.udig.tool.category.selection net.refractions.udig.tool.category.info net.refractions.udig.tool.edit.edit net.refractions.udig.tool.edit.create net.refractions.udig.tool.edit.feature The defined context ids are along the lines of: org.eclipse.ui.contexts.dialog org.eclipse.ui.contexts.dialogAndWindow net.refractions.udig.catalog.ui.serviceModifySet org.eclipse.ui.NavigateActionSet net.refractions.udig.project.ui.layerModifySet net.refractions.udig.catalog.ui.resourceModifySet net.refractions.udig.project.ui.OpenProjectSet So because of this, the first if condition is never met (if( contextService.getDefinedContextIds().contains(categoryId))) 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. Scott. From: [email protected] [mailto:[email protected]] 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
