[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...


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


public final class OutputTopComponent extends TopComponent implements 
    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()){
          if(o instanceof  org.jsoup.nodes.Element){
             System.out.println("o is an instance of Element");

Console Output


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 
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 146 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20151030.c1dd42a). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
Please Confirm