Hiding the Window in RAP Applications


One of the frequently asked questions while showing RAP is “how can I hide the window“? Personally, I also find the window-in-a-window metaphor (shown above) somewhat confusing and unusual for a browser based application. Fortunately it is really easy to take care of that by configuring the Shell widget associated with that window, as explained in the rest of the article.

Maximized Window with No Title


To get the result shown above we need to apply the following changes to our WorkbenchWindowAdvisor implementation:

  1. we use the style-bit SWT.NO_TRIM before creating the Shell. This will remove the title-bar, the minimize/maximize/close buttons and the ability for manually resizing the window. 
  2. we overwrite the WorkbenchWindowAdvisor.postWindowCreate() method. Here we set the state of the Shell to maximized.
  3. optional: depending on the requirements and complexity of our application it may be desirable to hide the menu bar by calling getWindowConfigurer().setShowMenuBar( false ). This is usually a good choice for small applications where the menu bar may not be needed.
    public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {   // ...
      public void preWindowOpen() {
        // ...
        getWindowConfigurer().setShellStyle( SWT.NO_TRIM );
        getWindowConfigurer().setShowMenuBar( false );
      public void postWindowCreate() {
        Shell shell = getWindowConfigurer().getWindow().getShell();
        shell.setMaximized( true );

Maximized Window with Plain Title


This is a slight variation of the previous example. We have kept the window maximized but added a title bar. Note that the title bar is missing the usual minimize / maximize / close buttons which do not make much sense in a browser-based application that has only a single workbench window. To get the result shown we used SWT.TITLE style-bit instead of SWT.NO_TRIM:

  public void preWindowOpen() {
    // ...
    getWindowConfigurer().setShellStyle( SWT.TITLE );
Note that is it possible to customize the font and colors in the title bar using the RAP Theming extension point (org.eclipse.rap.ui.themes). So if you don’t like the blue background you can change it. Theming will be a topic in a future blog post. 

3 Responses to “Hiding the Window in RAP Applications”

  1. Chris Aniszczyk (zx) says:

    Nice, I recommend augmenting the RAP PDE templates to include an option to “fullscreen” an application.

  2. Elias Volanakis says:

    Hi Chris,

    great idea; see Bug 209677.


  3. Very useful post!
    Thank you!

3 responses so far

Written by . Published in Categories: EclipseSource News

Looking for a job?

Karlsruhe / Remote
Karlsruhe / Victoria / Remote
Karlsruhe / Victoria / Remote