Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Why figure.setforegroundcolor(ColorConstant.yellow) can not execute!
Why figure.setforegroundcolor(ColorConstant.yellow) can not execute! [message #146869] Mon, 09 August 2004 08:23 Go to next message
Eclipse UserFriend
Originally posted by: lhw.accelicon.com

A method highlighted all the RectangleFigures in the given list:
************************************************************ ************
public static void highlightInst(List instances){
deHighlightAll();
for (Iterator iter = instances.iterator(); iter.hasNext();) {
RectangleFigure element = (RectangleFigure) iter.next();
element.setForegroundColor(ColorConstants.yellow);
element.setLineWidth(5);
}
}
************************************************************ ************
The question is:
Sometimes if(instances.size>0),when the first RectangleFigrue execute
element.setForegroundColor(ColorConstants.yellow),the "for" loop stopped.
"element.setLineWidth(5)"can not be execute,the other RectangleFigues in
the list lose the opportunity to change their forgroundcolor and
linewidth too.
these codes is in a receiveTread which receive information about which
figures should be highlighted.!
Re: Why figure.setforegroundcolor(ColorConstant.yellow) can not execute! [message #146881 is a reply to message #146869] Mon, 09 August 2004 14:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

"lhw" <lhw@accelicon.com> wrote in message news:cf7ca2$8ge$1@eclipse.org...
> A method highlighted all the RectangleFigures in the given list:
> ************************************************************ ************
> public static void highlightInst(List instances){
> deHighlightAll();
> for (Iterator iter = instances.iterator(); iter.hasNext();) {
> RectangleFigure element = (RectangleFigure) iter.next();
> element.setForegroundColor(ColorConstants.yellow);
> element.setLineWidth(5);
> }
> }
> ************************************************************ ************
> The question is:
> Sometimes if(instances.size>0),when the first RectangleFigrue execute
> element.setForegroundColor(ColorConstants.yellow),the "for" loop stopped.

What does stopped mean? Does it throw an exception?

> "element.setLineWidth(5)"can not be execute,the other RectangleFigues in
> the list lose the opportunity to change their forgroundcolor and
> linewidth too.
> these codes is in a receiveTread which receive information about which
> figures should be highlighted.!
>
>
Re: Why figure.setforegroundcolor(ColorConstant.yellow) can not execute! [message #147018 is a reply to message #146881] Tue, 10 August 2004 01:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lhw.accelicon.com

Randy Hudson wrote:

> "lhw" <lhw@accelicon.com> wrote in message news:cf7ca2$8ge$1@eclipse.org...
> > A method highlighted all the RectangleFigures in the given list:
> > ************************************************************ ************
> > public static void highlightInst(List instances){
> > deHighlightAll();
> > for (Iterator iter = instances.iterator(); iter.hasNext();) {
> > RectangleFigure element = (RectangleFigure) iter.next();
> > element.setForegroundColor(ColorConstants.yellow);
> > element.setLineWidth(5);
> > }
> > }
> > ************************************************************ ************
> > The question is:
> > Sometimes if(instances.size>0),when the first RectangleFigrue execute
> > element.setForegroundColor(ColorConstants.yellow),the "for" loop stopped.

> What does stopped mean? Does it throw an exception?

> > "element.setLineWidth(5)"can not be execute,the other RectangleFigues in
> > the list lose the opportunity to change their forgroundcolor and
> > linewidth too.
> > these codes is in a receiveTread which receive information about which
> > figures should be highlighted.!
> >
> >

"stopped"mean in the receiveThread I can not set figure's
foregroundcolor successfully!The statement after the "setForgroundColor()"
can not be execute.but there is not any exception throw!why?
In the receiveThread I can not set the figures's forrgroundcolor which
belong to the main Thread ?
Re: Why figure.setforegroundcolor(ColorConstant.yellow) can not execute! [message #147025 is a reply to message #147018] Tue, 10 August 2004 02:19 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

You must access figures only from the UI thread. Use
Display.getDefault().asyncExec() or syncExec()
"lhw" <lhw@accelicon.com> wrote in message news:cf97fm$3r8$1@eclipse.org...
> Randy Hudson wrote:
>
> > "lhw" <lhw@accelicon.com> wrote in message
news:cf7ca2$8ge$1@eclipse.org...
> > > A method highlighted all the RectangleFigures in the given list:
> > >
************************************************************ ************
> > > public static void highlightInst(List instances){
> > > deHighlightAll();
> > > for (Iterator iter = instances.iterator(); iter.hasNext();) {
> > > RectangleFigure element = (RectangleFigure) iter.next();
> > > element.setForegroundColor(ColorConstants.yellow);
> > > element.setLineWidth(5);
> > > }
> > > }
> > >
************************************************************ ************
> > > The question is:
> > > Sometimes if(instances.size>0),when the first RectangleFigrue
execute
> > > element.setForegroundColor(ColorConstants.yellow),the "for" loop
stopped.
>
> > What does stopped mean? Does it throw an exception?
>
> > > "element.setLineWidth(5)"can not be execute,the other RectangleFigues
in
> > > the list lose the opportunity to change their forgroundcolor and
> > > linewidth too.
> > > these codes is in a receiveTread which receive information about
which
> > > figures should be highlighted.!
> > >
> > >
>
> "stopped"mean in the receiveThread I can not set figure's
> foregroundcolor successfully!The statement after the "setForgroundColor()"
> can not be execute.but there is not any exception throw!why?
> In the receiveThread I can not set the figures's forrgroundcolor which
> belong to the main Thread ?
>
Previous Topic:R4C: Need a grid layout in draw2d
Next Topic:Workflow sample for 3.0?
Goto Forum:
  


Current Time: Thu Mar 28 10:30:27 GMT 2024

Powered by FUDForum. Page generated in 0.03902 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top