On Mar 17, 1:58 am, ilomedia <[email protected]> wrote:
> Hi all,
>
> I'm trying to build a simple extension and i must admit that i'm kind
> of lost.
>
> The purpose of my extension is to provide a new panel in which a list
> of the xpath adresses selected in the HTML panel will be kept.
> To make it clearer, i need a new right-click item on an node in the
> HTML panel that would add the xpath adress to an array and when i go
> my new panel i can see the list of copied addresses.
>
> I already built a basic extension that adds my new panel. I also
> managed to add a new right-click item on a node thanks to the
> supportsObject method (though i'm not very pleased with the label
> "inspect in ...").
> When i click on my new inspect item, my panel is displayed but i
> couldn't find the way to get the DOM element selected in the HTML
> panel (and believe me i tried hard).
>
> Here are my questions :
>
> - Which method should i use to retrive this element? I tried to access
> Firebug.HTMLPanel.inspectorHistory, panel.selection, panel.context
> (and other properties) without any success.
Here is some code from bindings.xml mouseOver, with my
interpretations:

Get the meta-object for the graphical rendering object under the
event:
            var object = Firebug.getRepObject(event.target);
            if (object)
            {
Get the type of the meta-object
                var rep = Firebug.getRep(object);
Get the Firefox object that the meta-object represents from the type
object:
                object = rep.getRealObject(object, FirebugContext);
                if (object)
                    Firebug.Inspector.highlightObject(object,
FirebugContext);
            }

>
> - Is using a new panel the right option? Or should i use a sub-panel
> of the HTML panel? I don't think this can be done though since those
> sub-panels seemed to be cleared at each selection.

Some side panels, like Style, synchronize to the main panel selection.
Others, like the Breakpoints side panel, act like alternative indexes
into the main panel. It sounds like that would be a good model for
you.

>
> - Finally, is there another way to add a right-click item in the HTML
> panel (without any hack)

I don't know your eventual goal, but another suggestion: the XPath
side panel could be an "editable history". So the side panel would add
one XPath for every selection in the HTML panel. The user creates the
list by selecting HTML elements rather than right click > add; Each
XPath would have a (x) button on the left to remove the XPath. Mouse
over on the XPath item would highlight the corresponding HTML
object.

Novice users will be able to use the XPath side panel immediately
because it will always have content. Expert users will know to clear
the XPath side panel and then select the HTML nodes they want,
deleting any they add by mistake.

jjb

-- 
You received this message because you are subscribed to the Google Groups 
"Firebug" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/firebug?hl=en.

Reply via email to