0

I am using Eclipse for RCP and RAP Developers (Oxygen). Upon opening palette it is empty. Even though I have my code in edit mode in the source tab. In the below image palette is empty

As Suggested added the code below.

On opening the Design tab, the palette is empty.

package com.jcg.rca.main;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;

import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
//import org.eclipse.wb.swt.SWTResourceManager;

public class MainWindow {

protected Shell shlLogin;
private Text userNameTxt;
private Text passwordTxt;

private String userName = null;
private String password = null;

/**
 * Launch the application.
 * 
 * @param args
 */
public static void main(String[] args) {
    try {
        MainWindow window = new MainWindow();
        window.open();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

/**
 * Open the window.
 */
public void open() {
    Display display = Display.getDefault();
    createContents();
    shlLogin.open();
    shlLogin.layout();
    while (!shlLogin.isDisposed()) {
        if (!display.readAndDispatch()) {

            display.sleep();

        }
    }
}

/**
 * Create contents of the window.
 */
protected void createContents() {
    shlLogin = new Shell(SWT.CLOSE | SWT.TITLE | SWT.MIN);
    shlLogin.setSize(450, 300);
    shlLogin.setText("Login");

    CLabel label = new CLabel(shlLogin, SWT.NONE);
    //label.setImage(SWTResourceManager.getImage(MainWindow.class, "/com/jcg/rca/main/eclipse_logo.png"));
    label.setBounds(176, 10, 106, 70);
    label.setText("");

    Label lblUsername = new Label(shlLogin, SWT.NONE);
    lblUsername.setBounds(125, 115, 55, 15);
    lblUsername.setText("Username");

    Label lblPassword = new Label(shlLogin, SWT.NONE);
    lblPassword.setBounds(125, 144, 55, 15);
    lblPassword.setText("Password");

    userNameTxt = new Text(shlLogin, SWT.BORDER);
    userNameTxt.setBounds(206, 109, 173, 21);

    passwordTxt = new Text(shlLogin, SWT.BORDER | SWT.PASSWORD);
    passwordTxt.setBounds(206, 144, 173, 21);

    Button btnLogin = new Button(shlLogin, SWT.NONE);
    btnLogin.setBounds(206, 185, 75, 25);
    btnLogin.setText("Login");

    btnLogin.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {

            userName = userNameTxt.getText();
            password = passwordTxt.getText();

            if (userName == null || userName.isEmpty() || password == null || password.isEmpty()) {
                String errorMsg = null;
                MessageBox messageBox = new MessageBox(shlLogin, SWT.OK | SWT.ICON_ERROR);

                messageBox.setText("Alert");
                if (userName == null || userName.isEmpty()) {
                    errorMsg = "Please enter username";
                } else if (password == null || password.isEmpty()) {
                    errorMsg = "Please enter password";
                }
                if (errorMsg != null) {
                    messageBox.setMessage(errorMsg);
                    messageBox.open();
                }
            } else {
                MessageBox messageBox = new MessageBox(shlLogin, SWT.OK | SWT.ICON_WORKING);
                messageBox.setText("Info");
                messageBox.setMessage("Valid");
                messageBox.open();
            }
        }
    });

}}

Below is the palette

.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Vemula Dheeraj
  • 64
  • 1
  • 11

2 Answers2

0

JUST CREATE A SIMPLE JAVA PROJECT. Then I used the Swing > JFrame for the class.

DONT create the project from the one under WindowsBuilder.

enter image description here

Captain Catz
  • 96
  • 1
  • 12
0

Right click on palette box Then select restore default palette

Punit
  • 11
  • 2