| 1 |
/** |
| 2 |
* Copyright (c) 2002-2010 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v2.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v20.html |
| 7 |
* |
| 8 |
* Contributors: |
| 9 |
* IBM - Initial API and implementation |
| 10 |
*/ |
| 11 |
package org.eclipse.emf.common.notify.impl; |
| 12 |
|
| 13 |
|
| 14 |
import org.eclipse.emf.common.notify.Adapter; |
| 15 |
import org.eclipse.emf.common.notify.Notification; |
| 16 |
import org.eclipse.emf.common.notify.Notifier; |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
/** |
| 21 |
* An extensible adapter implementation. |
| 22 |
*/ |
| 23 |
public class AdapterImpl implements Adapter.Internal |
| 24 |
{ |
| 25 |
/** |
| 26 |
* The last notifier set to this adapter. |
| 27 |
*/ |
| 28 |
protected Notifier target = null; |
| 29 |
|
| 30 |
/** |
| 31 |
* Creates an instance. |
| 32 |
*/ |
| 33 |
public AdapterImpl() |
| 34 |
{ |
| 35 |
super(); |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Returns <code>false</code> |
| 40 |
* @param type the type. |
| 41 |
* @return <code>false</code> |
| 42 |
*/ |
| 43 |
public boolean isAdapterForType(Object type) |
| 44 |
{ |
| 45 |
return false; |
| 46 |
} |
| 47 |
|
| 48 |
/** |
| 49 |
* Does nothing; clients may override so that it does something. |
| 50 |
*/ |
| 51 |
public void notifyChanged(Notification msg) |
| 52 |
{ |
| 53 |
// Do nothing. |
| 54 |
} |
| 55 |
|
| 56 |
/* |
| 57 |
* Javadoc copied from interface. |
| 58 |
*/ |
| 59 |
public Notifier getTarget() |
| 60 |
{ |
| 61 |
return target; |
| 62 |
} |
| 63 |
|
| 64 |
/* |
| 65 |
* Javadoc copied from interface. |
| 66 |
*/ |
| 67 |
public void setTarget(Notifier newTarget) |
| 68 |
{ |
| 69 |
target = newTarget; |
| 70 |
} |
| 71 |
|
| 72 |
/* |
| 73 |
* Javadoc copied from interface. |
| 74 |
*/ |
| 75 |
public void unsetTarget(Notifier oldTarget) |
| 76 |
{ |
| 77 |
if (target == oldTarget) |
| 78 |
{ |
| 79 |
setTarget(null); |
| 80 |
} |
| 81 |
} |
| 82 |
} |