/**
   * Test that we need to do our own equals() work to manually unwrap an arbitrary number of
   * proxies.
   */
  public void testRemoveWithProxies() {
    Object bean = new Object();
    PropertyChangeSupport support = new PropertyChangeSupport(bean);

    EventLog all = new EventLog();
    support.addPropertyChangeListener(all);
    assertEquals(1, support.getPropertyChangeListeners().length);

    EventLog proxiedA = new EventLog();
    support.addPropertyChangeListener(new PropertyChangeListenerProxy("a", proxiedA));
    assertEquals(2, support.getPropertyChangeListeners().length);

    EventLog addA = new EventLog();
    support.addPropertyChangeListener("a", addA);
    assertEquals(3, support.getPropertyChangeListeners().length);

    EventLog addAProxiedB = new EventLog();
    support.addPropertyChangeListener("a", new PropertyChangeListenerProxy("b", addAProxiedB));
    assertEquals(4, support.getPropertyChangeListeners().length);

    EventLog proxiedAB = new EventLog();
    PropertyChangeListenerProxy proxyAB =
        new PropertyChangeListenerProxy("a", new PropertyChangeListenerProxy("b", proxiedAB));
    support.addPropertyChangeListener(proxyAB);
    assertEquals(5, support.getPropertyChangeListeners().length);

    EventLog proxiedAAC = new EventLog();
    support.addPropertyChangeListener(
        new PropertyChangeListenerProxy(
            "a",
            new PropertyChangeListenerProxy(
                "a", new PropertyChangeListenerProxy("c", proxiedAAC))));
    assertEquals(6, support.getPropertyChangeListeners().length);

    support.removePropertyChangeListener(all);
    assertEquals(5, support.getPropertyChangeListeners().length);
    support.removePropertyChangeListener("a", proxiedA);
    assertEquals(4, support.getPropertyChangeListeners().length);
    support.removePropertyChangeListener(new PropertyChangeListenerProxy("a", addA));
    assertEquals(3, support.getPropertyChangeListeners().length);
    support.removePropertyChangeListener("a", new PropertyChangeListenerProxy("b", addAProxiedB));
    assertEquals(2, support.getPropertyChangeListeners().length);
    support.removePropertyChangeListener(proxyAB);
    assertEquals(1, support.getPropertyChangeListeners().length);

    support.removePropertyChangeListener(proxiedAAC);
    support.removePropertyChangeListener(new PropertyChangeListenerProxy("a", proxiedAAC));
    support.removePropertyChangeListener("a", new PropertyChangeListenerProxy("c", proxiedAAC));
    support.removePropertyChangeListener(
        "a",
        new PropertyChangeListenerProxy("c", new PropertyChangeListenerProxy("a", proxiedAAC)));
    assertEquals(1, support.getPropertyChangeListeners().length);

    support.removePropertyChangeListener(
        "a",
        new PropertyChangeListenerProxy("a", new PropertyChangeListenerProxy("c", proxiedAAC)));
    assertEquals(0, support.getPropertyChangeListeners().length);
  }
예제 #2
0
 public void removePropertyChangeListener(PropertyChangeListener listener) {
   listeners.removePropertyChangeListener(listener);
   Property[] subProperties = getSubProperties();
   if (subProperties != null)
     for (int i = 0; i < subProperties.length; ++i)
       subProperties[i].removePropertyChangeListener(listener);
 }
예제 #3
0
 /**
  * Removes a PropertyChangeListener from the listener list for a specific property. This method
  * should be used to remove PropertyChangeListeners that were registered for a specific bound
  * property.
  *
  * <p>If listener is null, no exception is thrown and no action is performed.
  *
  * @param propertyName a valid property name
  * @param listener the PropertyChangeListener to be removed
  * @see #addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
  * @see #getPropertyChangeListeners(java.lang.String)
  * @see #removePropertyChangeListener(java.beans.PropertyChangeListener)
  */
 public synchronized void removePropertyChangeListener(
     String propertyName, PropertyChangeListener listener) {
   if (listener == null || changeSupport == null) {
     return;
   }
   changeSupport.removePropertyChangeListener(propertyName, listener);
 }
