Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Hourglass!
Hourglass! [message #458839] Fri, 22 July 2005 10:57 Go to next message
mohit is currently offline mohitFriend
Messages: 24
Registered: July 2009
Junior Member
Hi,
Can somebody please throw some light on how do I implement an hourglass to
indicate of wait, when my application takes long time to fetch result or
something else.

Thanks,
Mohit
Re: Hourglass! [message #458840 is a reply to message #458839] Fri, 22 July 2005 11:22 Go to previous messageGo to next message
Robert Bacs is currently offline Robert BacsFriend
Messages: 165
Registered: July 2009
Senior Member
BusyIndicator.showWhile(...);

It's in the org.eclipse.swt.custom package

Regards,
Boby


"Mohit" <mohit.jhawar@gmail.com> wrote in message
news:6eb7ef2fb763d883618ba32611879a6a$1@www.eclipse.org...
> Hi,
> Can somebody please throw some light on how do I implement an hourglass to
> indicate of wait, when my application takes long time to fetch result or
> something else.
>
> Thanks,
> Mohit
>
Re: Hourglass! [message #458841 is a reply to message #458840] Fri, 22 July 2005 11:40 Go to previous messageGo to next message
mohit is currently offline mohitFriend
Messages: 24
Registered: July 2009
Junior Member
It takes Runnable as an argument however, I m not spawning any new thread.
How do i get access to current thread?
forgive me for my naivete.

Thanks,
Mohit
Robert Bacs wrote:


> BusyIndicator.showWhile(...);

> It's in the org.eclipse.swt.custom package

> Regards,
> Boby


> "Mohit" <mohit.jhawar@gmail.com> wrote in message
> news:6eb7ef2fb763d883618ba32611879a6a$1@www.eclipse.org...
>> Hi,
>> Can somebody please throw some light on how do I implement an hourglass to
>> indicate of wait, when my application takes long time to fetch result or
>> something else.
>>
>> Thanks,
>> Mohit
>>
Re: Hourglass! [message #458843 is a reply to message #458841] Fri, 22 July 2005 13:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: pijnmar.home.nl

Something like this?

Cursor cursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(cursor);

....

shell.setCursor(null);
Re: Hourglass! [message #458844 is a reply to message #458841] Fri, 22 July 2005 14:29 Go to previous messageGo to next message
Robert Bacs is currently offline Robert BacsFriend
Messages: 165
Registered: July 2009
Senior Member
Hi,

The runnable which is taken as argument is executed in the same thread,
that is in the GUI thread.
Below is a snippet:

import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

/**
* @author Robert Bacs
*/
public class BusyIndicatorTest {
public static void main(String[] args) {
final Display display = new Display();
final Thread thread = Thread.currentThread();

final Shell shell = new Shell(display);
shell.setLayout(new FillLayout());

System.out.println("Thread1: " + Thread.currentThread());

shell.pack();
shell.open();
shell.layout();

BusyIndicator.showWhile(display, new Runnable(){
public void run() {
if (thread == Thread.currentThread()){
System.out.println("Same thread !!!");
}
}
});

while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}

"Mohit" <mohit.jhawar@gmail.com> wrote in message
news:50a85abd60643189e29c40933b4ff551$1@www.eclipse.org...
> It takes Runnable as an argument however, I m not spawning any new thread.
> How do i get access to current thread?
> forgive me for my naivete.
>
> Thanks,
> Mohit
> Robert Bacs wrote:
>
>
> > BusyIndicator.showWhile(...);
>
> > It's in the org.eclipse.swt.custom package
>
> > Regards,
> > Boby
>
>
> > "Mohit" <mohit.jhawar@gmail.com> wrote in message
> > news:6eb7ef2fb763d883618ba32611879a6a$1@www.eclipse.org...
> >> Hi,
> >> Can somebody please throw some light on how do I implement an hourglass
to
> >> indicate of wait, when my application takes long time to fetch result
or
> >> something else.
> >>
> >> Thanks,
> >> Mohit
> >>
>
Re: Hourglass! [message #458845 is a reply to message #458841] Fri, 22 July 2005 14:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Runnables are not new threads. They are simply packaged methods. They
give you an interface to call into them using the run method. They don't
have to be on a separate thread.

showWhile() simply calls your runnable.run(). It does not need another
thread.

Mohit wrote:
> It takes Runnable as an argument however, I m not spawning any new
> thread. How do i get access to current thread?
> forgive me for my naivete.
>
> Thanks,
> Mohit
> Robert Bacs wrote:
>
>
>> BusyIndicator.showWhile(...);
>
>
>> It's in the org.eclipse.swt.custom package
>
>
>> Regards,
>> Boby
>
>
>
>> "Mohit" <mohit.jhawar@gmail.com> wrote in message
>> news:6eb7ef2fb763d883618ba32611879a6a$1@www.eclipse.org...
>>
>>> Hi,
>>> Can somebody please throw some light on how do I implement an
>>> hourglass to
>>> indicate of wait, when my application takes long time to fetch result or
>>> something else.
>>>
>>> Thanks,
>>> Mohit
>>>
>

--
Thanks,
Rich Kulp
Re: Hourglass! [message #459090 is a reply to message #458841] Mon, 01 August 2005 19:03 Go to previous message
Eclipse UserFriend
Originally posted by: prumao.vero-group.com

Mohit wrote:
> It takes Runnable as an argument however, I m not spawning any new
> thread. How do i get access to current thread?
> forgive me for my naivete.
>
> Thanks,
> Mohit
> Robert Bacs wrote:
>
>
>> BusyIndicator.showWhile(...);
>
>
>> It's in the org.eclipse.swt.custom package
>
>
>> Regards,
>> Boby
>
>
>
>> "Mohit" <mohit.jhawar@gmail.com> wrote in message
>> news:6eb7ef2fb763d883618ba32611879a6a$1@www.eclipse.org...
>>
>>> Hi,
>>> Can somebody please throw some light on how do I implement an
>>> hourglass to
>>> indicate of wait, when my application takes long time to fetch result or
>>> something else.
>>>
>>> Thanks,
>>> Mohit
>>>
>
Have you looked at this snippet?

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet130.java?rev=HEAD& amp;content-type=text/vnd.viewcvs-markup

Regards,

Parag
Previous Topic:tree.indexOf() always returning -1
Next Topic:Knowing if my app is being used
Goto Forum:
  


Current Time: Thu Oct 22 21:46:38 GMT 2020

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

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

Back to the top