try {
// 创建一个线程
Thread thread = new Thread() {
public void run() {
int i = 0;
while(true){
final long start = System.currentTimeMillis();
try {
Thread.sleep(1);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
final int a = i;
if (!Display.getDefault().isDisposed()) {
Runnable runnable = new Runnable() {
public void run() {
processModel.setProcessName(start + "---" + a);
}
};
Display.getDefault().syncExec(runnable);
}
i++;
}
}
};
thread.start();
} catch (Exception e) {
e.printStackTrace();
}