Archive

文章標籤 ‘RAP’

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);
	}
});

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: , , , , , ,