Archive

文章標籤 ‘Java’

Eclipse RAP execute javascript

2011年7月21日 Austin 尚無評論

方法一把輸出字串當javascript執行,方法二只是把方法一包到PhaseListener,為什麼要這樣包還不太清楚,所以先用方法一

try {
	RWT.getResponse().getWriter().println("alert('123');");
} catch (IOException ex) {
	ex.printStackTrace();
}
RWT.getLifeCycle().addPhaseListener(new PhaseListener() {
	private static final long serialVersionUID = 1995219943700635190L;

	@Override
	public PhaseId getPhaseId() {
		return PhaseId.RENDER;
	}

	@Override
	public void beforePhase(PhaseEvent event) {
		try {
			RWT.getResponse().getWriter().println("alert('1');");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	@Override
	public void afterPhase(PhaseEvent event) {
		try {
			RWT.getResponse().getWriter().println("alert('2');");
		} catch (IOException e) {
			e.printStackTrace();
		}
		RWT.getLifeCycle().removePhaseListener(this);
	}
});

Develop Google App Engine by Eclipse

2011年4月18日 Austin 尚無評論

Step 1. Install plugin from update site
Eclipse => Help => Install New Software => Add
Name: Google app Engine
Location: http://dl.google.com/eclipse/plugin/3.6

Step 2. Create GAE project
File => New => Project
type filter text: Web Application Project
type project name, package and uncheck "Use Google Toolkit"

Step 3. Specified applications for this project
Package Explorer => this project => war => WEB-INF => appengine-web.xml
<application>name of your application</application>

Step 4. Test and Deploy
Just click the button "Run" or "Deploy App engine project" on toolbar
Test URL: http://localhost:8888/ (Default)
GAE URL: http://name of your application.appspot.com

Categories: Eclipse, Google Tags: , , ,

RAP Login Dialog

2011年4月18日 Austin 尚無評論
public class MyEntryPoint implements IEntryPoint {
    public int createUI() {
        Display display = PlatformUI.createDisplay();
        LoginInfo info = null;
        while (info == null) {
            LogonDialog dialog = new LogonDialog(display.getActiveShell());
            try {
                info = checkLogin(dialog.getUsername(), dialog.getPassword());
            } catch (Exception e) {
                MessageDialog.openError(display.getActiveShell(), "Error", "Logon Fail:\n" + e.getMessage());
            }
        }
        return PlatformUI.createAndRunWorkbench( display, new ApplicationWorkbenchAdvisor());
    }
}
Categories: Eclipse, Java, RAP Tags: , , , , ,

Eclipse for RCP and RAP + GWT + WindowBuilder

2011年2月17日 Austin 尚無評論
Categories: Eclipse, Google, Java, RAP Tags: , , , , , ,