[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Accessing the DOM of a SWT Browser

my problem is to have a JTree to display the DOMTree, and right-click
menus to add/remove/rename DOM nodes.
as far as i understand, the only values you can get from a javascript
call are basic types (Strings, boolean, etc).
I could create a javascript function that returns a textual
representation of the full DOM tree.
Then I create a TreeModel by parsing this textual  representation and
create TreeNodes accordingly.

But when the user is right-clicks a tree element, I have no way to
reference the corresponding DOM node in the browser.

So I probably can hack a display feature, but not an update feature.

Any opinion about that?


On Wed, Jul 13, 2011 at 3:21 PM, Grant Gayed <Grant_Gayed@xxxxxxxxxx> wrote:
> Hi Olivier,
>
> To access the DOM without using JavaXPCOM you need to execute/evaluate
> javascript.  For examples of this see:
>
> http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet308.java?view=co
> http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet159.java?view=co
> http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet303.java?view=co
> (note that this example should use a BrowserFunction to call back into java
> rather than setting window.status)
>
> There's also a feature request for java interfaces to do this directly, see
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=57477 .
>
> Grant
>
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
>
>