org.w3c.dom.Node method calls returning null values [message #699043] |
Wed, 20 July 2011 17:37 |
Ji Kim Messages: 4 Registered: July 2011 |
Junior Member |
|
|
Not sure if the other location or this is where I should post the question, so once I get the answer will edit the content from other forums.
______________________________________________________________________________________
Hello!
So I was playing around with eclipse plugin development, since it seemed interesting, but I ran into a issue of which I thought would be resolved faster by asking the question here.
What is desired is rather simple, namely to get access to selected org.w3c.dom.Node for XHTML + JSP editors. Now I can actually get access to the instance, but when I invoke the various methods [i.e. getLocalName, getNodeName, getNamespaceURI, getPrefix, and etcetera], the values returned are all of null. I initially thought perhaps that I might be doing something wrong in terms of addition of dependencies area, so have started adding incrementally things related to XML but since apparently I wasn't able to resolve it am asking the question here.
Here is a snippet of the content of the handler within plugin.xml:
<enabledWhen>
<with variable="selection">
<iterate>
<and>
<instanceof value="org.w3c.dom.Node">
</instanceof>
</and>
</iterate>
<count value="1" />
</with>
</enabledWhen>
And a testing Handler code:
if(selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = IStructuredSelection.class.cast(
selection );
Activator.logMessage("StructuredSelection " +
structuredSelection.getFirstElement().getClass().getName());
Object element = structuredSelection.getFirstElement();
if(element instanceof Node){
Node nodeRef = Node.class.cast( element );
Activator.logMessage("ToString " + nodeRef.toString());
Activator.logMessage("Specific " + nodeRef.getLocalName() + ", " +
nodeRef.getNodeName() + ", " + nodeRef.getNamespaceURI() + ", " +
nodeRef.getPrefix() + ", ");
}
}
The eclipse environment I am using is of Helios JEE package with the plugins content from the PDE package extracted into the plugins directory for the plugin development.
Thank you, I appreciate any help!
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02390 seconds