From: Taeyoung Son Date: Wed, 14 Dec 2011 07:14:25 +0000 (+0900) Subject: [Title] Create Process Monitor Thread for cancel event check X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3c3fb6ec8dbdb8f3f304a1f590af6b0bb67b6564;p=sdk%2Fide%2Fcommon-eplugin.git [Title] Create Process Monitor Thread for cancel event check [Type] Feature [Module] Sub [Priority] Minor [CQ#] [Redmine#] [Problem] [Cause] [Solution] --- diff --git a/com.samsung.tizen.common/src/com/samsung/tizen/common/util/ProcessMonitorThread.java b/com.samsung.tizen.common/src/com/samsung/tizen/common/util/ProcessMonitorThread.java new file mode 100644 index 0000000..4416344 --- /dev/null +++ b/com.samsung.tizen.common/src/com/samsung/tizen/common/util/ProcessMonitorThread.java @@ -0,0 +1,51 @@ +package com.samsung.tizen.common.util; + +import org.eclipse.core.runtime.IProgressMonitor; + +public class ProcessMonitorThread extends Thread { + + private IProgressMonitor monitor; + private Process proc; + + public ProcessMonitorThread() { + super(); + + this.monitor = null; + this.proc = null; + } + + public ProcessMonitorThread(Process proc, IProgressMonitor monitor) { + this(); + + this.monitor = monitor; + this.proc = proc; + } + + @Override + public void run() { + while(monitor != null) { + if(monitor.isCanceled()) { + if(proc != null) { + proc.destroy(); + monitor.done(); + return; + } + // Does not need to do anything. + } + // Does not need to do anything. + } + } + + public void setMonitor(IProgressMonitor monitor) { + this.monitor = monitor; + } + + public void setProc(Process proc) { + this.proc = proc; + } + + public void setProcessMonitor(Process proc, IProgressMonitor monitor) { + this.monitor = monitor; + this.proc = proc; + } +}