Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Where should I dispose the Image used by Label?
Where should I dispose the Image used by Label? [message #152762] Mon, 04 October 2004 23:52 Go to next message
Eclipse User
Originally posted by: wangwei.org.gmail.com

Hi, all!

If I use a image in a Draw2D Label, where should I dispose it?

I tried to override the paintFigure() method like this:

Image image = new Image(...);
label.setIcon(image);

super.paintFigure(g);

image.dispose();

but got an exception:
"java.lang.IllegalArgumentException: Argument not valid"

Thanks!

regards, wangwei
Re: Where should I dispose the Image used by Label? [message #152905 is a reply to message #152762] Tue, 05 October 2004 16:56 Go to previous messageGo to next message
Eclipse User
Originally posted by: none.us.ibm.com

You should probably keep the image around for the duration of the editor's
existence, or at least as long as the figure exists. Figures are not
disposed, but its editpart is guaranteed to be deactivated, so you can get
rid of the Image at that point. You may want to look into creating a
registry or utility for sharing images across figures/editparts/editors.

"WANG Wei" <wangwei.org@gmail.com> wrote in message
news:cjt5i0$4ic$1@eclipse.org...
> Hi, all!
>
> If I use a image in a Draw2D Label, where should I dispose it?
>
> I tried to override the paintFigure() method like this:
>
> Image image = new Image(...);
> label.setIcon(image);
>
> super.paintFigure(g);
>
> image.dispose();
>
> but got an exception:
> "java.lang.IllegalArgumentException: Argument not valid"
>
> Thanks!
>
> regards, wangwei
>
>
Re: Where should I dispose the Image used by Label? [message #152989 is a reply to message #152905] Wed, 06 October 2004 07:39 Go to previous messageGo to next message
Eclipse User
Originally posted by: wangwei.org.gmail.com

Thank you!

So I think I could override the function EditPart.deactivate(),
Using a registry is also a good idea, and I have created one.


"Randy Hudson" <none@us.ibm.com> wrote in message
news:cjv1gg$s63$1@eclipse.org...
> You should probably keep the image around for the duration of the editor's
> existence, or at least as long as the figure exists. Figures are not
> disposed, but its editpart is guaranteed to be deactivated, so you can get
> rid of the Image at that point. You may want to look into creating a
> registry or utility for sharing images across figures/editparts/editors.
>
> "WANG Wei" <wangwei.org@gmail.com> wrote in message
> news:cjt5i0$4ic$1@eclipse.org...
> > Hi, all!
> >
> > If I use a image in a Draw2D Label, where should I dispose it?
> >
> > I tried to override the paintFigure() method like this:
> >
> > Image image = new Image(...);
> > label.setIcon(image);
> >
> > super.paintFigure(g);
> >
> > image.dispose();
> >
> > but got an exception:
> > "java.lang.IllegalArgumentException: Argument not valid"
> >
> > Thanks!
> >
> > regards, wangwei
> >
> >
>
>
Re: Where should I dispose the Image used by Label? [message #153394 is a reply to message #152989] Fri, 08 October 2004 21:00 Go to previous messageGo to next message
Eclipse User
Originally posted by: wkrain.hotmail.com

hi buddy!
i am form china ,i think you too,so can i make friend with you and
commuciation gef with you ?if it is yes,please send mail to me ,i will very
happy.
"WANG Wei" <wangwei.org@gmail.com> д
Re: Where should I dispose the Image used by Label? [message #153402 is a reply to message #152762] Fri, 08 October 2004 21:19 Go to previous message
Eclipse User
Originally posted by: wkrain.hotmail.com

"WANG Wei" <wangwei.org@gmail.com> д
Previous Topic:Transparent, scalable figures
Next Topic:a boolean and file property type
Goto Forum:
  


Current Time: Wed Jul 23 18:12:44 EDT 2014

Powered by FUDForum. Page generated in 0.03995 seconds