Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Technology Project and PMC » Problem about User Feedback for Finished Jobs
Problem about User Feedback for Finished Jobs [message #73361] Wed, 16 August 2006 09:47 Go to next message
Cagatay is currently offline Cagatay
Messages: 17
Registered: July 2009
Junior Member
Hello,
I have used the code given in an Eclipse article to give feedback to the
user for finished jobs. But I have a problem.
http://www.eclipse.org/articles/Article-Concurrency/jobs-api .html

When the build job finishes, MessageDialog is shown to give "Your build
process completed" message to the user but it disappears quickly. So,user
can not notice that window. It is shown using asynchExec method but it can
not appear until user presses OK button. I want to show it until the user
presses OK button. So, user will understand from that window that build
completed.
When the window is shown to the user (within milisecs), the thread goes
out from run() method and that window is disposed I think.

Do you have any suggestion to fix this error?

Thank you,
Best wishes
Cagatay

public class BuildJob extends Job {

public BuildJob(String aName) {
super(aName);
}

public IStatus run(IProgressMonitor monitor)
{
try {
String as[] = new String[3];
as[0] = "make";
as[1] = "-f";
as[2] = "Makefile";

ProcessBuilder pb = new ProcessBuilder(as);
Map<String,String> env = pb.environment();
env.put("PATH",env.get("PATH")+":"+/opt/ed";

long start = new Date().getTime();
monitor.beginTask("Building projectnow...",350000);

long current;
int workedTotal = 0;
final Process p = pb.start();
boolean isExited = false;

while(!isExited){
//update the progess bar
current = new Date().getTime();
int workQuant = (int) (current-start-workedTotal);
workedTotal += workQuant;
monitor.subTask("Total: "+workedTotal+" seconds");
monitor.worked(workQuant);

try{
p.exitValue();
isExited = true;
}
catch( IllegalThreadStateException IE){
Thread.sleep(2000);
}
finally
{
if(monitor.isCanceled()){
System.out.println("canceled!!!");
p.destroy();
return Status.CANCEL_STATUS;
}

}

}
monitor.done();
System.out.println("Build finished!!!");
}
catch (Exception e) {
IsyaPlugin.logError("Error ");
}

//inform user about the finish of Project
setProperty(IProgressConstants.ICON_PROPERTY,getName());
if (isModal(this)) {
// if it is modal, it was not run in background.
// The progress dialog is still open so just open the message
showResults();
}
else {
setProperty(IProgressConstants.KEEP_PROPERTY,Boolean.TRUE);

setProperty(IProgressConstants.ACTION_PROPERTY,getBuildCompl etedAction());
}
return Status.OK_STATUS;
}


public boolean isModal(BuildJob job) {
Boolean isModal =
(Boolean)job.getProperty(IProgressConstants.PROPERTY_IN_DIAL OG);
if(isModal == null)
return false;
return isModal.booleanValue();
}

protected static void showResults() {
int i=0;
Display.getDefault().asyncExec(new Runnable() {
public void run() {
getBuildCompletedAction().run();
}
});
}

protected static Action getBuildCompletedAction() {
return new Action("View build status") {
public void run() {
MessageDialog.openInformation(Display.getDefault().getActive Shell(),
"Build Complete",
"Your build process completed!");
}
};
}

}
Re: Problem about User Feedback for Finished Jobs [message #73380 is a reply to message #73361] Wed, 16 August 2006 12:06 Go to previous messageGo to next message
Bjorn Freeman-Benson is currently offline Bjorn Freeman-Benson
Messages: 335
Registered: July 2009
Senior Member
Please ask this question in the eclipse.platform newsgroup.
This newsgroup is for discussions about the Eclipse Foundation
organization rather than the foundations of the Eclipse technology.
Confusing, yes.

Cagatay wrote:
> Hello,
> I have used the code given in an Eclipse article to give feedback to the
> user for finished jobs. But I have a problem.
> http://www.eclipse.org/articles/Article-Concurrency/jobs-api .html
>
Re: Problem about User Feedback for Finished Jobs [message #73397 is a reply to message #73380] Thu, 17 August 2006 04:10 Go to previous message
Cagatay is currently offline Cagatay
Messages: 17
Registered: July 2009
Junior Member
Sorry for the wrong message address.
Kind regards,
Cagatay
Re: Problem about User Feedback for Finished Jobs [message #601021 is a reply to message #73361] Wed, 16 August 2006 12:06 Go to previous message
Bjorn Freeman-Benson is currently offline Bjorn Freeman-Benson
Messages: 335
Registered: July 2009
Senior Member
Please ask this question in the eclipse.platform newsgroup.
This newsgroup is for discussions about the Eclipse Foundation
organization rather than the foundations of the Eclipse technology.
Confusing, yes.

Cagatay wrote:
> Hello,
> I have used the code given in an Eclipse article to give feedback to the
> user for finished jobs. But I have a problem.
> http://www.eclipse.org/articles/Article-Concurrency/jobs-api .html
>
Re: Problem about User Feedback for Finished Jobs [message #601027 is a reply to message #73380] Thu, 17 August 2006 04:10 Go to previous message
Cagatay is currently offline Cagatay
Messages: 17
Registered: July 2009
Junior Member
Sorry for the wrong message address.
Kind regards,
Cagatay
Previous Topic:Problem about User Feedback for Finished Jobs
Next Topic:Source Code Control with Full Unicode that integrates with Eclipse
Goto Forum:
  


Current Time: Sat Apr 19 12:04:07 EDT 2014

Powered by FUDForum. Page generated in 0.01818 seconds