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 |
} |