1 /*
2  * Created on 09-dic-2005
3  *
4  * TODO To change the template for this generated file go to
5  * Window - Preferences - Java - Code Style - Code Templates
6  */
7 package org.herac.tuxguitar.gui.helper;
8 
9 import org.herac.tuxguitar.util.TGSynchronizer;
10 
11 /**
12  * @author julian
13  *
14  * TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates
15  */
16 public class SyncThread extends Thread {
17 
18 	private TGSynchronizer.TGRunnable runnable;
19 
SyncThread(TGSynchronizer.TGRunnable runnable)20 	public SyncThread(TGSynchronizer.TGRunnable runnable) {
21 		this.runnable = runnable;
22 	}
23 
SyncThread(final Runnable runnable)24 	public SyncThread(final Runnable runnable) {
25 		this(new TGSynchronizer.TGRunnable() {
26 			public void run() throws Throwable {
27 				runnable.run();
28 			}
29 		});
30 	}
31 
run()32 	public void run() {
33 		try {
34 			TGSynchronizer.instance().addRunnable(this.runnable);
35 		} catch (Throwable e) {
36 			e.printStackTrace();
37 		}
38 	}
39 }