Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8566001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:33:27+00:00 2026-06-11T17:33:27+00:00

I’ve created an RCP application with an interactive splash for logging onto my system.

  • 0

I’ve created an RCP application with an interactive splash for logging onto my system. I built it on a Mac, and the application works perfectly, but when I created a new product configuration for Windows and run the application, it launches without the splash and there are no errors appearing in the console.

The splash handler code is as follows

/**
 * The splash screen controller for the RCP application. This has been modified to also act as a login screen for the 
 * application. Failure to correctly authenticate results in the application termination.
 */
package com.myproject.plugins.core.splashHandlers;

import java.net.MalformedURLException;

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.splash.AbstractSplashHandler;

/**
 * The splash handler overrides the default RCP splash handler.
 * @since 3.3
 */
public class InteractiveSplashHandler extends AbstractSplashHandler {

    /**
     * Composite container for login form.
     */
    private Composite loginComposite;

    /**
     * Text box input for login username.
     */
    private Text usernameTextBox;

    /**
     * Text box input for login password.
     */
    private Text passwordTextBox;

    /**
     * OK button for submission of the login form.
     */
    private Button okButton;

    /**
     * Cancel button for cancelling the login attempt and exiting the application.
     */
    private Button cancelButton;

    /**
     * Simple boolean flag to store login success/status.
     */
    private boolean isAuthenticated;

    /**
     * SWT form label for username.
     */
    private Label usernameLabel;

    /**
     * SWT form label for password.
     */
    private Label passwordLabel;

    /**
     * Form/layout data for username label. 
     */
    private FormData usernameLabelFormData;

    /**
     * Form/layout data for password label.
     */
    private FormData passwordLabelFormData;

    /**
     * Form/layout data for username text box.
     */
    private FormData usernameTextBoxFormData;

    /**
     * Form/layout data for password text box.
     */
    private FormData passwordTextBoxFormData;

    /**
     * Form/layout data for OK button.
     */
    private FormData okButtonFormData;

    /**
 * Constructor for the splash handler.
     */
    public InteractiveSplashHandler() {
        passwordTextBox = null;
        cancelButton = null;
        isAuthenticated = false;
    }

    /**
     * Initialiser for the splash screen.
     * @see org.eclipse.ui.splash.AbstractSplashHandler#init(org.eclipse.swt.widgets.Shell)
     */
    public void init(final Shell splash) {
        /**
         * Initialising the parent SplashHandler with the splash shell.
         */
        super.init(splash);

        /**
         * Configure the shell UI layout.
         */
        configureUISplash();

        /**
         * Create UI components.
         */
        createUI();

        /**
         * Create UI listeners.
         */
        createUIListeners();

        /**
         * Force the splash screen to layout.
         */
        splash.layout(true);

        /**
         * Keep the splash screen visible and prevent the RCP application from loading until the close button is 
         * clicked.
         */
        doEventLoop();
    }

    /**
     * Create the event loop for the splash to prevent the application load from completion, and hold it at the splash 
     * until the login event is successful.
     */
    private void doEventLoop() {
        Shell splash = getSplash();
        while (isAuthenticated == false) {
            if (splash.getDisplay().readAndDispatch() == false) {
                splash.getDisplay().sleep();
            }
        }
    }

    /**
     * Create the UI listeners for all the form components.
     */
    private void createUIListeners() {
        /**
         * Create the OK button listeners.
         */
        createUIListenersButtonOK();

        /**
         * Create the cancel button listeners.
         */
        createUIListenersButtonCancel();
    }

