Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundles/org.eclipse.e4.ui.workbench/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.e4.ui.workbench;singleton:=true
Bundle-Version: 1.18.300.qualifier
Bundle-Version: 1.18.400.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ private void runProcessor(IConfigurationElement ce) {
ContextInjectionFactory.invoke(o, Execute.class, context, localContext, null);
}
} catch (Exception e) {
warn("Could not run processor: {}", e); //$NON-NLS-1$
error("Could not run processor {}: {}", ce.getAttribute("class"), e); //$NON-NLS-1$//$NON-NLS-2$
}
}

Expand Down Expand Up @@ -731,7 +731,9 @@ private void runProcessor(IModelProcessorContribution processor) {
ContextInjectionFactory.invoke(o, Execute.class, context, localContext, null);
}
} catch (Exception e) {
warn("Could not run processor: {}", e); //$NON-NLS-1$
Class<?> processorClass = processor.getProcessorClass() != null ? processor.getProcessorClass()
: processor.getClass();
error("Could not run processor {}: {}", processorClass.getName(), e); //$NON-NLS-1$
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public class BindingToModelProcessor implements IModelProcessorContribution {

// define dependencies to CommandToModelProcessor and ContextToModelProcessor to
// ensure these two IModelProcessorContributions are registered before this
// BindingToModelProcessor
// BindingToModelProcessor. Both fields are read in process(), removing them
// silently breaks that ordering.

@Reference
private CommandToModelProcessor commandToModelProcessor;
Expand All @@ -66,14 +67,10 @@ void process(final MApplication application, IEclipseContext context) {
gatherCommands(application.getCommands());
gatherTables(application.getBindingTables());

CommandManager commandManager = context.get(CommandManager.class);
if (commandManager == null) {
WorkbenchPlugin.log("Command manager was null in org.eclipse.ui.internal.BindingToModelProcessor"); //$NON-NLS-1$
}
ContextManager contextManager = context.get(ContextManager.class);
if (contextManager == null) {
WorkbenchPlugin.log("Context manager was null in org.eclipse.ui.internal.BindingToModelProcessor"); //$NON-NLS-1$
}
CommandManager commandManager = requirePrerequisite(context, CommandManager.class,
CommandToModelProcessor.class, commandToModelProcessor);
ContextManager contextManager = requirePrerequisite(context, ContextManager.class,
ContextToModelProcessor.class, contextToModelProcessor);
BindingManager bindingManager = new BindingManager(contextManager, commandManager);
context.set(BindingManager.class, bindingManager);
BindingPersistence persistence = new BindingPersistence(bindingManager, commandManager);
Expand All @@ -98,6 +95,25 @@ void process(final MApplication application, IEclipseContext context) {
keys.clear();
}

/**
* Returns the value stored under the given key, failing with a message that
* names the processor expected to have provided it. The provider instance is
* the DS reference that orders this processor after that one.
*/
private static <T> T requirePrerequisite(IEclipseContext context, Class<T> key, Class<?> providerType,
Object provider) {
T value = context.get(key);
if (value == null || provider == null) {
String message = String.format(
"%s did not find %s in the application context. %s must run first; check that its @Reference in %s is still declared and that the OSGi component descriptors of this bundle are up to date.", //$NON-NLS-1$
BindingToModelProcessor.class.getName(), key.getName(), providerType.getName(),
BindingToModelProcessor.class.getSimpleName());
WorkbenchPlugin.log(message);
throw new IllegalStateException(message);
}
return value;
}

private void gatherTables(List<MBindingTable> bindingTables) {
for (MBindingTable table : bindingTables) {
tables.put(table.getBindingContext().getElementId(), table);
Expand Down
Loading