Bug 343295 Maximize throws NPE if no editor area or perspectives
java.lang.NullPointerException at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.match(ModelServiceImpl.java:63) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.findElementsRecursive(ModelServiceImpl.java:86) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.findElements(ModelServiceImpl.java:165) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.find(ModelServiceImpl.java:201) at org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon.maximize(MinMaxAddon.java:421) at org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon$5.handleEvent(MinMaxAddon.java:246) at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41) at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:179) at org.eclipse.swt.widgets.Display.syncExec(Display.java:4681) at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:182) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135) at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39) at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:81) at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380) at org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(EcoreEList.java:255) at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:310) at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:307) at org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon.setState(MinMaxAddon.java:173) at org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon.access$0(MinMaxAddon.java:159) at org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon$1.maximize(MinMaxAddon.java:87) at org.eclipse.e4.ui.widgets.CTabFolder.onSelection(CTabFolder.java:1915) at org.eclipse.e4.ui.widgets.CTabFolder$1.handleEvent(CTabFolder.java:275)
bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/MinMaxAddon.java
/**
	 * The identifier for the shared area in the Eclipse Platform. This value should be identical to
	 * the value defined in org.eclipse.ui.IPageLayout.ID_EDITOR_AREA.
	 */
	private static final String ID_EDITOR_AREA = "org.eclipse.ui.editorss"; 
	private static String trimURI = "platform:/plugin/org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.minmax.TrimStack"; 
	static String ID_SUFFIX = "(minimized)"; 
	
	public static String MINIMIZED = "Minimized"; 
	public static String MAXIMIZED = "Maximized"; 
	public static String MINIMIZED_BY_ZOOM = "MinimizedByZoom"; 
	@Inject
	IEventBroker eventBroker;
	@Inject
	EModelService modelService;
	@Inject
	private IEclipseContext context;
	private CTabFolder2Adapter CTFButtonListener = new CTabFolder2Adapter() {
		private MUIElement getElementToChange(CTabFolderEvent event) {
			CTabFolder ctf = (CTabFolder) event.widget;
			MUIElement element = (MUIElement) ctf.getData(AbstractPartRenderer.OWNING_ME);
			MUIElement parentElement = element.getParent();
			return parentElement instanceof MArea ? parentElement : element;
		}
		public void maximize(CTabFolderEvent event) {
			setState(getElementToChange(event), MAXIMIZED);
		}