/*******************************************************************************
- * 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;
}