Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » org.w3c.dom.Node method calls returning null values
org.w3c.dom.Node method calls returning null values [message #699043] Wed, 20 July 2011 17:37 Go to next message
Ji Kim is currently offline Ji KimFriend
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!
Re: org.w3c.dom.Node method calls returning null values [message #699768 is a reply to message #699043] Fri, 22 July 2011 09:29 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

What did you have selected, and from where, when you observed this?

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: org.w3c.dom.Node method calls returning null values [message #700183 is a reply to message #699768] Sat, 23 July 2011 00:18 Go to previous message
Ji Kim is currently offline Ji KimFriend
Messages: 4
Registered: July 2011
Junior Member
Sorry for wasting your time, but I did find out what the issue was. Whew, due to laziness I was testing out the xhtml, jsp, and etcetera within the plugin project [meaning creating those files within the plugin project, selecting the node, and checking out the output in the logs]. After I got a bit exhausted mucking around w/ dependencies and other incremental changes, I finally tested the plugin code using a sample web project and lo and behold it does return the values that I am looking for.

Thanks very much for your reply, appreciate it much!!! Very Happy

Eh I guess the bright side is I've got to create an Eclipse forum userId.
Previous Topic:org.eclipse.wst.wsdl versus javax.wsdl
Next Topic:Javascript changes in IE9
Goto Forum:
  


Current Time: Fri Apr 19 05:50:14 GMT 2024

Powered by FUDForum. Page generated in 0.02390 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top