mardi 6 décembre 2016

Eclipse RAP Dialog throws nullpointer exception during method .open

I use Eclipse RAP to realize a web application. The following code throws a nullpointer exception during execution of the selection listender:

Link link = new Link(composite_2, SWT.NONE);
    link.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    link.setText("<a>Dokument erfassen</a>");
    link.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent arg0) {

            TestDialog dia = new TestDialog(getShell(),
                    SWT.APPLICATION_MODAL);
            dia.open(new DialogCallback() {
                public void dialogClosed(int returnCode) {
                    System.out.println("Stored file: ");
                }
            });
        }
    })

enter image description here

The code of the class TestDialog Looks like the following:

public class TestDialog extends Dialog {

/**
 * 
 */
private static final long serialVersionUID = 1L;


public TestDialog(Shell parent) {
    super(parent);
    // TODO Auto-generated constructor stub
}


public TestDialog(Shell parent, int style) {
    super(parent,style);
    // TODO Auto-generated constructor stub
}

}

If i use the MessageBox class instead of the class TestDialog, everything works fine.

Aucun commentaire:

Enregistrer un commentaire