001    /**
002     * <copyright>
003     *
004     * Copyright (c) 2002-2006 IBM Corporation and others.
005     * All rights reserved.   This program and the accompanying materials
006     * are made available under the terms of the Eclipse Public License v1.0
007     * which accompanies this distribution, and is available at
008     * http://www.eclipse.org/legal/epl-v10.html
009     * 
010     * Contributors: 
011     *   IBM - Initial API and implementation
012     *
013     * </copyright>
014     *
015     * $Id: AdapterImpl.java,v 1.4 2006/12/05 20:19:58 emerks Exp $
016     */
017    package org.eclipse.emf.common.notify.impl;
018    
019    
020    import org.eclipse.emf.common.notify.Adapter;
021    import org.eclipse.emf.common.notify.Notification;
022    import org.eclipse.emf.common.notify.Notifier;
023    
024    
025    
026    /**
027     * An extensible adapter implementation.
028     */
029    public class AdapterImpl implements Adapter.Internal
030    {
031      /**
032       * The last notifier set to this adapter.
033       */
034      protected Notifier target = null;
035    
036      /**
037       * Creates an instance.
038       */
039      public AdapterImpl()
040      {
041        super();
042      }
043    
044      /**
045       * Returns <code>false</code>
046       * @param type the type.
047       * @return <code>false</code>
048       */
049      public boolean isAdapterForType(Object type)
050      {
051        return false;
052      }
053    
054      /**
055       * Does nothing; clients may override so that it does something.
056       */
057      public void notifyChanged(Notification msg)
058      {
059        // Do nothing.
060      }
061    
062      /*
063       * Javadoc copied from interface.
064       */
065      public Notifier getTarget()
066      {
067        return target;
068      }
069    
070      /*
071       * Javadoc copied from interface.
072       */
073      public void setTarget(Notifier newTarget)
074      {
075        target = newTarget;
076      }
077    
078      /*
079       * Javadoc copied from interface.
080       */
081      public void unsetTarget(Notifier oldTarget)
082      {
083        if (target == oldTarget)
084        {
085          setTarget(null);
086        }
087      }
088    }