blob: e4c9e7d344aaafebe7f434adfc1193631e3c5a42 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009, 2019 Xored Software Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Xored Software Inc - initial API and implementation and/or initial documentation
*******************************************************************************/
package org.eclipse.rcptt.tesla.ecl.model.impl;
import org.eclipse.rcptt.tesla.ecl.model.ControlHandler;
import org.eclipse.rcptt.tesla.ecl.model.SetTextSelection;
import org.eclipse.rcptt.tesla.ecl.model.TeslaPackage;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.rcptt.ecl.core.impl.CommandImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Set Text Selection</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.rcptt.tesla.ecl.model.impl.SetTextSelectionImpl#getControl <em>Control</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.ecl.model.impl.SetTextSelectionImpl#getOffset <em>Offset</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.ecl.model.impl.SetTextSelectionImpl#getLength <em>Length</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.ecl.model.impl.SetTextSelectionImpl#getStartLine <em>Start Line</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.ecl.model.impl.SetTextSelectionImpl#getEndLine <em>End Line</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.ecl.model.impl.SetTextSelectionImpl#getEndOffset <em>End Offset</em>}</li>
* </ul>
*
* @generated
*/
public class SetTextSelectionImpl extends CommandImpl implements SetTextSelection {
/**
* The cached value of the '{@link #getControl() <em>Control</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getControl()
* @generated
* @ordered
*/
protected ControlHandler control;
/**
* The default value of the '{@link #getOffset() <em>Offset</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOffset()
* @generated
* @ordered
*/
protected static final Integer OFFSET_EDEFAULT = null;
/**
* The cached value of the '{@link #getOffset() <em>Offset</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOffset()
* @generated
* @ordered
*/
protected Integer offset = OFFSET_EDEFAULT;
/**
* The default value of the '{@link #getLength() <em>Length</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLength()
* @generated
* @ordered
*/
protected static final Integer LENGTH_EDEFAULT = null;
/**
* The cached value of the '{@link #getLength() <em>Length</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLength()
* @generated
* @ordered
*/
protected Integer length = LENGTH_EDEFAULT;
/**
* The default value of the '{@link #getStartLine() <em>Start Line</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStartLine()
* @generated
* @ordered
*/
protected static final Integer START_LINE_EDEFAULT = null;
/**
* The cached value of the '{@link #getStartLine() <em>Start Line</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStartLine()
* @generated
* @ordered
*/
protected Integer startLine = START_LINE_EDEFAULT;
/**
* The default value of the '{@link #getEndLine() <em>End Line</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEndLine()
* @generated
* @ordered
*/
protected static final Integer END_LINE_EDEFAULT = null;
/**
* The cached value of the '{@link #getEndLine() <em>End Line</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEndLine()
* @generated
* @ordered
*/
protected Integer endLine = END_LINE_EDEFAULT;
/**
* The default value of the '{@link #getEndOffset() <em>End Offset</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEndOffset()
* @generated
* @ordered
*/
protected static final Integer END_OFFSET_EDEFAULT = null;
/**
* The cached value of the '{@link #getEndOffset() <em>End Offset</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEndOffset()
* @generated
* @ordered
*/
protected Integer endOffset = END_OFFSET_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected SetTextSelectionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return TeslaPackage.Literals.SET_TEXT_SELECTION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ControlHandler getControl() {
if (control != null && control.eIsProxy()) {
InternalEObject oldControl = (InternalEObject)control;
control = (ControlHandler)eResolveProxy(oldControl);
if (control != oldControl) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, TeslaPackage.SET_TEXT_SELECTION__CONTROL, oldControl, control));
}
}
return control;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ControlHandler basicGetControl() {
return control;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setControl(ControlHandler newControl) {
ControlHandler oldControl = control;
control = newControl;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TeslaPackage.SET_TEXT_SELECTION__CONTROL, oldControl, control));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Integer getOffset() {
return offset;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOffset(Integer newOffset) {
Integer oldOffset = offset;
offset = newOffset;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TeslaPackage.SET_TEXT_SELECTION__OFFSET, oldOffset, offset));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Integer getLength() {
return length;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLength(Integer newLength) {
Integer oldLength = length;
length = newLength;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TeslaPackage.SET_TEXT_SELECTION__LENGTH, oldLength, length));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Integer getStartLine() {
return startLine;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStartLine(Integer newStartLine) {
Integer oldStartLine = startLine;
startLine = newStartLine;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TeslaPackage.SET_TEXT_SELECTION__START_LINE, oldStartLine, startLine));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Integer getEndLine() {
return endLine;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEndLine(Integer newEndLine) {
Integer oldEndLine = endLine;
endLine = newEndLine;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TeslaPackage.SET_TEXT_SELECTION__END_LINE, oldEndLine, endLine));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Integer getEndOffset() {
return endOffset;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEndOffset(Integer newEndOffset) {
Integer oldEndOffset = endOffset;
endOffset = newEndOffset;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TeslaPackage.SET_TEXT_SELECTION__END_OFFSET, oldEndOffset, endOffset));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case TeslaPackage.SET_TEXT_SELECTION__CONTROL:
if (resolve) return getControl();
return basicGetControl();
case TeslaPackage.SET_TEXT_SELECTION__OFFSET:
return getOffset();
case TeslaPackage.SET_TEXT_SELECTION__LENGTH:
return getLength();
case TeslaPackage.SET_TEXT_SELECTION__START_LINE:
return getStartLine();
case TeslaPackage.SET_TEXT_SELECTION__END_LINE:
return getEndLine();
case TeslaPackage.SET_TEXT_SELECTION__END_OFFSET:
return getEndOffset();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case TeslaPackage.SET_TEXT_SELECTION__CONTROL:
setControl((ControlHandler)newValue);
return;
case TeslaPackage.SET_TEXT_SELECTION__OFFSET:
setOffset((Integer)newValue);
return;
case TeslaPackage.SET_TEXT_SELECTION__LENGTH:
setLength((Integer)newValue);
return;
case TeslaPackage.SET_TEXT_SELECTION__START_LINE:
setStartLine((Integer)newValue);
return;
case TeslaPackage.SET_TEXT_SELECTION__END_LINE:
setEndLine((Integer)newValue);
return;
case TeslaPackage.SET_TEXT_SELECTION__END_OFFSET:
setEndOffset((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case TeslaPackage.SET_TEXT_SELECTION__CONTROL:
setControl((ControlHandler)null);
return;
case TeslaPackage.SET_TEXT_SELECTION__OFFSET:
setOffset(OFFSET_EDEFAULT);
return;
case TeslaPackage.SET_TEXT_SELECTION__LENGTH:
setLength(LENGTH_EDEFAULT);
return;
case TeslaPackage.SET_TEXT_SELECTION__START_LINE:
setStartLine(START_LINE_EDEFAULT);
return;
case TeslaPackage.SET_TEXT_SELECTION__END_LINE:
setEndLine(END_LINE_EDEFAULT);
return;
case TeslaPackage.SET_TEXT_SELECTION__END_OFFSET:
setEndOffset(END_OFFSET_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case TeslaPackage.SET_TEXT_SELECTION__CONTROL:
return control != null;
case TeslaPackage.SET_TEXT_SELECTION__OFFSET:
return OFFSET_EDEFAULT == null ? offset != null : !OFFSET_EDEFAULT.equals(offset);
case TeslaPackage.SET_TEXT_SELECTION__LENGTH:
return LENGTH_EDEFAULT == null ? length != null : !LENGTH_EDEFAULT.equals(length);
case TeslaPackage.SET_TEXT_SELECTION__START_LINE:
return START_LINE_EDEFAULT == null ? startLine != null : !START_LINE_EDEFAULT.equals(startLine);
case TeslaPackage.SET_TEXT_SELECTION__END_LINE:
return END_LINE_EDEFAULT == null ? endLine != null : !END_LINE_EDEFAULT.equals(endLine);
case TeslaPackage.SET_TEXT_SELECTION__END_OFFSET:
return END_OFFSET_EDEFAULT == null ? endOffset != null : !END_OFFSET_EDEFAULT.equals(endOffset);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (offset: ");
result.append(offset);
result.append(", length: ");
result.append(length);
result.append(", startLine: ");
result.append(startLine);
result.append(", endLine: ");
result.append(endLine);
result.append(", endOffset: ");
result.append(endOffset);
result.append(')');
return result.toString();
}
} //SetTextSelectionImpl