blob: 0e16ab9334e8bc1c392c573ace5256b6062ab622 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2011, 2012 Ericsson AB 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
*
* Description:
*
* This class encapsulates the properties for the Contetns UI model element
*
* Contributors:
* Sebastien Dubois - Created for Mylyn Review R4E project
*
******************************************************************************/
package org.eclipse.mylyn.reviews.r4e.ui.internal.properties.general;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIContent;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIModelElement;
import org.eclipse.mylyn.reviews.r4e.ui.internal.utils.R4EUIConstants;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.PropertyDescriptor;
/**
* @author Sebastien Dubois
* @version $Revision: 1.0 $
*/
public class ContentsProperties extends ModelElementProperties {
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
/**
* Field CONTENTS_POSITION_ID. (value is ""contentsElement.position"")
*/
private static final String CONTENTS_POSITION_ID = "contentsElement.position";
/**
* Field CONTENTS_POSITION_PROPERTY_DESCRIPTOR.
*/
private static final PropertyDescriptor CONTENTS_POSITION_PROPERTY_DESCRIPTOR = new PropertyDescriptor(
CONTENTS_POSITION_ID, R4EUIConstants.POSITION_LABEL);
/**
* Field CONTENTS_ASSIGNED_TO_ID. (value is ""contentsElement.assignedTo"")
*/
private static final String CONTENTS_ASSIGNED_TO_ID = "contentsElement.assignedTo";
/**
* Field CONTENTS_ASSIGNED_TO_PROPERTY_DESCRIPTOR.
*/
protected static final PropertyDescriptor CONTENTS_ASSIGNED_TO_PROPERTY_DESCRIPTOR = new PropertyDescriptor(
CONTENTS_ASSIGNED_TO_ID, R4EUIConstants.ASSIGNED_TO_LABEL);
/**
* Field DESCRIPTORS.
*/
private static final IPropertyDescriptor[] DESCRIPTORS = { CONTENTS_POSITION_PROPERTY_DESCRIPTOR,
CONTENTS_ASSIGNED_TO_PROPERTY_DESCRIPTOR };
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
/**
* Constructor for ContentsProperties.
*
* @param aElement
* R4EUIModelElement
*/
public ContentsProperties(R4EUIModelElement aElement) {
super(aElement);
}
// ------------------------------------------------------------------------
// Methods
// ------------------------------------------------------------------------
/**
* Method getPropertyDescriptors.
*
* @return IPropertyDescriptor[]
* @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
*/
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
return DESCRIPTORS;
}
/**
* Method getPropertyValue.
*
* @param aId
* Object
* @return Object
* @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(Object)
*/
@Override
public Object getPropertyValue(Object aId) {
if (CONTENTS_POSITION_ID.equals(aId)) {
return ((R4EUIContent) getElement()).getPosition().toString();
} else if (CONTENTS_ASSIGNED_TO_ID.equals(aId)) {
return ((R4EUIContent) getElement()).getContent().getAssignedTo();
}
return null;
}
}