[platform-dev] Problem with Global Selection Lookup

  • From: "kosmos890" < >
  • To:
  • Subject: [platform-dev] Problem with Global Selection Lookup
  • Date: Wed, 31 Oct 2012 09:42:47 -0400

@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] Problem with Global Selection Lookup

kosmos890 10/29/2012

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

Benno Markiewicz 10/29/2012

[platform-dev] Problem with Global Selection Lookup

kosmos890 10/29/2012

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

Frédéric Deniger 10/30/2012

[platform-dev] Problem with Global Selection Lookup

kosmos890 10/30/2012

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

Frédéric Deniger 10/31/2012

[platform-dev] Problem with Global Selection Lookup

kosmos890 10/31/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 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close