Bug 331062 NPE with EModelService's getElementLocation(MUIElement) on a model within a perspective that's not under the application
java.lang.NullPointerException at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.getElementLocation(ModelServiceImpl.java:740)
bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java
return IN_ANY_PERSPECTIVE;
			} else if (parent instanceof MApplication) {
				return OUTSIDE_PERSPECTIVE;
			} else if (parent instanceof MTrimBar) {
				return IN_TRIM;
			} else if (parent == null) {
				EObject container = ((EObject) curElement).eContainer();
				
				if (container instanceof MWindow) {
					MWindow containerWin = (MWindow) container;
					if (containerWin.getSharedElements().contains(curElement))
						return IN_SHARED_AREA;
					EObject containerParent = container.eContainer();
					if (containerParent instanceof MPerspective) {
						int location = IN_ANY_PERSPECTIVE;
						if (((MPerspective) containerParent).getParent().getSelectedElement() == containerParent)
							location |= IN_ACTIVE_PERSPECTIVE;
						return location;
					} else if (containerParent instanceof MWindow)
						return OUTSIDE_PERSPECTIVE;
					else
						return NOT_IN_UI;
				}
			}
			curElement = parent;
		}
		return NOT_IN_UI;
	}
}