1 /*******************************************************************************
2 * Copyright (c) 2013 École Polytechnique de Montréal
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Geneviève Bastien - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
;
15 import org
.eclipse
.core
.resources
.IResource
;
16 import org
.eclipse
.linuxtools
.tmf
.core
.analysis
.IAnalysisOutput
;
17 import org
.eclipse
.linuxtools
.tmf
.ui
.analysis
.TmfAnalysisViewOutput
;
18 import org
.eclipse
.swt
.graphics
.Image
;
19 import org
.eclipse
.ui
.PlatformUI
;
20 import org
.eclipse
.ui
.views
.IViewDescriptor
;
23 * Class for project elements of type analysis output
25 * @author Geneviève Bastien
28 public class TmfAnalysisOutputElement
extends TmfProjectModelElement
{
30 private final IAnalysisOutput fOutput
;
38 * Resource for the view
40 * Parent analysis of the view
44 protected TmfAnalysisOutputElement(String name
, IResource resource
, ITmfProjectModelElement parent
, IAnalysisOutput output
) {
45 super(name
, resource
, parent
);
50 public TmfProjectElement
getProject() {
51 return getParent().getProject();
55 * Gets the icon of the view, if applicable
57 * @return The view icon or null if output is not a view
59 public Image
getIcon() {
60 if (fOutput
instanceof TmfAnalysisViewOutput
) {
61 IViewDescriptor descr
= PlatformUI
.getWorkbench().getViewRegistry().find(
62 ((TmfAnalysisViewOutput
) fOutput
).getViewId());
64 return descr
.getImageDescriptor().createImage();
71 * Outputs the analysis
73 public void outputAnalysis() {
74 ITmfProjectModelElement parent
= getParent();
75 if (parent
instanceof TmfAnalysisElement
) {
76 ((TmfAnalysisElement
) parent
).activateParent();
77 fOutput
.requestOutput();