@Override protected void finalize() throws Throwable { text.removeCaretListener(this); super.finalize(); }
@Override protected void finalize() throws Throwable { text.removeCaretListener(this); super.finalize(); }
@Override public void deinstall(JEditorPane editor) { status = Status.DEINSTALLING; pane.removeCaretListener(this); removeMarkers(); }
@Override public void deinstall(JEditorPane editor) { status = Status.DEINSTALLING; pane.removeCaretListener(this); removeMarkers(); }
public void removeFrom(JTextComponent tc) { tc.removeFocusListener(this); tc.getDocument().removeDocumentListener(this); tc.removeCaretListener(this); timer.stop(); justInserted = false; }
@Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("document")) { pane.removeCaretListener(this); if (status.equals(Status.INSTALLING)) { pane.addCaretListener(this); removeMarkers(); } } } }
@Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("document")) { pane.removeCaretListener(this); if (status.equals(Status.INSTALLING)) { pane.addCaretListener(this); removeMarkers(); } } } }
public void editorRegistryChanged() { final JTextComponent editor = EditorRegistry.lastFocusedComponent(); final JTextComponent lastEditor = lastEditorRef == null ? null : lastEditorRef.get(); if (lastEditor != editor) { if (lastEditor != null) { lastEditor.removeCaretListener(this); //lastEditor.removePropertyChangeListener(this); final Document doc = lastEditor.getDocument(); Source js = null; if (doc != null) { js = forDocument(doc); } //if (js != null) { // js.k24 = false; //} } lastEditorRef = new WeakReference<JTextComponent>(editor); if (editor != null) { editor.addCaretListener(this); //lastEditor.addPropertyChangeListener(this); } } }
public void stateChanged(ChangeEvent e) { List<JTextComponent> added = new ArrayList<JTextComponent>(OpenedEditors.getDefault().getVisibleEditors()); List<JTextComponent> removed = new ArrayList<JTextComponent>(component2Listener.keySet()); added.removeAll(component2Listener.keySet()); removed.removeAll(OpenedEditors.getDefault().getVisibleEditors()); for (JTextComponent c : removed) { c.removeCaretListener(component2Listener.remove(c)); } for (JTextComponent c : added) { ComponentListener l = new ComponentListener(c); c.addCaretListener(l); component2Listener.put(c, l); //TODO: are we in AWT Thread?: setLastPosition(OpenedEditors.getFileObject(c), c.getCaretPosition()); } fileObjectsChanged(); }
public void stateChanged(ChangeEvent e) { List<JTextComponent> added = new ArrayList<JTextComponent>(OpenedEditors.getDefault().getVisibleEditors()); List<JTextComponent> removed = new ArrayList<JTextComponent>(component2Listener.keySet()); added.removeAll(component2Listener.keySet()); removed.removeAll(OpenedEditors.getDefault().getVisibleEditors()); for (JTextComponent c : removed) { c.removeCaretListener(component2Listener.remove(c)); } for (JTextComponent c : added) { ComponentListener l = new ComponentListener(c); c.addCaretListener(l); component2Listener.put(c, l); //TODO: are we in AWT Thread?: setLastSelection(OpenedEditors.getFileObject(c), c.getSelectionStart(), c.getSelectionEnd()); } fileObjectsChanged(); }
/** * Uninstalls this listener from the current text component. */ public void uninstall() { JTextComponent tc = ac.getTextComponent(); tc.removeCaretListener(this); tc.removeFocusListener(this); tc.getDocument().removeDocumentListener(this); uninstallKeyBindings(); if (markOccurrencesEnabled) { ((RSyntaxTextArea)tc).setMarkOccurrences(markOccurrencesEnabled); } // Remove WeakReferences in javax.swing.text. maxPos = null; minPos = -1; removeParameterHighlights(); }
component.removeCaretListener(caretL);
component.removeCaretListener( caretL );
component.removeCaretListener( caretL );
/** * Uninstalls CurrentLineHighligher for the given JTextComponent. * @param c is the text component */ public static void uninstall(JTextComponent c) { c.putClientProperty(LINE_HIGHLIGHT, null); c.putClientProperty(PREVIOUS_CARET, null); c.removeCaretListener(caretListener); c.removeMouseListener(mouseListener); c.removeMouseMotionListener(mouseMotionListener); EditorThemePropertiesManager.removeListener(editorThemePropertyChangeListener); }
private void editorRegistryChanged() { final JTextComponent editor = EditorRegistry.lastFocusedComponent(); final JTextComponent lastEditor = lastEditorRef == null ? null : lastEditorRef.get(); if (lastEditor != editor && (editor == null || editor.getClientProperty("AsTextField") == null)) { if (lastEditor != null) { lastEditor.removeCaretListener(this); lastEditor.removePropertyChangeListener(this); k24.set(false); } lastEditorRef = new WeakReference<JTextComponent>(editor); if (editor != null) { editor.addCaretListener(this); editor.addPropertyChangeListener(this); } final JTextComponent focused = EditorRegistry.focusedComponent(); if (focused != null) { final Document doc = editor.getDocument(); final String mimeType = DocumentUtilities.getMimeType (doc); if (doc != null && mimeType != null) { final Source source = Source.create (doc); if (source != null) { ((EventSupport)SourceEnvironment.forSource(source)).resetState(true, false, -1, -1, true); } } } } }
protected void setEditor (JTextComponent editor) { if (currentEditor != null) currentEditor.removeCaretListener (caretListener); currentEditor = editor; if (editor != null) { if (caretListener == null) caretListener = new ACaretListener (); editor.addCaretListener (caretListener); Document document = editor.getDocument (); if (currentDocument == document) return; currentDocument = document; final Source source = Source.create (currentDocument); schedule (source, new CursorMovedSchedulerEvent (this, editor.getCaret ().getDot (), editor.getCaret ().getMark ()) {}); } else { currentDocument = null; schedule(null, null); } }
void updateFocusOwner(JComponent oldOwner, JComponent newOwner) { if (oldOwner instanceof JTextComponent) { JTextComponent text = (JTextComponent)oldOwner; text.removeCaretListener(textComponentCaretListener); text.removePropertyChangeListener(textComponentPCL); } if (newOwner instanceof JTextComponent) { JTextComponent text = (JTextComponent)newOwner; maybeInstallTextActions(text); updateTextActions(text); text.addCaretListener(textComponentCaretListener); text.addPropertyChangeListener(textComponentPCL); } else if (newOwner == null) { setCopyEnabled(false); setCutEnabled(false); setPasteEnabled(false); setDeleteEnabled(false); } }
void updateFocusOwner(JComponent oldOwner, JComponent newOwner) { if (oldOwner instanceof JTextComponent) { JTextComponent text = (JTextComponent) oldOwner; text.removeCaretListener(textComponentCaretListener); text.removePropertyChangeListener(textComponentPCL); } if (newOwner instanceof JTextComponent) { JTextComponent text = (JTextComponent) newOwner; maybeInstallTextActions(text); updateTextActions(text); text.addCaretListener(textComponentCaretListener); text.addPropertyChangeListener(textComponentPCL); } else if (newOwner == null) { setCopyEnabled(false); setCutEnabled(false); setPasteEnabled(false); setDeleteEnabled(false); setSelectAllEnabled(false); } }