For the record:

            ISelection selection =
PlatformUI.getWorkbench().getActiveWorkbenchWindow()

.getActivePage().findView(LayersView.ID).getSite().getSelectionProvider()
                    .getSelection();
            final List<LayerImpl> selectedLayerList = new
ArrayList<LayerImpl>();
            if (selection instanceof TreeSelection) {
                TreeSelection treeSelection = (TreeSelection) selection;
                Iterator iterator = treeSelection.iterator();
                while( iterator.hasNext() ) {
                    Object object = iterator.next();
                    if (object instanceof LayerImpl) {
                        LayerImpl layer = (LayerImpl) object;
                        selectedLayerList.add(layer);
                    }
                }
            }



Andrea


On Thu, Aug 28, 2008 at 1:32 PM, andrea antonello
<[EMAIL PROTECTED]> wrote:
> Aha, ok I will try that path.
> I didn't understand correctly before.
>
> Thanks,
> Andrea
>
>
> On Thu, Aug 28, 2008 at 1:12 PM, Jesse Eichar <[EMAIL PROTECTED]> wrote:
>> Like I said the LayersView.  Here is some pseudo code:
>>
>> PlatformGIS
>> .getWorkbench
>> ().getActiveWindow
>> ().getActivePage
>> ().findView
>> (LayersView.ID).getSite().getSelectionProvider().getSelection()..
>>
>>
>>
>> Remember to do null pointer checks most of the way down that chain.  And on
>> find view there is a parameter to NOT restore the view to visibility.  Ugly?
>>  Yes.  We need to finish fixing the Map model so that you can have multiple
>> selections.  most of it is done but not all.
>>
>> Jesse
>> On 28-Aug-08, at 11:05 AM, andrea antonello wrote:
>>
>>> Hmmm, but with eclipse selection listeners I can trace them only when
>>> I am already registered as listener.
>>> Imagine one selects the layers he wants to query and then activates
>>> the query tool.
>>> In that moment who can tell me which layers are selected?
>>>
>>> Andrea
>>>
>>>
>>>
>>> On Thu, Aug 28, 2008 at 10:38 AM, Jesse Eichar <[EMAIL PROTECTED]>
>>> wrote:
>>>>
>>>> Not easy unfortunately.  You have to use the eclipse workbench to get the
>>>> selection of the LayersView.  Although I think the selection work Vitali
>>>> did
>>>> might help here but I don't know how hooked up it is.
>>>>
>>>> Jesse
>>>>
>>>> On 28-Aug-08, at 10:27 AM, andrea antonello wrote:
>>>>
>>>>> Hi, how can I get the selected layers from within a tool context?
>>>>>
>>>>> getContext().getSelectedLayer()
>>>>>
>>>>> returns just one, but I want to traverse/query all selected raster
>>>>> maps in one click and return all their values.
>>>>>
>>>>> Is this possible?
>>>>> Andrea
>>>>> _______________________________________________
>>>>> User-friendly Desktop Internet GIS (uDig)
>>>>> http://udig.refractions.net
>>>>> http://lists.refractions.net/mailman/listinfo/udig-devel
>>>>
>>>> _______________________________________________
>>>> User-friendly Desktop Internet GIS (uDig)
>>>> http://udig.refractions.net
>>>> http://lists.refractions.net/mailman/listinfo/udig-devel
>>>>
>>> _______________________________________________
>>> User-friendly Desktop Internet GIS (uDig)
>>> http://udig.refractions.net
>>> http://lists.refractions.net/mailman/listinfo/udig-devel
>>
>> _______________________________________________
>> User-friendly Desktop Internet GIS (uDig)
>> http://udig.refractions.net
>> http://lists.refractions.net/mailman/listinfo/udig-devel
>>
>
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to