    /**
     * Listeners setup for the cancel button.
     */
    private void createUIListenersButtonCancel() {
        cancelButton.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                handleButtonCancelWidgetSelected();
            }
        });     
    }

    /**
     * Handles the cancel action by shutting down the RCP application.
     */
    private void handleButtonCancelWidgetSelected() {
        /**
         * Abort the loading of the RCP application.
         */
        getSplash().getDisplay().close();
        System.exit(0);     
    }

    /**
     * Listeners setup for the OK button.
     */
    private void createUIListenersButtonOK() {
        okButton.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                handleButtonOKWidgetSelected();
            }
        });
    }

    /**
     * Handles the OK button being pressed and the login attempted.
     */
    private void handleButtonOKWidgetSelected() {
        String username = usernameTextBox.getText();
        String password = passwordTextBox.getText();

        AuthenticationClient client = new AuthenticationClient();

        if (username.equals("") || password.equals("")) {
            MessageDialog.openError(getSplash(), 
                "Authentication Failed",  //$NON-NLS-1$
                "A username and password must be specified to login.");  //$NON-NLS-1$
        } else {
            try {
                if (client.authenticate(username, password)) {
                    isAuthenticated = true;
                } else {
                    MessageDialog.openError(getSplash(), 
                        "Authentication Failed",  //$NON-NLS-1$
                        "The details you entered could not be verified.");  //$NON-NLS-1$
                }
            } catch (MalformedURLException e) {
                MessageDialog.openError(getSplash(), 
                    "Authentication Failed",  //$NON-NLS-1$
                    "Service responded with an error.");  //$NON-NLS-1$
            }
        }
    }

    /**
     * Calls the individual UI component creation functions.
     */
    private void createUI() {
        /**
         * Create the login panel.
         */
        createUICompositeLogin();

        /**
         * Create the user name label.
         */
        createUILabelUserName();

        /**
         * Create the user name text widget.
         */
        createUITextUserName();

        /**
         * Create the password label.
         */
        createUILabelPassword();

        /**
         * Create the password text widget.
         */
        createUITextPassword();

        /**
         * Create the OK button.
         */
        createUIButtonOK();

        /**
         * Create the cancel button.
         */
        createUIButtonCancel();
    }       

    /**
     * Creates the SWT component for the cancel button.
     */
    private void createUIButtonCancel() {
        /**
         * Create the button.
         */
        cancelButton = new Button(loginComposite, SWT.PUSH);
        okButtonFormData.right = new FormAttachment(cancelButton, -6);

        FormData cancelButtonFormData = new FormData();
        cancelButtonFormData.left = new FormAttachment(0, 392);
        cancelButtonFormData.right = new FormAttachment(100, -10);
        cancelButtonFormData.bottom = new FormAttachment(100, -10);
        cancelButton.setLayoutData(cancelButtonFormData);

        cancelButton.setText("Cancel");
    }

    /**
     * Creates the SWT component for the OK button.
     */
    private void createUIButtonOK() {
        /**
         * Create the button.
         */
        okButton = new Button(loginComposite, SWT.PUSH);
        passwordTextBoxFormData.bottom = new FormAttachment(okButton, -6);

        okButtonFormData = new FormData();
        okButtonFormData.left = new FormAttachment(0, 279);
        okButtonFormData.bottom = new FormAttachment(100, -10);
        okButton.setLayoutData(okButtonFormData);

        okButton.setText("OK");
    }

    /**
     * Creates the SWT component for the password text box.
     */
    private void createUITextPassword() {
        /**
         * Create the text widget.
         */
        int style = SWT.PASSWORD | SWT.BORDER;
        passwordTextBox = new Text(loginComposite, style);

        passwordLabelFormData.right = new FormAttachment(passwordTextBox, -6);

        passwordTextBoxFormData = new FormData();
        passwordTextBoxFormData.right = new FormAttachment(100, -10);
        passwordTextBoxFormData.left = new FormAttachment(0, 279);
        passwordTextBox.setLayoutData(passwordTextBoxFormData);
    }

    /**
     * Creates the SWT component for the password label.
     */
    private void createUILabelPassword() {
        /**
         * Create the label.
         */
        passwordLabel = new Label(loginComposite, SWT.NONE);

        passwordLabelFormData = new FormData();
        passwordLabelFormData.top = new FormAttachment(usernameLabel, 11);
        passwordLabel.setLayoutData(passwordLabelFormData);

        passwordLabel.setText("&Password:");
    }

    /**
     * Creates SWT component for the username text box.
     */
    private void createUITextUserName() {
        /**
         * Create the text widget.
         */
        usernameTextBox = new Text(loginComposite, SWT.BORDER);

        usernameLabelFormData.top = new FormAttachment(usernameTextBox, 3, SWT.TOP);
        usernameLabelFormData.right = new FormAttachment(usernameTextBox, -6);

        usernameTextBoxFormData = new FormData();
        usernameTextBoxFormData.top = new FormAttachment(0, 233);
        usernameTextBoxFormData.right = new FormAttachment(100, -10);
        usernameTextBoxFormData.left = new FormAttachment(0, 279);
        usernameTextBox.setLayoutData(usernameTextBoxFormData);
    }

    /**
     * Creates SWT component for the username label.
     */
    private void createUILabelUserName() {
        /**
         * Create the label
         */
        usernameLabel = new Label(loginComposite, SWT.NONE);
        usernameLabelFormData = new FormData();
        usernameLabel.setLayoutData(usernameLabelFormData);
        usernameLabel.setText("&User Name:");
    }

    /**
     * Creates SWT component for the login composite.
     */
    private void createUICompositeLogin() {
        /**
         * Create the composite and set the layout.
         */
        loginComposite = new Composite(getSplash(), SWT.BORDER);
        loginComposite.setLayout(new FormLayout());
    }

    /**
     * Configures the splash screen SWT/UI components.
     */
    private void configureUISplash() {
        /**
         * Configure layout
         */
        FillLayout layout = new FillLayout(); 
        getSplash().setLayout(layout);

        /**
         * Force shell to inherit the splash background
         */
        getSplash().setBackgroundMode(SWT.INHERIT_DEFAULT);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:33:28+00:00Added an answer on June 11, 2026 at 5:33 pm

    Oddly enough, the bitmap (created in Photoshop/Mac) image was seen as corrupt in Eclipse, but opened fine in all graphics applications (including Photoshop/Win). I opened the file in MS Paint and saved without changes. The splash started working fine.

    Check your bitmap if you get this error!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want to construct a data frame in an Rcpp function, but when I
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.