fluorite-eclipse icon indicating copy to clipboard operation
fluorite-eclipse copied to clipboard

NullPointerException on initialisation on Eclipse Neon 4.6

Open King07 opened this issue 8 years ago • 2 comments

screen shot 2017-06-13 at 09 10 35

The problem occurs on line 418 in the fluorite.model.EventRecorder.java where "Shell shell = Display.getDefault().getActiveShell();" produce a NULL pointer.

Solution: Add the below function to the fluorite.model.EventRecorder.java file and call that function to get the Shell on line 418.

protected Shell getShell() {
    Shell shell = null;

    IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (activeWorkbenchWindow != null) {
        shell = activeWorkbenchWindow.getShell();
    }
    if (shell == null) {
        Display dis = Display.getCurrent();
        if (dis == null) {
            dis = Display.getDefault();
        }
        if (dis != null) {
            shell = dis.getActiveShell();
        }
    }
    if (shell == null) {
        shell = new Shell();
    }
    return shell;
}

King07 avatar Jun 20 '17 12:06 King07

Thanks for reporting! Would you be willing to make a pull request?

yyoon avatar Jun 21 '17 17:06 yyoon

Sure, no problem.

On Wed, Jun 21, 2017 at 7:59 PM, YoungSeok Yoon [email protected] wrote:

Thanks for reporting! Would you be willing to make a pull request?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/yyoon/fluorite-eclipse/issues/1#issuecomment-310158180, or mute the thread https://github.com/notifications/unsubscribe-auth/AHLxObY645HQ7Opi2Wfpnd2iMmezfIf9ks5sGVoVgaJpZM4N_f2g .

King07 avatar Jun 22 '17 10:06 King07