Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » thread of Program
thread of Program [message #467366] Mon, 30 January 2006 13:49 Go to next message
Eclipse UserFriend
Originally posted by: ingo.siebertNOSPAM.cas.de

Hi,

first, i want to open a text file. That's working very nice with the
Program class.

Second, i want to know, if the text file has been changed.

But the Program class isn't halting and doesn't return a thread of the
text editor program. Any idea how to solve that problem?

Cheers,

Ingo
Re: thread of Program [message #467378 is a reply to message #467366] Mon, 30 January 2006 19:31 Go to previous message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Ingo Siebert wrote:

> Hi,
>
> first, i want to open a text file. That's working very nice with the
> Program class.
>
> Second, i want to know, if the text file has been changed.
>
> But the Program class isn't halting and doesn't return a thread of the
> text editor program. Any idea how to solve that problem?
>
> Cheers,
>
> Ingo
Ingo,
try with jdk Runtime classes - you can start process (program) and
wait for process had terminated - then check status of your text file
Re: thread of Program [message #467382 is a reply to message #467378] Mon, 30 January 2006 19:08 Go to previous message
Eclipse UserFriend
Originally posted by: ingo.siebertNOSPAM.cas.de

Hi,

i tried that before, but i didn't get it work. The message "editor
really ended." is display as soon as the text editor is startet.

final Thread t = new Thread(new Runnable() {
public void run() {
Program p = Program.findProgram(".txt");
p.execute("c:/test.txt");
System.out.println("end: editor launch.");
}
});
t.start();

Thread t2 = new Thread(new Runnable() {
public void run() {
while(!t.getState().equals(State.TERMINATED)) {}
while(t.isAlive()) {}
System.out.println("editor really ended.");
}
});
t2.start();

Cheers,

Ingo

Haris Peco schrieb:
> Ingo Siebert wrote:
>
>> Hi,
>>
>> first, i want to open a text file. That's working very nice with the
>> Program class.
>>
>> Second, i want to know, if the text file has been changed.
>>
>> But the Program class isn't halting and doesn't return a thread of the
>> text editor program. Any idea how to solve that problem?
>>
>> Cheers,
>>
>> Ingo
> Ingo,
> try with jdk Runtime classes - you can start process (program) and
> wait for process had terminated - then check status of your text file
Previous Topic:Dynamically Change Layout
Next Topic:FOCUS
Goto Forum:
  


Current Time: Tue Oct 22 19:31:36 GMT 2019

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

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

Back to the top