[Dev] access to device props from script tools plugin

Kartick Suriamoorthy ksuriamoorthy at alterpoint.com
Thu Jul 12 11:42:57 CDT 2007


I am trying to come up with a solution for selecting scripts based
on some device properties. So for example, if i have a cisco based
script tool, it should show up only when i right-click on a cisco
device(s).

So my question is, do i have access to device properties in the 
ScriptToolsMenuContributor - see the snippet of code below.

    public void setContext(ActionContext context)
    {
        this.context = context;
        IStructuredSelection  selection = (IStructuredSelection)
context.getSelection();
        isMultiSelect = (selection.size() > 1);

        List tmpList = selection.toList();
        Iterator iter = tmpList.iterator();
        while (iter.hasNext() && !isMultiSelect)
        {
            Object obj = iter.next();
            if (obj instanceof ZDeviceFolder)
            {
                isMultiSelect = true;
            }
        }
    }

Is the IStructuredSelection the list of devices I have selected and
how can I get access to the device's properties.

Cheers,
Kartick Suriamoorthy

ZipTie Community Manager
http://www.ziptie.org/ 



More information about the Dev mailing list