blob: 3e539e0c728e3eb081f7c9683e467f346488e657 [file] [log] [blame]
/***************************************************************************************************
* Copyright (c) 2005-2007 Eteration A.S. and Gorkem Ercan All rights reserved. This program and the
* accompanying materials are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: Gorkem Ercan
* Contributors: Naci Dai
*
**************************************************************************************************/
package org.eclipse.jst.server.generic.internal.servertype.definition.impl;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.jst.server.generic.internal.servertype.definition.ServerTypePackage;
import org.eclipse.jst.server.generic.servertype.definition.Property;
import org.eclipse.jst.server.generic.servertype.definition.ServerRuntime;
import org.osgi.framework.Bundle;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Property</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.jst.server.generic.internal.servertype.definition.impl.PropertyImpl#getContext <em>Context</em>}</li>
* <li>{@link org.eclipse.jst.server.generic.internal.servertype.definition.impl.PropertyImpl#getDefault <em>Default</em>}</li>
* <li>{@link org.eclipse.jst.server.generic.internal.servertype.definition.impl.PropertyImpl#getId <em>Id</em>}</li>
* <li>{@link org.eclipse.jst.server.generic.internal.servertype.definition.impl.PropertyImpl#getLabel <em>Label</em>}</li>
* <li>{@link org.eclipse.jst.server.generic.internal.servertype.definition.impl.PropertyImpl#getType <em>Type</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class PropertyImpl extends EObjectImpl implements Property {
/**
* The default value of the '{@link #getContext() <em>Context</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getContext()
* @generated
* @ordered
*/
protected static final String CONTEXT_EDEFAULT = null;
/**
* The cached value of the '{@link #getContext() <em>Context</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getContext()
* @generated
* @ordered
*/
protected String context = CONTEXT_EDEFAULT;
/**
* The default value of the '{@link #getDefault() <em>Default</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDefault()
* @generated
* @ordered
*/
protected static final String DEFAULT_EDEFAULT = null;
/**
* The cached value of the '{@link #getDefault() <em>Default</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDefault()
* @generated
* @ordered
*/
protected String default_ = DEFAULT_EDEFAULT;
/**
* The default value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected static final String ID_EDEFAULT = null;
/**
* The cached value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected String id = ID_EDEFAULT;
/**
* The default value of the '{@link #getLabel() <em>Label</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLabel()
* @generated
* @ordered
*/
protected static final String LABEL_EDEFAULT = null;
/**
* The cached value of the '{@link #getLabel() <em>Label</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLabel()
* @generated
* @ordered
*/
protected String label = LABEL_EDEFAULT;
/**
* The default value of the '{@link #getType() <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected static final String TYPE_EDEFAULT = null;
/**
* The cached value of the '{@link #getType() <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected String type = TYPE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PropertyImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return ServerTypePackage.Literals.PROPERTY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getContext() {
return context;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setContext(String newContext) {
String oldContext = context;
context = newContext;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ServerTypePackage.PROPERTY__CONTEXT, oldContext, context));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getDefault() {
return default_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDefault(String newDefault) {
String oldDefault = default_;
default_ = newDefault;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ServerTypePackage.PROPERTY__DEFAULT, oldDefault, default_));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getId() {
return id;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setId(String newId) {
String oldId = id;
id = newId;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ServerTypePackage.PROPERTY__ID, oldId, id));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String getLabel() {
if(label.startsWith("%",0))
{
ServerRuntime rt = (ServerRuntime)eResource().getContents().get(0);
Bundle bundle =Platform.getBundle(rt.getConfigurationElementNamespace());
return Platform.getResourceString(bundle,label);
}
return label;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLabel(String newLabel) {
String oldLabel = label;
label = newLabel;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ServerTypePackage.PROPERTY__LABEL, oldLabel, label));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getType() {
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setType(String newType) {
String oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ServerTypePackage.PROPERTY__TYPE, oldType, type));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ServerTypePackage.PROPERTY__CONTEXT:
return getContext();
case ServerTypePackage.PROPERTY__DEFAULT:
return getDefault();
case ServerTypePackage.PROPERTY__ID:
return getId();
case ServerTypePackage.PROPERTY__LABEL:
return getLabel();
case ServerTypePackage.PROPERTY__TYPE:
return getType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ServerTypePackage.PROPERTY__CONTEXT:
setContext((String)newValue);
return;
case ServerTypePackage.PROPERTY__DEFAULT:
setDefault((String)newValue);
return;
case ServerTypePackage.PROPERTY__ID:
setId((String)newValue);
return;
case ServerTypePackage.PROPERTY__LABEL:
setLabel((String)newValue);
return;
case ServerTypePackage.PROPERTY__TYPE:
setType((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case ServerTypePackage.PROPERTY__CONTEXT:
setContext(CONTEXT_EDEFAULT);
return;
case ServerTypePackage.PROPERTY__DEFAULT:
setDefault(DEFAULT_EDEFAULT);
return;
case ServerTypePackage.PROPERTY__ID:
setId(ID_EDEFAULT);
return;
case ServerTypePackage.PROPERTY__LABEL:
setLabel(LABEL_EDEFAULT);
return;
case ServerTypePackage.PROPERTY__TYPE:
setType(TYPE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case ServerTypePackage.PROPERTY__CONTEXT:
return CONTEXT_EDEFAULT == null ? context != null : !CONTEXT_EDEFAULT.equals(context);
case ServerTypePackage.PROPERTY__DEFAULT:
return DEFAULT_EDEFAULT == null ? default_ != null : !DEFAULT_EDEFAULT.equals(default_);
case ServerTypePackage.PROPERTY__ID:
return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
case ServerTypePackage.PROPERTY__LABEL:
return LABEL_EDEFAULT == null ? label != null : !LABEL_EDEFAULT.equals(label);
case ServerTypePackage.PROPERTY__TYPE:
return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (context: ");
result.append(context);
result.append(", default: ");
result.append(default_);
result.append(", id: ");
result.append(id);
result.append(", label: ");
result.append(label);
result.append(", type: ");
result.append(type);
result.append(')');
return result.toString();
}
} //PropertyImpl