public void propertyChange(PropertyChangeEvent ev) {
if (homePane.lastFocusedComponent != null) {
// Update component which lost focused
JComponent lostFocusedComponent = homePane.lastFocusedComponent;
if (SwingUtilities.isDescendingFrom(lostFocusedComponent, SwingUtilities.getWindowAncestor(homePane))) {
lostFocusedComponent.removeKeyListener(homePane.specialKeysListener);
// Restore previous plan mode if plan view had focus and window is deactivated
if (homePane.previousPlanControllerMode != null
&& (lostFocusedComponent == homePane.controller.getPlanController().getView()
|| ev.getNewValue() == null)) {
homePane.controller.getPlanController().setMode(homePane.previousPlanControllerMode);