/*******************************************************************************
- * Copyright (c) 2011 Ericsson
- *
+ * Copyright (c) 2011, 2013 Ericsson
+ *
* 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:
* Francois Chouinard - Initial API and implementation
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.project.model;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.IFolder;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
/**
- * <b><u>TmfTraceFolder</u></b>
+ * Implementation of trace folder model element representing the trace folder in the project.
* <p>
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class TmfTraceFolder extends TmfProjectModelElement implements IPropertySource2 {
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
-
+ /**
+ * The name of the trace folder
+ */
public static final String TRACE_FOLDER_NAME = "Traces"; //$NON-NLS-1$
// Property View stuff
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
-
+ /**
+ * Constructor.
+ * Creates trace folder model element under the project.
+ * @param name The name of trace folder.
+ * @param resource The folder resource.
+ * @param parent The parent element (project).
+ */
public TmfTraceFolder(String name, IFolder resource, TmfProjectElement parent) {
super(name, resource, parent);
parent.addChild(this);
// TmfProjectModelElement
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectModelElement#getResource()
+ */
@Override
public IFolder getResource() {
return (IFolder) fResource;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#getProject()
+ */
@Override
public TmfProjectElement getProject() {
return (TmfProjectElement) getParent();
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectModelElement#refresh()
+ */
@Override
public void refresh() {
TmfProjectElement project = (TmfProjectElement) getParent();
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
-
+ /**
+ * Returns a list of trace model elements under the traces folder.
+ * @return list of trace model elements
+ */
public List<TmfTraceElement> getTraces() {
List<ITmfProjectModelElement> children = getChildren();
List<TmfTraceElement> traces = new ArrayList<TmfTraceElement>();
// IPropertySource2
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
+ */
@Override
public Object getEditableValue() {
return null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
+ */
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
- return sfDescriptors;
+ return Arrays.copyOf(sfDescriptors, sfDescriptors.length);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
+ */
@Override
public Object getPropertyValue(Object id) {
- if (sfName.equals(id))
+ if (sfName.equals(id)) {
return getName();
+ }
- if (sfPath.equals(id))
+ if (sfPath.equals(id)) {
return getPath().toString();
+ }
- if (sfLocation.equals(id))
+ if (sfLocation.equals(id)) {
return getLocation().toString();
+ }
return null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
+ */
@Override
public void resetPropertyValue(Object id) {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
+ */
@Override
public void setPropertyValue(Object id, Object value) {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertyResettable(java.lang.Object)
+ */
@Override
public boolean isPropertyResettable(Object id) {
return false;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertySet(java.lang.Object)
+ */
@Override
public boolean isPropertySet(Object id) {
return false;