protected void componentHidden () { if (listener != null) { listener.remove (); listener = null; } if (lastPane != null) lastPane.removeCaretListener (caretListener); lastPane = null; if (lastDocument != null) lastDocument.removeDocumentListener (documentListener); lastDocument = null; highlighting.removeHighlight (); }
@Override public void read( IScriptPartId partId, String strSource, String strDescription ) throws IOException { _partId = partId; _labelCaption.setText( strDescription ); AbstractDocument doc = (AbstractDocument)_editor.getDocument(); if( doc != null ) { doc.removeDocumentListener( _docHandler ); } // Replace the Windows style new-line sequence with just a new-line. // Otherwise, we have serious problems with the editor (it ALWAYS thinks new lines are one character, regardless). strSource = GosuStringUtil.replace( strSource, "\r\n", "\n" ); _editor.read( new StringReader( strSource ), strDescription ); addDocumentListener(); parse(); }
"With DocumentListener", JOptionPane.INFORMATION_MESSAGE); myDocument.removeDocumentListener(myDocumentListener);
@Override public void read( IScriptPartId partId, String strSource ) throws IOException { setScriptPart( partId ); setLabel( "" ); JTextComponent editor = getEditor(); AbstractDocument doc = (AbstractDocument)editor.getDocument(); if( doc != null ) { doc.removeDocumentListener( getDocHandler() ); } // Replace the Windows style new-line sequence with just a new-line. // Otherwise, the editor thinks new lines are one character strSource = GosuStringUtil.replace( strSource, "\r\n", "\n" ); editor.read( new StringReader( strSource ), "" ); addDocumentListener(); parse(); }
documentListener = new CDocumentListener (); if (lastDocument != null && lastDocument != doc) { lastDocument.removeDocumentListener (documentListener); lastDocument = null;