NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
Antonio Posted via mailing list.
|
Posted: Fri Oct 24, 2008 11:02 am Post subject: Detecting closed output windows? |
|
|
Hi all,
I'm using an Output Window for some stuff, and I'd like to free
resources when the window is closed.
Any ideas on how to do this?
Thanks,
Antonio |
|
| Back to top |
|
 |
bruehlicke Posted via mailing list.
|
Posted: Fri Oct 24, 2008 2:09 pm Post subject: Detecting closed output windows? |
|
|
Hmm - similar as I had with windows closed in the Navigation area. I assume you have already thought about having something listening to changes of the Output Window. So if you know how to get to the output window and if the output window has a addChangeListener you could do in the listening class something like
OutoutWindow.findInstance().addChangeListener(WeakListeners.change( this, OutputWindow.findInstance()));
Unfortunately do I not out of my head the "OutoutWindow" name ... and alos if it has a addChangeListener.
After this just act on it in your void stateChanged(ChangeEvent e) method of the listening class ...
B-)
On Fri, Oct 24, 2008 at 6:02 AM, Antonio <address-removed ([email]address-removed[/email])> wrote:
| Quote: | Hi all,
I'm using an Output Window for some stuff, and I'd like to free resources when the window is closed.
Any ideas on how to do this?
Thanks,
Antonio
|
|
|
| Back to top |
|
 |
Antonio Posted via mailing list.
|
Posted: Fri Oct 24, 2008 4:28 pm Post subject: Detecting closed output windows? |
|
|
Hi,
The fact is that I've copied the source code of the Output Window system
and I've build a TopComponent that contains a single "Tab" of the
"OutputWindow". I can now add that TopComponent to any mode I want.
That's the best solution I could find. I know I'll have to maintain it
myself, but well, I can keeps things under control (I've changed the
font to "Courier New", for instance ).
This is under beta now, I may push it to contrib if people is interested
in this.
Cheers,
Antonio
bruehlicke wrote:
| Quote: | Hmm - similar as I had with windows closed in the Navigation area. I
assume you have already thought about having something listening to
changes of the Output Window. So if you know how to get to the output
window and if the output window has a addChangeListener you could do in
the listening class something like
OutoutWindow.findInstance().addChangeListener(WeakListeners.change(
this, OutputWindow.findInstance()));
Unfortunately do I not out of my head the "OutoutWindow" name ... and
alos if it has a addChangeListener.
After this just act on it in your void stateChanged(ChangeEvent e)
method of the listening class ...
B-)
On Fri, Oct 24, 2008 at 6:02 AM, Antonio <address-removed
<mailto:address-removed>> wrote:
Hi all,
I'm using an Output Window for some stuff, and I'd like to free
resources when the window is closed.
Any ideas on how to do this?
Thanks,
Antonio
|
|
|
| Back to top |
|
 |
Wade Chandler Posted via mailing list.
|
Posted: Sat Oct 25, 2008 9:03 pm Post subject: Detecting closed output windows? |
|
|
Antonio,
I see where you did your own thing, but you can also do this using the TopComponent.Registry of the WindowManager. See:
http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/WindowManager.html#getRegistry()
http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.Registry.html#addPropertyChangeListener(java.beans.PropertyChangeListener)
where you can listen for
http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.Registry.html#PROP_TC_CLOSED
also see:
http://java.sun.com/j2se/1.5.0/docs/api/java/beans/PropertyChangeEvent.html#getNewValue()
to get the closed component. Should be a TC I believe...maybe not though.
Wade
==================
Wade Chandler, CCE
Software Engineer and Developer, Certified Forensic Computer Examiner, NetBeans Dream Team Member, and NetBeans Board Member
http://www.certified-computer-examiner.com
http://wiki.netbeans.org/wiki/view/NetBeansDreamTeam
http://www.netbeans.org
----- Original Message ----
| Quote: | From: Antonio <address-removed>
To: address-removed
Sent: Friday, October 24, 2008 7:02:16 AM
Subject: [openide-dev] Detecting closed output windows?
Hi all,
I'm using an Output Window for some stuff, and I'd like to free
resources when the window is closed.
Any ideas on how to do this?
Thanks,
Antonio |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|