예제 #4
0
 @Override
 public void dispose() {
   final PropertyChangeListener[] changeListeners = changeSupport.getPropertyChangeListeners();
   for (PropertyChangeListener changeListener : changeListeners) {
     changeSupport.removePropertyChangeListener(changeListener);
   }
 }
예제 #5
0
  /**
   * Removes the PropertyChangeListener from the internal list. If the PropertyChangeListener is not
   * on the list, nothing is done.
   *
   * @see #addPropertyChangeListener
   * @param listener The PropertyChangeListener.
   */
  public void removePropertyChangeListener(PropertyChangeListener listener) {
    if (listener == null) throw new NullPointerException("listener");
    if (changes_ != null) changes_.removePropertyChangeListener(listener); // @CRS

    // must call the parents change listener since it is
    // in a different package.
    super.removePropertyChangeListener(listener);
  }
 /**
  * Remove a PropertyChangeListener for a specific property. If <code>listener</code> was added
  * more than once to the same event source for the specified property, it will be notified one
  * less time after being removed. If <code>propertyName</code> is null, no exception is thrown and
  * no action is taken. If <code>listener</code> is null, or was never added for the specified
  * property, no exception is thrown and no action is taken.
  *
  * @param propertyName The name of the property that was listened on.
  * @param listener The PropertyChangeListener to be removed
  */
 public synchronized void removePropertyChangeListener(
     String propertyName, PropertyChangeListener listener) {
   if (listener == null || propertyName == null) {
     return;
   }
   if (children == null) {
     return;
   }
   PropertyChangeSupport child = (PropertyChangeSupport) children.get(propertyName);
   if (child == null) {
     return;
   }
   child.removePropertyChangeListener(listener);
 }
  /**
   * Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener
   * that was registered for all properties. If <code>listener</code> was added more than once to
   * the same event source, it will be notified one less time after being removed. If <code>listener
   * </code> is null, or was never added, no exception is thrown and no action is taken.
   *
   * @param listener The PropertyChangeListener to be removed
   */
  public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
    if (listener == null) {
      return;
    }

    if (listener instanceof PropertyChangeListenerProxy) {
      PropertyChangeListenerProxy proxy = (PropertyChangeListenerProxy) listener;
      // Call two argument remove method.
      removePropertyChangeListener(
          proxy.getPropertyName(), (PropertyChangeListener) proxy.getListener());
    } else {
      if (listeners == null) {
        return;
      }
      listeners.remove(listener);
    }
  }
예제 #8
0
  /* (non-Javadoc)
   * @see org.eclipse.ui.part.WorkbenchPart#dispose()
   */
  @Override
  public void dispose() {
    view.removeViewChangeListener(viewChangeListener);

    if (subsetHistory != null) {
      PropertyChangeSupport propertyChangeSupport =
          (PropertyChangeSupport) subsetHistory.getAdapter(PropertyChangeSupport.class);
      if (propertyChangeSupport != null) {
        propertyChangeSupport.removePropertyChangeListener(propertyChangeListener);
      }
    }

    if (UIActivator.getDefault() != null) {
      IPreferenceStore preferences = UIActivator.getDefault().getPreferenceStore();
      preferences.removePropertyChangeListener(preferenceChangeListener);
    }

    super.dispose();
  }
예제 #9
0
 /**
  * Remove property change listener.
  *
  * @param l property change listener
  */
 public void removePropertyChangeListener(PropertyChangeListener l) {
   support_.removePropertyChangeListener(l);
 }
 public void removePropertyChangeListener(PropertyChangeListener listener) {
   System.out.println("THRESSHOLD removeListener:" + listener.getClass());
   _support.removePropertyChangeListener(listener);
 }
예제 #11
0
 public void removePropertyChangeListener(PropertyChangeListener listener) {
   propertyChangeSupport.removePropertyChangeListener(listener);
 }
