swttest.java

来自「Python Development Environment (Python I」· Java 代码 · 共 70 行

JAVA
70
字号
/*
 * Created on Jan 15, 2006
 */
package org.python.pydev.ui;

import junit.framework.TestCase;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.python.pydev.core.TestDependent;
import org.python.pydev.plugin.PydevPlugin;

public class SWTTest extends TestCase{

    protected Shell shell;
    protected Display display;
    private void createSShell() {
        shell = new org.eclipse.swt.widgets.Shell();
    }

    public void testIt(){
    	
    }
    
    /*
     * @see TestCase#setUp()
     */
    protected void setUp() throws Exception {
        super.setUp();
        PydevPlugin.setBundleInfo(new BundleInfoStub());
        try {
            if(TestDependent.HAS_SWT_ON_PATH){
                display = createDisplay();
                createSShell();
            }
        } catch (UnsatisfiedLinkError e) {
            //ok, ignore it.
            e.printStackTrace();
        }
    }

    /**
     * @return
     */
    protected Display createDisplay() {
        return new Display();
    }

    /*
     * @see TestCase#tearDown()
     */
    protected void tearDown() throws Exception {
        super.tearDown();
        PydevPlugin.setBundleInfo(null);
    }

    /**
     * @param display
     */
    protected void goToManual(Display display) {
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }
        System.out.println("finishing...");
        display.dispose();
    }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?