Bug 309489 NPE in E4CommandProcessor
I you forget to assign a command to a binding you get: java.lang.NullPointerException at org.eclipse.e4.workbench.ui.internal.E4CommandProcessor.defineBindingTable(E4CommandProcessor.java:142) at org.eclipse.e4.workbench.ui.internal.E4CommandProcessor.processBindings(E4CommandProcessor.java:97) at org.eclipse.e4.workbench.ui.internal.E4Workbench.init(E4Workbench.java:109) at org.eclipse.e4.workbench.ui.internal.E4Workbench.<init>(E4Workbench.java:71) at org.eclipse.e4.ui.workbench.swt.internal.E4Application.createE4Workbench(E4Application.java:170) at org.eclipse.e4.ui.workbench.swt.internal.E4Application.start(E4Application.java:81)
bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4CommandProcessor.java
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.commands.MBindingContext;
import org.eclipse.e4.ui.model.application.commands.MBindingTable;
import org.eclipse.e4.ui.model.application.commands.MBindingTableContainer;
import org.eclipse.e4.ui.model.application.commands.MCommand;
import org.eclipse.e4.ui.model.application.commands.MCommandParameter;
import org.eclipse.e4.ui.model.application.commands.MKeyBinding;
import org.eclipse.e4.ui.model.application.commands.MParameter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EContentAdapter;
import org.eclipse.jface.bindings.Binding;
import org.eclipse.jface.bindings.TriggerSequence;
/**
 *
 */
public class E4CommandProcessor {
	public static void processCommands(IEclipseContext context, List<MCommand> commands) {
		
		Activator.trace(Policy.DEBUG_CMDS, "Initialize commands from model", null); 
		ECommandService cs = (ECommandService) context.get(ECommandService.class.getName());
		Category cat = cs
				.defineCategory(MApplication.class.getName(), "Application Category", null); 
		for (MCommand cmd : commands) {
			IParameter[] parms = null;
			String id = cmd.getElementId();
			String name = cmd.getCommandName();
			List<MCommandParameter> modelParms = cmd.getParameters();
			if (modelParms != null && !modelParms.isEmpty()) {
				ArrayList<Parameter> parmList = new ArrayList<Parameter>();