[platform-dev] Re: Problem with Global Selection Lookup

  • From: Frédéric Deniger < >
  • To:
  • Subject: [platform-dev] Re: Problem with Global Selection Lookup
  • Date: Thu, 01 Nov 2012 08:27:32 +0100

If you find "Why the condition 'o instanceof org.jsoup.nodes.Element" ' is false, then the question 1) will be resolved :)

Have you checked your dependencies ? May be there are several dependencies containing the class Element.
A quick solution to check it: use the menu "Navigate> Go To type" and search for Element. If you find more than one entry for "org.jsoup.nodes.Element" it could be the problem...

Fred

Le 31/10/2012 14:42, kosmos890 a écrit :
@Fred thanks again.
Listening to any object is an excellent idea!


Code:

//...
public final class OutputTopComponent extends TopComponent implements 
LookupListener{
//..
    private Lookup.Result<Object> result = null;
//..
    public void componentOpened() {
         result = Utilities.actionsGlobalContext().lookupResult(Object.class);
         result.addLookupListener (this);
    }
//..
    public void componentClosed() {
       result.removeLookupListener (this);
       result = null;
    }
//..
    public void resultChanged(LookupEvent ev) {
for(Object o: result.allInstances()){
          System.out.println(o.getClass());
          if(o instanceof  org.jsoup.nodes.Element){
             System.out.println("o is an instance of Element");
          }
       }
    }
//..




Console Output

Code:

class org.jsoup.nodes.Element
class org.openide.nodes.AbstractNode
class org.openide.windows.DelegateActionMap




As you see from the console output, there is an instance of Element class.
But the condition "o instanceof  org.jsoup.nodes.Element" is false!!!???

I have two questions:
1)Why the  Lookup.Result<Element> is empty,  while there are Element 
instances?
2)Why the condition "o instanceof  org.jsoup.nodes.Element" is false ?







[platform-dev] Re: Problem with Global Selection Lookup

Frédéric Deniger 11/01/2012

Project Features

Project Links

About this Project

Platform was started in November 2009, is owned by Antonin Nebuzelsky, and has 138 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close