예제 #12
0
 /**
  * Remove a property change listener
  *
  * @param pcl a <code>PropertyChangeListener</code> value
  */
 public void removePropertyChangeListener(PropertyChangeListener pcl) {
   m_pcSupport.removePropertyChangeListener(pcl);
 }
예제 #13
0
 /** Removes the specified change listener. */
 public static void removeChangeListener(PropertyChangeListener l) {
   if (m_pcsTypesMgr != null) m_pcsTypesMgr.removePropertyChangeListener(l);
 }
 @Override
 public void removePropertyChangeListener(PropertyChangeListener l) {
   pcs.removePropertyChangeListener(l);
 }
예제 #15
0
 @Override
 public void removePropertyChangeListener(@Nullable PropertyChangeListener listener) {
   pcs.removePropertyChangeListener(listener);
 }
 @Override
 public void removePropertyChangeListener(java.beans.PropertyChangeListener listener) {
   property.removePropertyChangeListener(listener);
 }
 public void removePropertyChangeListener(PropertyChangeListener propertyChangeListener) {
   support.removePropertyChangeListener(propertyChangeListener);
 }
예제 #18
0
파일: ContentImpl.java 프로젝트: jexp/idea2
 public void removePropertyChangeListener(PropertyChangeListener l) {
   myChangeSupport.removePropertyChangeListener(l);
 }
 @Override
 public void removePropertyChangeListener(
     String propertyName, java.beans.PropertyChangeListener listener) {
   property.removePropertyChangeListener(propertyName, listener);
 }
예제 #20
0
 /**
  * Remove specific property change listener
  *
  * @param name property name
  * @param l property change listener
  */
 public void removePropertyChangeListener(String name, PropertyChangeListener l) {
   support_.removePropertyChangeListener(name, l);
 }
예제 #21
0
 @Override
 public void removePropertyChangeListener(
     @Nullable String propertyName, @Nullable PropertyChangeListener listener) {
   pcs.removePropertyChangeListener(propertyName, listener);
 }
예제 #22
0
  /**
   * Removes a PropertyChangeListener from this instance.
   *
   * @param listener The PropertyChangeListener to be removed.
   */
  public void removePropertyChangeListener(PropertyChangeListener listener) {

    if (propertyListeners != null) {
      propertyListeners.removePropertyChangeListener(listener);
    }
  }
예제 #23
0
 public void removePropertyChangeListener(PropertyChangeListener listener) {
   pcs.removePropertyChangeListener(listener);
 }
예제 #24
0
  /**
   * Removes a PropertyChangeListener for a named property from this instance.
   *
   * @param name The name of the property.
   * @param listener The PropertyChangeListener to be removed.
   */
  public void removePropertyChangeListener(String name, PropertyChangeListener listener) {

    if (propertyListeners != null) {
      propertyListeners.removePropertyChangeListener(name, listener);
    }
  }
예제 #25
0
 public void removePropertyChangeListener(PropertyChangeListener pcl) {
   pcs.removePropertyChangeListener(pcl);
 }
예제 #26
0
 @Override
 public void removePropertyChangeListener(PropertyChangeListener listener) {
   super.removePropertyChangeListener(listener);
   initPropSupport();
   propSupport.removePropertyChangeListener(listener);
 }
예제 #27
0
 public void removePropertyChangeListener(PropertyChangeListener l) {
   changes.removePropertyChangeListener(l);
 }
예제 #28
0
 /**
  * Removes a PropertyChangeListener from the listener list. This removes a PropertyChangeListener
  * that was registered for all properties.
  *
  * @param listener The PropertyChangeListener to be removed
  */
 public void removePropertyChangeListener(PropertyChangeListener listener) {
   if (accessibleChangeSupport != null) {
     accessibleChangeSupport.removePropertyChangeListener(listener);
   }
 }
예제 #29
0
 public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
   propertyChangeSupport.removePropertyChangeListener(propertyName, listener);
 }
예제 #30
0
 /**
  * Remove a property change listener from this component.
  *
  * @param listener The listener to remove
  */
 @Override
 public void removePropertyChangeListener(PropertyChangeListener listener) {
   support.removePropertyChangeListener(listener);
 }