@Override public void propertyChange(PropertyChangeEvent evt) { if (TopComponent.Registry.PROP_ACTIVATED.equals(evt.getPropertyName())) { Object newValue = evt.getNewValue(); if (newValue instanceof DocumentWindow) { setSelectedWindow((DocumentWindow) newValue); } } else if (TopComponent.Registry.PROP_TC_OPENED.equals(evt.getPropertyName())) { Object newValue = evt.getNewValue(); if (newValue instanceof DocumentWindow) { addOpenedWindow((DocumentWindow) newValue); } } else if (TopComponent.Registry.PROP_TC_CLOSED.equals(evt.getPropertyName())) { Object newValue = evt.getNewValue(); if (newValue instanceof DocumentWindow) { removeOpenedWindow((DocumentWindow) newValue); } } } }
private void notifyActivated(TopComponent topComponent) { NotifiableComponent.get(topComponent).componentActivated(); if (topComponent instanceof DocumentWindow) { DocumentWindowManager.getDefault().setSelectedWindow((DocumentWindow) topComponent); } }
boolean removeOpenedWindow(DocumentWindow documentWindow) { if (openDocumentWindows.remove(documentWindow)) { if (getSelectedWindow() == documentWindow) { setSelectedWindow(null); } boolean isClosed = documentWindow.getTopComponent().close(); if (isClosed) { fireWindowEvent(Event.Type.WINDOW_CLOSED, documentWindow); } return isClosed; } return false; }