Java Code Examples for javax.swing.text.JTextComponent#removePropertyChangeListener()

The following examples show how to use javax.swing.text.JTextComponent#removePropertyChangeListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditorCaret.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void deinstall(JTextComponent c) {
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("EditorCaret.deinstall: Deinstalling from " + s2s(c) + "\n"); //NOI18N
    }
    
    synchronized (listenerList) {
        if (blinkTimer != null) {
            setBlinkRate(0);
        }
    }
    
    c.removeComponentListener(listenerImpl);
    c.removePropertyChangeListener(listenerImpl);
    c.removeFocusListener(listenerImpl);
    c.removeMouseListener(listenerImpl);
    c.removeMouseMotionListener(listenerImpl);
    ViewHierarchy.get(c).removeViewHierarchyListener(listenerImpl);

    
    modelChanged(activeDoc, null);
}
 
Example 2
Source File: BaseCaret.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Called when UI is being removed from JTextComponent */
@Override
@SuppressWarnings("NestedSynchronizedStatement")
public void deinstall(JTextComponent c) {
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Deinstalling from " + s2s(c)); //NOI18N
    }
    
    component = null; // invalidate
    caretBounds = null;

    // No idea why the sync is done the way how it is, but the locks must
    // always be acquired in the same order otherwise the code will deadlock
    // sooner or later. See #100734
    synchronized (this) {
        synchronized (listenerImpl) {
            if (flasher != null) {
                setBlinkRate(0);
            }
        }
    }
    
    c.removeComponentListener(listenerImpl);
    c.removePropertyChangeListener(this);
    c.removeFocusListener(listenerImpl);
    c.removeMouseListener(this);
    c.removeMouseMotionListener(this);
    ViewHierarchy.get(c).removeViewHierarchyListener(listenerImpl);

    
    EditorUI editorUI = Utilities.getEditorUI(c);
    editorUI.removePropertyChangeListener(this);

    modelChanged(listenDoc, null);
}
 
Example 3
Source File: DocumentViewOp.java    From netbeans with Apache License 2.0 5 votes vote down vote up
void parentCleared() {
    JTextComponent textComponent = docView.getTextComponent(); // not null yet
    viewHierarchyImpl.setDocumentView(null);
    uninstallFromViewport();
    textComponent.removePropertyChangeListener(this);
    viewUpdates.released();
    viewUpdates = null;
}
 
Example 4
Source File: EditorRegistry.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Remove the given item from registry and return the next one.
 * 
 * @param item item to remove.
 * @return next item in registry.
 */
static Item removeFromRegistry(Item item, List<PropertyChangeEvent> events) {
    boolean lastFocused = (items == item);
    // Remove component from item chain
    JTextComponent component = item.get();
    item = removeFromItemList(item);
    if (component != null) {
        // unregister the listeneres
        component.putClientProperty(Item.class, null);
        component.removeFocusListener(FocusL.INSTANCE);
        component.removeAncestorListener(AncestorL.INSTANCE);
        component.removePropertyChangeListener(CloneableEditorUsageL.INSTANCE);

        events.add(new PropertyChangeEvent(EditorRegistry.class, COMPONENT_REMOVED_PROPERTY, component, null));
        if (LOG.isLoggable(Level.FINEST)) {
            LOG.fine("Component removed: " + dumpComponent(component) + '\n'); //NOI18N
            logItemListFinest();
        }
        if (lastFocused) {
            events.add(new PropertyChangeEvent(EditorRegistry.class, LAST_FOCUSED_REMOVED_PROPERTY, component, lastFocusedComponent()));
            if (LOG.isLoggable(Level.FINE)) {
                LOG.fine("Fired LAST_FOCUSED_REMOVED_PROPERTY for " + dumpComponent(component) + '\n'); //NOI18N
            }
        }
    }
    return item;
}
 
Example 5
Source File: EventSupport.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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);
                }
            }
        }
    }
}
 
Example 6
Source File: AquaTextFieldSearch.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected static void uninstallSearchFieldListener(final JTextComponent c) {
    c.removePropertyChangeListener(SEARCH_FIELD_PROPERTY_LISTENER);
}
 
Example 7
Source File: AquaTextFieldSearch.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
protected static void uninstallSearchFieldListener(final JTextComponent c) {
    c.removePropertyChangeListener(SEARCH_FIELD_PROPERTY_LISTENER);
}
 
Example 8
Source File: AquaTextFieldSearch.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
protected static void uninstallSearchFieldListener(final JTextComponent c) {
    c.removePropertyChangeListener(SEARCH_FIELD_PROPERTY_LISTENER);
}
 
Example 9
Source File: AquaTextFieldSearch.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
protected static void uninstallSearchFieldListener(final JTextComponent c) {
    c.removePropertyChangeListener(SEARCH_FIELD_PROPERTY_LISTENER);
}
 
Example 10
Source File: AquaTextFieldSearch.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
protected static void uninstallSearchFieldListener(final JTextComponent c) {
    c.removePropertyChangeListener(SEARCH_FIELD_PROPERTY_LISTENER);
}
 
Example 11
Source File: AquaTextFieldSearch.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
protected static void uninstallSearchFieldListener(final JTextComponent c) {
    c.removePropertyChangeListener(SEARCH_FIELD_PROPERTY_LISTENER);
}
 
Example 12
Source File: AquaTextFieldSearch.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
protected static void uninstallSearchFieldListener(final JTextComponent c) {
    c.removePropertyChangeListener(SEARCH_FIELD_PROPERTY_LISTENER);
}
 
Example 13
Source File: AquaTextFieldSearch.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
protected static void uninstallSearchFieldListener(final JTextComponent c) {
    c.removePropertyChangeListener(SEARCH_FIELD_PROPERTY_LISTENER);
}
 
Example 14
Source File: AquaTextFieldSearch.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
protected static void uninstallSearchFieldListener(final JTextComponent c) {
    c.removePropertyChangeListener(SEARCH_FIELD_PROPERTY_LISTENER);
}
 
Example 15
Source File: AquaTextFieldSearch.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
protected static void uninstallSearchFieldListener(final JTextComponent c) {
    c.removePropertyChangeListener(SEARCH_FIELD_PROPERTY_LISTENER);
}
 
Example 16
Source File: AquaTextFieldSearch.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
protected static void uninstallSearchFieldListener(final JTextComponent c) {
    c.removePropertyChangeListener(SEARCH_FIELD_PROPERTY_LISTENER);
}
 
Example 17
Source File: AquaTextFieldSearch.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected static void uninstallSearchFieldListener(final JTextComponent c) {
    c.removePropertyChangeListener(SEARCH_FIELD_PROPERTY_LISTENER);
}
 
Example 18
Source File: AquaTextFieldSearch.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected static void uninstallSearchFieldListener(final JTextComponent c) {
    c.removePropertyChangeListener(SEARCH_FIELD_PROPERTY_LISTENER);
}