blob: 521f84edbd0b4201237ff2ddd7d22b2b8b335f16 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2006 IBM Corporation and others.
* 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.ui.properties.sections;
import java.util.List;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.Forward;
import org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.ForwardPositionKind;
import org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.HockeyleaguePackage;
/**
* A section for the position property of a selected forward Object.
*
* @author Anthony Hunter
*/
public class ForwardPositionPropertySection
extends AbstractEnumerationPropertySection {
/**
* @see org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.ui.properties.sections.AbstractEnumerationPropertySection#getFeature()
*/
protected EAttribute getFeature() {
return HockeyleaguePackage.eINSTANCE.getForward_Position();
}
/**
* @see org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.ui.properties.sections.AbstractEnumerationPropertySection#getFeatureAsText()
*/
protected String getFeatureAsText() {
return ((Forward) eObject).getPosition().getName();
}
/**
* @see org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.ui.properties.sections.AbstractEnumerationPropertySection#getFeatureValue(int)
*/
protected Object getFeatureValue(int index) {
return ForwardPositionKind.VALUES.get(index);
}
/**
* @see org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.ui.properties.sections.AbstractEnumerationPropertySection#getLabelText()
*/
protected String getLabelText() {
return "Position:";//$NON-NLS-1$
}
/**
* @see org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.ui.properties.sections.AbstractEnumerationPropertySection#isEqual(int)
*/
protected boolean isEqual(int index) {
return ForwardPositionKind.VALUES.get(index).equals(
((Forward) eObject).getPosition());
}
/**
* @see org.eclipse.ui.examples.views.properties.tabbed.hockeyleague.ui.properties.sections.AbstractEnumerationPropertySection#getEnumerationFeatureValues()
*/
protected String[] getEnumerationFeatureValues() {
List values = ForwardPositionKind.VALUES;
String[] ret = new String[values.size()];
for (int i = 0; i < values.size(); i++) {
ret[i] = ((ForwardPositionKind) values.get(i)).getName();
}
return ret;
}
}