2 * Copyright (c) 2012 Obeo.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * Obeo - initial API and implementation
11 package org
.eclipse
.emf
.compare
.impl
;
13 import org
.eclipse
.emf
.common
.notify
.Notification
;
14 import org
.eclipse
.emf
.compare
.ComparePackage
;
15 import org
.eclipse
.emf
.compare
.ResourceLocationChange
;
17 import org
.eclipse
.emf
.ecore
.EClass
;
18 import org
.eclipse
.emf
.ecore
.impl
.ENotificationImpl
;
21 * <!-- begin-user-doc -->
22 * An implementation of the model object '<em><b>Resource Location Change</b></em>'.
23 * <!-- end-user-doc -->
25 * The following features are implemented:
27 * <li>{@link org.eclipse.emf.compare.impl.ResourceLocationChangeImpl#getBaseLocation <em>Base Location</em>}</li>
28 * <li>{@link org.eclipse.emf.compare.impl.ResourceLocationChangeImpl#getChangedLocation <em>Changed Location</em>}</li>
35 public class ResourceLocationChangeImpl
extends DiffImpl
implements ResourceLocationChange
{
37 * <!-- begin-user-doc -->
38 * <!-- end-user-doc -->
41 @SuppressWarnings("hiding")
42 public static final String copyright
= "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
45 * The default value of the '{@link #getBaseLocation() <em>Base Location</em>}' attribute.
46 * <!-- begin-user-doc -->
47 * <!-- end-user-doc -->
48 * @see #getBaseLocation()
52 protected static final String BASE_LOCATION_EDEFAULT
= null;
55 * The cached value of the '{@link #getBaseLocation() <em>Base Location</em>}' attribute.
56 * <!-- begin-user-doc -->
57 * <!-- end-user-doc -->
58 * @see #getBaseLocation()
62 protected String baseLocation
= BASE_LOCATION_EDEFAULT
;
65 * The default value of the '{@link #getChangedLocation() <em>Changed Location</em>}' attribute.
66 * <!-- begin-user-doc -->
67 * <!-- end-user-doc -->
68 * @see #getChangedLocation()
72 protected static final String CHANGED_LOCATION_EDEFAULT
= null;
75 * The cached value of the '{@link #getChangedLocation() <em>Changed Location</em>}' attribute.
76 * <!-- begin-user-doc -->
77 * <!-- end-user-doc -->
78 * @see #getChangedLocation()
82 protected String changedLocation
= CHANGED_LOCATION_EDEFAULT
;
85 * <!-- begin-user-doc -->
86 * <!-- end-user-doc -->
89 protected ResourceLocationChangeImpl() {
94 * <!-- begin-user-doc -->
95 * <!-- end-user-doc -->
99 protected EClass
eStaticClass() {
100 return ComparePackage
.Literals
.RESOURCE_LOCATION_CHANGE
;
104 * <!-- begin-user-doc -->
105 * <!-- end-user-doc -->
108 public String
getBaseLocation() {
113 * <!-- begin-user-doc -->
114 * <!-- end-user-doc -->
117 public void setBaseLocation(String newBaseLocation
) {
118 String oldBaseLocation
= baseLocation
;
119 baseLocation
= newBaseLocation
;
120 if (eNotificationRequired())
121 eNotify(new ENotificationImpl(this, Notification
.SET
,
122 ComparePackage
.RESOURCE_LOCATION_CHANGE__BASE_LOCATION
, oldBaseLocation
, baseLocation
));
126 * <!-- begin-user-doc -->
127 * <!-- end-user-doc -->
130 public String
getChangedLocation() {
131 return changedLocation
;
135 * <!-- begin-user-doc -->
136 * <!-- end-user-doc -->
139 public void setChangedLocation(String newChangedLocation
) {
140 String oldChangedLocation
= changedLocation
;
141 changedLocation
= newChangedLocation
;
142 if (eNotificationRequired())
143 eNotify(new ENotificationImpl(this, Notification
.SET
,
144 ComparePackage
.RESOURCE_LOCATION_CHANGE__CHANGED_LOCATION
, oldChangedLocation
,
149 * <!-- begin-user-doc -->
150 * <!-- end-user-doc -->
154 public Object
eGet(int featureID
, boolean resolve
, boolean coreType
) {
156 case ComparePackage
.RESOURCE_LOCATION_CHANGE__BASE_LOCATION
:
157 return getBaseLocation();
158 case ComparePackage
.RESOURCE_LOCATION_CHANGE__CHANGED_LOCATION
:
159 return getChangedLocation();
161 return super.eGet(featureID
, resolve
, coreType
);
165 * <!-- begin-user-doc -->
166 * <!-- end-user-doc -->
170 public void eSet(int featureID
, Object newValue
) {
172 case ComparePackage
.RESOURCE_LOCATION_CHANGE__BASE_LOCATION
:
173 setBaseLocation((String
)newValue
);
175 case ComparePackage
.RESOURCE_LOCATION_CHANGE__CHANGED_LOCATION
:
176 setChangedLocation((String
)newValue
);
179 super.eSet(featureID
, newValue
);
183 * <!-- begin-user-doc -->
184 * <!-- end-user-doc -->
188 public void eUnset(int featureID
) {
190 case ComparePackage
.RESOURCE_LOCATION_CHANGE__BASE_LOCATION
:
191 setBaseLocation(BASE_LOCATION_EDEFAULT
);
193 case ComparePackage
.RESOURCE_LOCATION_CHANGE__CHANGED_LOCATION
:
194 setChangedLocation(CHANGED_LOCATION_EDEFAULT
);
197 super.eUnset(featureID
);
201 * <!-- begin-user-doc -->
202 * <!-- end-user-doc -->
206 public boolean eIsSet(int featureID
) {
208 case ComparePackage
.RESOURCE_LOCATION_CHANGE__BASE_LOCATION
:
209 return BASE_LOCATION_EDEFAULT
== null ? baseLocation
!= null : !BASE_LOCATION_EDEFAULT
210 .equals(baseLocation
);
211 case ComparePackage
.RESOURCE_LOCATION_CHANGE__CHANGED_LOCATION
:
212 return CHANGED_LOCATION_EDEFAULT
== null ? changedLocation
!= null
213 : !CHANGED_LOCATION_EDEFAULT
.equals(changedLocation
);
215 return super.eIsSet(featureID
);
219 * <!-- begin-user-doc -->
220 * <!-- end-user-doc -->
224 public String
toString() {
226 return super.toString();
228 StringBuffer result
= new StringBuffer(super.toString());
229 result
.append(" (baseLocation: "); //$NON-NLS-1$
230 result
.append(baseLocation
);
231 result
.append(", changedLocation: "); //$NON-NLS-1$
232 result
.append(changedLocation
);
234 return result
.toString();
237 } //ResourceLocationChangeImpl