Lines 197-202
Link Here
|
197 |
* @return <code>true</code> if close succeeded |
197 |
* @return <code>true</code> if close succeeded |
198 |
*/ |
198 |
*/ |
199 |
protected boolean closeLast () { |
199 |
protected boolean closeLast () { |
|
|
200 |
//#19687 it should be invariant! |
201 |
if ( support == null ) { |
202 |
return true; |
203 |
} |
204 |
|
200 |
if (!!! support.canClose()) { |
205 |
if (!!! support.canClose()) { |
201 |
// if we cannot close the last window |
206 |
// if we cannot close the last window |
202 |
return false; |
207 |
return false; |
Lines 240-245
Link Here
|
240 |
protected void componentActivated () { |
245 |
protected void componentActivated () { |
241 |
super.componentActivated(); |
246 |
super.componentActivated(); |
242 |
|
247 |
|
|
|
248 |
//#19687 it should be invariant! |
249 |
if ( explorerPanel == null ) { |
250 |
return; |
251 |
} |
252 |
|
243 |
try { |
253 |
try { |
244 |
Method explorerPanelComponentActivatedMethod = ExplorerPanel.class.getDeclaredMethod ("componentActivated", null); // NOI18N |
254 |
Method explorerPanelComponentActivatedMethod = ExplorerPanel.class.getDeclaredMethod ("componentActivated", null); // NOI18N |
245 |
explorerPanelComponentActivatedMethod.setAccessible (true); |
255 |
explorerPanelComponentActivatedMethod.setAccessible (true); |
Lines 258-263
Link Here
|
258 |
protected void componentDeactivated () { |
268 |
protected void componentDeactivated () { |
259 |
super.componentDeactivated(); |
269 |
super.componentDeactivated(); |
260 |
|
270 |
|
|
|
271 |
//#19687 it should be invariant! |
272 |
if ( explorerPanel == null ) { |
273 |
return; |
274 |
} |
275 |
|
261 |
try { |
276 |
try { |
262 |
Method explorerPanelComponentDeactivatedMethod = ExplorerPanel.class.getDeclaredMethod ("componentDeactivated", null); // NOI18N |
277 |
Method explorerPanelComponentDeactivatedMethod = ExplorerPanel.class.getDeclaredMethod ("componentDeactivated", null); // NOI18N |
263 |
explorerPanelComponentDeactivatedMethod.setAccessible (true); |
278 |
explorerPanelComponentDeactivatedMethod.setAccessible (true); |
Lines 272-277
Link Here
|
272 |
} |
287 |
} |
273 |
|
288 |
|
274 |
|
289 |
|
|
|
290 |
/** |
291 |
* Test top component validity. For invalid ones return <code>null</code>. |
292 |
*/ |
293 |
protected Object writeReplace() throws ObjectStreamException { |
294 |
|
295 |
//#19687 it should be invariant! |
296 |
if (support == null) { |
297 |
return null; |
298 |
} |
299 |
|
300 |
// #24350 do not write down data for invalid data objects |
301 |
DataObject dataObject = support.getDataObject(); |
302 |
if (dataObject.isValid() == false) { |
303 |
return null; |
304 |
} |
305 |
|
306 |
return super.writeReplace(); |
307 |
} |
308 |
|
275 |
/** Serialize this top component. |
309 |
/** Serialize this top component. |
276 |
* Subclasses wishing to store state must call the super method, then write to the stream. |
310 |
* Subclasses wishing to store state must call the super method, then write to the stream. |
277 |
* @param out the stream to serialize to |
311 |
* @param out the stream to serialize to |
Lines 280-290
Link Here
|
280 |
if ( DEBUG ) Util.debug("TreeEditorComponent.writeExternal()"); // NOI18N |
314 |
if ( DEBUG ) Util.debug("TreeEditorComponent.writeExternal()"); // NOI18N |
281 |
|
315 |
|
282 |
super.writeExternal (out); |
316 |
super.writeExternal (out); |
283 |
|
|
|
284 |
if (support == null) { //!!! it should be invariant! |
285 |
return; //#19687 |
286 |
} |
287 |
|
288 |
out.writeObject (support.getEnv()); |
317 |
out.writeObject (support.getEnv()); |
289 |
|
318 |
|
290 |
if ( DEBUG ) Util.debug("\tdone."); // NOI18N |
319 |
if ( DEBUG ) Util.debug("\tdone."); // NOI18N |
Lines 299-306
Link Here
|
299 |
|
328 |
|
300 |
super.readExternal (in); |
329 |
super.readExternal (in); |
301 |
|
330 |
|
302 |
TreeEditorSupport.Env env = (TreeEditorSupport.Env) in.readObject(); |
331 |
try { |
303 |
support = (TreeEditorSupport) env.findTreeEditorSupport(); |
332 |
TreeEditorSupport.Env env = (TreeEditorSupport.Env) in.readObject(); |
|
|
333 |
support = (TreeEditorSupport) env.findTreeEditorSupport(); |
334 |
} catch (OptionalDataException exc) { //!!! is should be invariant (see writeExternal) |
335 |
if ( exc.eof == true ) { // caused because 'out.writeObject (support.getEnv());' was not called |
336 |
return; // #20487 |
337 |
} else { |
338 |
throw exc; |
339 |
} |
340 |
} catch (ClassCastException exc) { // env.findTreeEditorSupport(); // #20145 |
341 |
return; |
342 |
} |
304 |
|
343 |
|
305 |
if (!!! ((DataObject)getXMLDataObjectLook()).isValid() ) { |
344 |
if (!!! ((DataObject)getXMLDataObjectLook()).isValid() ) { |
306 |
return; |
345 |
return; |