This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 214778
Collapse All | Expand All

(-)a/api.search/apichanges.xml (+23 lines)
Lines 105-110 Link Here
105
    <!-- ACTUAL CHANGES BEGIN HERE: -->
105
    <!-- ACTUAL CHANGES BEGIN HERE: -->
106
106
107
    <changes>
107
    <changes>
108
        <change id="SearchResultsDisplayer-closed">
109
            <api name="api.search"/>
110
            <summary>Added method SearchResultsDisplayer.closed()</summary>
111
            <version major="1" minor="1.5"/>
112
            <date day="25" month="6" year="2012"/>
113
            <author login="jhavlin"/>
114
            <compatibility addition="yes"/>
115
            <description>
116
                <p>
117
                    The new <code>SearchResultsDisplayer.closed()</code> is
118
                    called when the results panel is closed by the user. It can
119
                    be overriden to release all resouces held by the panel.
120
                </p>
121
                <p>
122
                    Before this change, <code>HierarchyListener</code>s were
123
                    used to detect detaching of search results panels. But it
124
                    is quite complicated as the panels can be often detached and
125
                    attached again when they are moved from a simple pane to a
126
                    tabbed pane or vice versa.
127
                </p>
128
            </description>
129
            <class package="org.netbeans.spi.search.provider" name="SearchResultsDisplayer"/>
130
        </change>
108
        <change id="UriSupport">
131
        <change id="UriSupport">
109
            <api name="api.search"/>
132
            <api name="api.search"/>
110
            <summary>Support for URI-based searching</summary>
133
            <summary>Support for URI-based searching</summary>
(-)a/api.search/manifest.mf (-1 / +1 lines)
Lines 1-5 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.api.search
2
OpenIDE-Module: org.netbeans.api.search
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/search/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/search/Bundle.properties
4
OpenIDE-Module-Specification-Version: 1.4
4
OpenIDE-Module-Specification-Version: 1.5
5
5
(-)a/api.search/src/org/netbeans/modules/search/ResultDisplayer.java (+5 lines)
Lines 265-268 Link Here
265
    public void setInfoNode(Node infoNode) {
265
    public void setInfoNode(Node infoNode) {
266
        this.infoNode = infoNode;
266
        this.infoNode = infoNode;
267
    }
267
    }
268
269
    @Override
270
    public void closed() {
271
        resultPanel.closed();
272
    }
268
}
273
}
(-)a/api.search/src/org/netbeans/modules/search/ResultView.java (+2 lines)
Lines 279-284 Link Here
279
                rvp.getSearchComposition().terminate();
279
                rvp.getSearchComposition().terminate();
280
            }
280
            }
281
            tabs.remove(panel);
281
            tabs.remove(panel);
282
            rvp.getSearchComposition().getSearchResultsDisplayer().closed();
282
            if (tabs.getTabCount() == 0) {
283
            if (tabs.getTabCount() == 0) {
283
                contentCards.show(this, CARD_NAME_EMPTY);
284
                contentCards.show(this, CARD_NAME_EMPTY);
284
                updateLookup();
285
                updateLookup();
Lines 297-302 Link Here
297
            }
298
            }
298
            singlePanel.remove(comp);
299
            singlePanel.remove(comp);
299
            contentCards.show(this, CARD_NAME_EMPTY);
300
            contentCards.show(this, CARD_NAME_EMPTY);
301
            rvp.getSearchComposition().getSearchResultsDisplayer().closed();
300
            this.repaint();
302
            this.repaint();
301
        } else {
303
        } else {
302
            close();
304
            close();
(-)a/api.search/src/org/netbeans/modules/search/ui/BasicAbstractResultsPanel.java (+4 lines)
Lines 408-411 Link Here
408
            textDetail.showDetail(TextDetail.DH_GOTO);
408
            textDetail.showDetail(TextDetail.DH_GOTO);
409
        }
409
        }
410
    }
410
    }
411
412
    public void closed() {
413
        resultsOutlineSupport.clean();
414
    }
411
}
415
}
(-)a/api.search/src/org/netbeans/modules/search/ui/ResultsOutlineSupport.java (-29 / +2 lines)
Lines 41-47 Link Here
41
 */
41
 */
42
package org.netbeans.modules.search.ui;
42
package org.netbeans.modules.search.ui;
43
43
44
import java.awt.EventQueue;
45
import java.awt.Font;
44
import java.awt.Font;
46
import java.awt.FontMetrics;
45
import java.awt.FontMetrics;
47
import java.awt.Image;
46
import java.awt.Image;
Lines 146-154 Link Here
146
                if ((e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED)
145
                if ((e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED)
147
                        != 0) {
146
                        != 0) {
148
                    if (outlineView.isDisplayable()) {
147
                    if (outlineView.isDisplayable()) {
149
                        onAttach();
148
                        outlineView.expandNode(resultsNode);
150
                    } else {
151
                        checkDetached(this);
152
                    }
149
                    }
153
                }
150
                }
154
            }
151
            }
Lines 164-194 Link Here
164
                Math.max(16, fm.getHeight()) + VERTICAL_ROW_SPACE);
161
                Math.max(16, fm.getHeight()) + VERTICAL_ROW_SPACE);
165
    }
162
    }
166
163
167
    private void onAttach() {
164
    public synchronized void closed() {
168
        outlineView.expandNode(resultsNode);
169
    }
170
171
    /**
172
     * Check whether the search results panel has been removed and, if so,
173
     * remove hierarchy listener and call {@link #onDetach} method.
174
     *
175
     * Method {@link #onDetach()} is not called directly because results panel
176
     * can be detached a attached to another parent container when result tabs
177
     * are created and closed. (TODO: Add panelClosed API method to displayer.)
178
     */
179
    private void checkDetached(final HierarchyListener listenerToRemove) {
180
        EventQueue.invokeLater(new Runnable() {
181
            @Override
182
            public void run() {
183
                if (!outlineView.isDisplayable()) {
184
                    outlineView.removeHierarchyListener(listenerToRemove);
185
                    onDetach();
186
                }
187
            }
188
        });
189
    }
190
191
    private synchronized void onDetach() {
192
        clean();
165
        clean();
193
        saveColumnState();
166
        saveColumnState();
194
    }
167
    }
(-)a/api.search/src/org/netbeans/spi/search/provider/SearchResultsDisplayer.java (+7 lines)
Lines 134-137 Link Here
134
     */
134
     */
135
    public void setInfoNode(Node infoNode) {
135
    public void setInfoNode(Node infoNode) {
136
    }
136
    }
137
138
    /**
139
     * Called right after the displayer is closed. It should be overriden to
140
     * release all held resources. The default implementation does nothing.
141
     */
142
    public void closed() {
143
    }
137
}
144
}

Return to bug 214778