Skip to content

Commit 7559164

Browse files
committed
Don't run in NPE if application is not available in BindingTable
Before #2859 `org.eclipse.e4.ui.bindings.tests` manage to run without application instance created/set in the global context, because `core-test` (and not `ui-test`) was used in org.eclipse.e4.ui.bindings.tests/test.xml. Thus `org.eclipse.test.coretestapplication` was used to run bindings tests, not `org.eclipse.test.uitestapplication`. Later one uses `org.eclipse.ui.ide.workbench` application by default which runs `E4Application.createE4Workbench()` and that one will create and set application via `E4Workbench.getServiceContext().set(MApplication.class, appModel);`. For now there is no reason to change this behavior, we can simply allow application to be null in BindingTable which should not affect its behavior in a context that has no application defined. Fixes #2872
1 parent 9cd93e5 commit 7559164

File tree

1 file changed

+1
-1
lines changed
  • bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/internal

1 file changed

+1
-1
lines changed

bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/internal/BindingTable.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ private boolean isActive(final Binding binding) {
376376
return false;
377377
}
378378
String identifierId = command.getId();
379-
if (contributionFactory == null) {
379+
if (contributionFactory == null && application != null) {
380380
contributionFactory = application.getContext().get(IContributionFactory.class);
381381
}
382382
if (contributionFactory == null) {

0 commit comments

Comments
 (0)