// 
//     Licensed to the Apache Software Foundation (ASF) under one
//     or more contributor license agreements.  See the NOTICE file
//     distributed with this work for additional information
//     regarding copyright ownership.  The ASF licenses this file
//     to you under the Apache License, Version 2.0 (the
//     "License"); you may not use this file except in compliance
//     with the License.  You may obtain a copy of the License at
// 
//       http://www.apache.org/licenses/LICENSE-2.0
// 
//     Unless required by applicable law or agreed to in writing,
//     software distributed under the License is distributed on an
//     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
//     KIND, either express or implied.  See the License for the
//     specific language governing permissions and limitations
//     under the License.
//

= DevFaqWindowsTopComponentLookup
:jbake-type: wiki
:jbake-tags: wiki, devfaq, needsreview
:jbake-status: published
:keywords: Apache NetBeans wiki DevFaqWindowsTopComponentLookup
:description: Apache NetBeans wiki DevFaqWindowsTopComponentLookup
:toc: left
:toc-title:
:syntax: true

=== Why does `TopComponent` have a `getLookup()` method? What is it for?

The windowing system is what manages link:DevFaqTrackGlobalSelection.asciidoc[global selection].  In olden times, selection meant the activated link:DevFaqWhatIsANode.asciidoc[Node].

In modern NetBeans, the global selection is really whatever objects are in the focused  `link:DevFaqWindowsTopComponent.asciidoc[TopComponent]`'s link:DevFaqLookup.asciidoc[Lookup].  It so happens that most standard TopComponents display `link:DevFaqWhatIsANode.asciidoc[Node]`s - so for most `TopComponent`s, the component's `Lookup` is just proxying the `Lookup` of the selected Node.

Rather than thinking of the selection as some specific object or Node, it is more useful to think of it as a grab bag of stuff provided by whatever component happens to have focus.  If you use `link:DevFaqTrackGlobalSelection.asciidoc[Utilities.actionsGlobalContext()]`, you do not have to track all the different grab-bags of stuff provided by different components - you can get one grab bag of stuff which whose content will simply change (notifying you in the process) when focus moves to a different component.

So the `TopComponent`'s `Lookup` is a way to provide your particular grab bag of stuff - it can be the lookup of a `Node` if you want, or it can be/contain whatever else or in addition you'd like to put there.

=== Apache Migration Information

The content in this page was kindly donated by Oracle Corp. to the
Apache Software Foundation.

This page was exported from link:http://wiki.netbeans.org/DevFaqWindowsTopComponentLookup[http://wiki.netbeans.org/DevFaqWindowsTopComponentLookup] , 
that was last modified by NetBeans user Admin 
on 2009-11-06T16:06:27Z.


*NOTE:* This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.
