NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Detecting closed output windows?

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users
View previous topic :: View next topic  
Author Message
Antonio
Posted via mailing list.





PostPosted: Fri Oct 24, 2008 11:02 am    Post subject: Detecting closed output windows? Reply with 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
bruehlicke
Posted via mailing list.





PostPosted: Fri Oct 24, 2008 2:09 pm    Post subject: Detecting closed output windows? Reply with 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 ([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.





PostPosted: Fri Oct 24, 2008 4:28 pm    Post subject: Detecting closed output windows? Reply with quote

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 Very Happy).

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.





PostPosted: Sat Oct 25, 2008 9:03 pm    Post subject: Detecting closed output windows? Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo