www.pudn.com > talk-plugins.rar > ThreadView.java


package talkServer; 
 
import java.io.IOException; 
 
import org.eclipse.swt.SWT; 
import org.eclipse.swt.layout.GridData; 
import org.eclipse.swt.layout.GridLayout; 
import org.eclipse.swt.widgets.Composite; 
import org.eclipse.swt.widgets.Text; 
import org.eclipse.ui.IViewSite; 
import org.eclipse.ui.PartInitException; 
import org.eclipse.ui.part.ViewPart; 
 
import talkServer.business.ListeningThread; 
 
public class ThreadView extends ViewPart { 
 
	public static final String ID = "talkServer.ThreadView"; 
 
	public Text text; 
	 
	// THREAD HANDLER 
	ListeningThread listeningThread; 
 
	public ThreadView() { 
		super(); 
	} 
 
	public void createPartControl(Composite parent) { 
		Composite top = new Composite(parent, SWT.NONE); 
		top.setLayout(new GridLayout()); 
		GridData gridData = new GridData(GridData.FILL_HORIZONTAL 
				| GridData.FILL_VERTICAL); 
		text = new Text(top,SWT.MULTI | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL); 
		text.setLayoutData(gridData); 
	} 
 
	public void setFocus() { 
	} 
 
	public void init(IViewSite site) throws PartInitException { 
		super.init(site); 
	} 
 
	public void dispose() { 
		super.dispose(); 
		// STOP THE THREAD 
		listeningThread.stop(); 
		// CLOSE THE LISTENING SOCKET 
		try { 
			listeningThread.server_sock.close(); 
		} catch (IOException e) { 
			e.printStackTrace(); 
		} 
		// listeningThread.destroy(); 
		System.out.println("Listening end."); 
	} 
 
}