Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 363565 - Open Standard-Dialog (or any) results in null-pointer
Summary: Open Standard-Dialog (or any) results in null-pointer
Status: RESOLVED DUPLICATE of bug 361877
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-11 05:48 EST by Thomas CLA
Modified: 2012-09-05 02:16 EDT (History)
2 users (show)

See Also:


Attachments
Simple RCP-App raising error in actual release, none in older one (4.72 KB, application/octet-stream)
2011-11-14 09:20 EST, Thomas CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas CLA 2011-11-11 05:48:05 EST
Build Identifier: I20110620-1631

Created e4-RCP. Tried to open an dialog. Because of errors replaced it by JFace MessageDialog. Results in null-pointer-exceptions.
traces by debugger to:
ShellActivationListener (package org.eclipse.e4.ui.internal.workbench.swt)
(org.eclipse.e4.ui.workbench.swt.source._0.10.0.v20110613-2030.jar)
>>
EContextService contextService = context.get(EContextService.class);		contextService.activateContext(EBindingService.DIALOG_CONTEXT_ID);
>>
contextService is null.

With an older Version (I20100922-0843) (jar file version 0.9.1.v20100909-1100) it works fine.

Reproducible: Always

Steps to Reproduce:
1. New Eclipse-download + E4 Tools + E4 UI from e4/updates/0.11
2. New OSGI-Project, product and aplication-model
3. Handler for dialog
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, IEclipseContext context)
{
MessageDialog.openQuestion(shell,"Dialog","Question?");	
}
4. DirectMenuItem
5. MainWindow and menu shows; error, when selecting entry
Comment 1 Remy Suen CLA 2011-11-14 08:03:17 EST
Could you please zip up your project and attach it to this bug?
Comment 2 Thomas CLA 2011-11-14 09:20:55 EST
Created attachment 206946 [details]
Simple RCP-App raising error in actual release, none in older one

Steps of creation:
File > New > Project … and select Plug-in Development > Plug-in
Project
Target Platform: OSGI framework Equinox
No activator
---------------------------------------
Add a dependency on “org.eclipse.equinox.app“
---------------------------------------
Overview > Extensions > Add > "org.eclipse.core.runtime.products"
New product
New property appName value ...
New property applicationXMI value ... Application.e4xmi
---------------------------------------
File > New > Other” and select “e4 > Model > New Application Model”
---------------------------------------
(Application.e4xmi) Windows > new Trimmed Window > MainMenu true
---------------------------------------
New Product Configuration
Application: org.eclipse.e4.ui.workbench.swt.E4Application
---------------------------------------
Add Dependencies
-created Plug-In
-org.eclipse.equinox.ds
-org.eclipse.equinox.event
-org.eclipse.e4.ui.workbench.renderers.swt
>Add Required Plug-ins
---------------------------------------
(Application.e4xmi) Main Menu > new Menu
---------------------------------------
(Application.e4xmi) Menu > DirectMenuItem
---------------------------------------
CreateClass with handler
---------------------------------------
>Some Dependencies ...
---------------------------------------
Error on 4.2, not with older version
Comment 3 Remy Suen CLA 2011-11-14 10:00:39 EST
You need these addons in 4.2 for the application to run.

<addons xmi:id="_XGB3wPZlEd-XstlTZ6nTXg" elementId="org.eclipse.e4.core.commands.service" contributionURI="platform:/plugin/org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"/>
<addons xmi:id="_XGB3wPZlEd-XstlTZ6nTXh" elementId="org.eclipse.e4.ui.contexts.service" contributionURI="platform:/plugin/org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"/>
<addons xmi:id="_XGB3wPZlEd-XstlTZ6nTXi" elementId="org.eclipse.e4.ui.bindings.service" contributionURI="platform:/plugin/org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"/>
<addons xmi:id="_LK0NgPZmEd-XstlTZ6nTXj" elementId="org.eclipse.e4.ui.workbench.commands.model" contributionURI="platform:/plugin/org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon"/>
<addons xmi:id="_LK0NgPZmEd-XstlTZ6nTXk" elementId="org.eclipse.e4.ui.workbench.contexts.model" contributionURI="platform:/plugin/org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon"/>
<addons xmi:id="_LK0NgPZmEd-XstlTZ6nTXl" elementId="org.eclipse.e4.ui.workbench.bindings.model" contributionURI="platform:/plugin/org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon"/>
Comment 4 Paul Webster CLA 2011-11-14 10:18:40 EST

*** This bug has been marked as a duplicate of bug 361877 ***
Comment 5 Thomas CLA 2012-09-05 02:16:12 EDT
Didn't understand the problem of bug 361877 completely but the problem with the dialogs I've reported has been solved with Remy Suens answer.
Current Eclipse adds them by default if you don't deactivate the corresponding checkbox while creating a new application model -e4xmi- by wizard.