private void checkForReset() { assert SwingUtilities.isEventDispatchThread(); if (ec.getOpenedPanes() == null) { //reset: AnnotationsHolder remove; synchronized (file2holders) { remove = file2holders.remove(file); cancelled.set(true); } ec.removePropertyChangeListener(this); if (remove != null) { task.schedule(0); } } else { cancelled.set(false); } }
@Override public void propertyChange( PropertyChangeEvent evt ) { if (EditorCookie.Observable.PROP_OPENED_PANES.endsWith(evt.getPropertyName()) || evt.getPropertyName() == null) { if (myObservable.getOpenedPanes() == null) { myObservable.removePropertyChangeListener(this); Runnable runnable = new Runnable() { @Override public void run() { HELPERS.remove(myDataObject); List<CDIAnnotation> annotations = myModelAnnotations.get(); for (CDIAnnotation annotation : annotations) { annotation.detach(); } annotations = myAnnotations.get(); for( CDIAnnotation annotation : annotations ){ annotation.detach(); } myModelAnnotations.set( Collections.<CDIAnnotation>emptyList()); myAnnotations.set( Collections.<CDIAnnotation>emptyList()); } }; PROCESSOR.submit(runnable); } } }
public void run() { ec2.edit(); JEditorPane[] panes = ec.getOpenedPanes(); if (panes != null && panes.length > 0) { openPane(panes[0], navCase); //ec.open(); } else { ec.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (EditorCookie.Observable.PROP_OPENED_PANES.equals(evt.getPropertyName())) { final JEditorPane[] panes = ec.getOpenedPanes(); if (panes != null && panes.length > 0) { openPane(panes[0], navCase); } ec.removePropertyChangeListener(this); } } }); ec.open(); } } });
public void run() { JumpList.checkAddEntry(); JEditorPane pane = NbDocument.findRecentEditorPane(ec); boolean opened = true; if (pane == null) { ec.open(); opened = false; JEditorPane[] panes = ec.getOpenedPanes(); pane = panes != null && panes.length > 0? panes[0] : null ; } if (pane != null){ jumpToLine(pane, lineInfo, !opened); } } });
@Override public void close () { if (start) { // not yet initialized return; } EditorCookie.Observable ec = getEditableCookie(remoteFile); if (ec != null && ec.getOpenedPanes() == null && !ec.isModified()) { ec.close(); } super.close(); }