/*******************************************************************************
- * Copyright (c) 2010, 2011, 2012 Ericsson
+ * Copyright (c) 2010, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
*
* Contributors:
* Francois Chouinard - Initial API and implementation
+ * Bernd Hufmann - Implement getParent()
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.project.model;
*/
@Override
public Object getParent(Object element) {
+ if (element instanceof IProject) {
+ IProject project = (IProject) element;
+ return project.getParent();
+ }
+
+ if (element instanceof TmfTraceFolder) {
+ TmfTraceFolder folder = (TmfTraceFolder) element;
+ // Return the corresponding IProject as parent because from CNF point of view the IProject is the parent.
+ // The IProject is needed e.g. for link with Editor to work correctly.
+ return folder.getParent().getResource();
+ }
+
+ if (element instanceof TmfTraceElement) {
+ TmfTraceElement traceElement = (TmfTraceElement) element;
+ return traceElement.getParent();
+ }
+
+ if (element instanceof TmfExperimentFolder) {
+ TmfExperimentFolder folder = (TmfExperimentFolder) element;
+ // Return the corresponding IProject as parent because from CNF point of view the IProject is the parent.
+ // The IProject is needed e.g. for link with Editor to work correctly.
+ return folder.getParent().getResource();
+ }
+
+ if (element instanceof TmfExperimentElement) {
+ TmfExperimentElement expElement = (TmfExperimentElement) element;
+ return expElement.getParent();
+ }
return null;
}
* @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#getPipelinedChildren(java.lang.Object, java.util.Set)
*/
@Override
- @SuppressWarnings({ "rawtypes", "unchecked" })
public void getPipelinedChildren(Object parent, Set currentChildren) {
customizeTmfElements(getChildren(parent), currentChildren);
}
* @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#getPipelinedElements(java.lang.Object, java.util.Set)
*/
@Override
- @SuppressWarnings({ "rawtypes", "unchecked" })
public void getPipelinedElements(Object input, Set currentElements) {
customizeTmfElements(getElements(input), currentElements);
}
* @param children
* the current children
*/
- private void customizeTmfElements(Object[] elements, Set<Object> children) {
+ private static void customizeTmfElements(Object[] elements,
+ Set<Object> children) {
if (elements != null && children != null) {
for (Object element : elements) {
if (element instanceof ITmfProjectModelElement) {