1402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll/*******************************************************************************
2402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * Copyright (c) 2000, 2009 IBM Corporation and others.
3402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * All rights reserved. This program and the accompanying materials
4402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * are made available under the terms of the Eclipse Public License v1.0
5402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * which accompanies this distribution, and is available at
6402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * http://www.eclipse.org/legal/epl-v10.html
7402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll *
8402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * Contributors:
9402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll *     IBM Corporation - initial API and implementation
10402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll *******************************************************************************/
11402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollpackage org.eclipse.test.internal.performance.results.model;
12402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
13402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollimport java.util.ArrayList;
14402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollimport java.util.Arrays;
15402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollimport java.util.Iterator;
16402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollimport java.util.List;
17402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollimport java.util.Vector;
18402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
19402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollimport org.eclipse.core.runtime.preferences.IEclipsePreferences;
20402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollimport org.eclipse.core.runtime.preferences.InstanceScope;
21402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollimport org.eclipse.test.internal.performance.results.db.AbstractResults;
22402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollimport org.eclipse.test.internal.performance.results.db.ComponentResults;
23402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollimport org.eclipse.test.internal.performance.results.db.PerformanceResults;
24402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollimport org.eclipse.test.internal.performance.results.db.ScenarioResults;
25402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollimport org.eclipse.test.internal.performance.results.utils.IPerformancesConstants;
26402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollimport org.eclipse.test.internal.performance.results.utils.Util;
27402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollimport org.eclipse.ui.views.properties.IPropertyDescriptor;
28402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollimport org.eclipse.ui.views.properties.PropertyDescriptor;
29402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollimport org.eclipse.ui.views.properties.TextPropertyDescriptor;
30402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
31402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollpublic class ComponentResultsElement extends ResultsElement {
32402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
33402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	// Property descriptors
34402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	static final String P_ID_NAME = "ComponentResultsElement.name"; //$NON-NLS-1$
35402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	static final String P_ID_CURRENT_BUILD = "ComponentResultsElement.currentbuild"; //$NON-NLS-1$
36402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	static final String P_ID_BASELINE_BUILD = "ComponentResultsElement.baselinebuild"; //$NON-NLS-1$
37402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
38402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	static final String P_STR_NAME = "name"; //$NON-NLS-1$
39402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	static final String P_STR_CURRENT_BUILD = "current build"; //$NON-NLS-1$
40402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	static final String P_STR_BASELINE_BUILD = "baseline build"; //$NON-NLS-1$
41402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
42402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	private static final TextPropertyDescriptor NAME_DESCRIPTOR = new TextPropertyDescriptor(P_ID_NAME, P_STR_NAME);
43402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	private static final PropertyDescriptor CURRENT_BUILD_DESCRIPTOR = new PropertyDescriptor(P_ID_CURRENT_BUILD, P_STR_CURRENT_BUILD);
44402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	private static final PropertyDescriptor BASELINE_BUILD_DESCRIPTOR = new PropertyDescriptor(P_ID_BASELINE_BUILD, P_STR_BASELINE_BUILD);
45402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
46402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll    private static Vector DESCRIPTORS;
47402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll    static Vector initDescriptors(int status) {
48402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll        DESCRIPTORS = new Vector();
49402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		// Status category
50402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		DESCRIPTORS.add(getInfosDescriptor(status));
51402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		DESCRIPTORS.add(getWarningsDescriptor(status));
52402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		DESCRIPTORS.add(ERROR_DESCRIPTOR);
53402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		ERROR_DESCRIPTOR.setCategory("Status");
54402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		// Results category
55402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		DESCRIPTORS.addElement(NAME_DESCRIPTOR);
56402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		NAME_DESCRIPTOR.setCategory("Results");
57402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		DESCRIPTORS.addElement(CURRENT_BUILD_DESCRIPTOR);
58402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		CURRENT_BUILD_DESCRIPTOR.setCategory("Results");
59402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		DESCRIPTORS.addElement(BASELINE_BUILD_DESCRIPTOR);
60402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		BASELINE_BUILD_DESCRIPTOR.setCategory("Results");
61402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		// Survey category
62402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		DESCRIPTORS.add(COMMENT_DESCRIPTOR);
63402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		COMMENT_DESCRIPTOR.setCategory("Survey");
64402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll        return DESCRIPTORS;
65402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	}
66402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll    static Vector getDescriptors() {
67402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll    	return DESCRIPTORS;
68402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	}
69402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
70402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollpublic ComponentResultsElement(String name, ResultsElement parent) {
71402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	super(name, parent);
72402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll}
73402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
74402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollpublic ComponentResultsElement(AbstractResults results, ResultsElement parent) {
75402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	super(results, parent);
76402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll}
77402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
78402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll/*
79402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * Do not create non-fingerprint child when only fingerprint is specified.
80402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll *
81402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * @see org.eclipse.test.internal.performance.results.model.ResultsElement#createChild(org.eclipse.test.internal.performance.results.db.AbstractResults)
82402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll */
83402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael MollResultsElement createChild(AbstractResults testResults) {
84402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll//	if (onlyFingerprints()) {
85402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll//		ScenarioResults scenarioResults = (ScenarioResults) testResults;
86402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll//		if (!scenarioResults.hasSummary()) {
87402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll//			return null;
88402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll//		}
89402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll//	}
90402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	return new ScenarioResultsElement(testResults, this);
91402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll}
92402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
93402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll/**
94402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * Get all results numbers for a given machine of the current component.
95402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll *
96402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * @param configName The name of the configuration to get numbers
97402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * @param fingerprints Set whether only fingerprints scenario should be taken into account
98402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * @return A list of lines. Each line represent a build and is a list of either strings or values.
99402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll */
100402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollpublic List getConfigNumbers(String configName, boolean fingerprints) {
101402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	if (this.results == null) return null;
102402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	return ((ComponentResults)this.results).getConfigNumbers(configName, fingerprints, new ArrayList());
103402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll}
104402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
105402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll/* (non-Javadoc)
106402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
107402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll */
108402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollpublic IPropertyDescriptor[] getPropertyDescriptors() {
109402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	Vector descriptors = getDescriptors();
110402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	if (descriptors == null) {
111402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		descriptors = initDescriptors(getStatus());
112402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	}
113402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	int size = descriptors.size();
114402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	IPropertyDescriptor[] descriptorsArray = new IPropertyDescriptor[size];
115402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	descriptorsArray[0] = getInfosDescriptor(getStatus());
116402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	descriptorsArray[1] = getWarningsDescriptor(getStatus());
117402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	for (int i=2; i<size; i++) {
118402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		descriptorsArray[i] = (IPropertyDescriptor) descriptors.get(i);
119402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	}
120402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	return descriptorsArray;
121402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll}
122402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
123402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll/* (non-Javadoc)
124402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
125402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll */
126402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollpublic Object getPropertyValue(Object propKey) {
127402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	if (propKey.equals(P_ID_NAME)) {
128402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		return getName();
129402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	}
130402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	if (propKey.equals(P_ID_CURRENT_BUILD)) {
131402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		if (this.results == null) {
132402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll			PerformanceResultsElement performanceResultsElement = (PerformanceResultsElement) getParent(null);
133402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll			return performanceResultsElement.getName();
134402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		}
135402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		PerformanceResults performanceResults = (PerformanceResults) this.results.getParent();
136402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		return performanceResults.getName();
137402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	}
138402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	if (propKey.equals(P_ID_BASELINE_BUILD)) {
139402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		if (this.results == null) {
140402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll			return "?";
141402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		}
142402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		PerformanceResults performanceResults = (PerformanceResults) this.results.getParent();
143402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		return performanceResults.getBaselineName();
144402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	}
145402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll    return super.getPropertyValue(propKey);
146402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll}
147402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
148402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll/**
149402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * Get the list of the scenarios results from the model. Put only fingerprint ones if specified.
150402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll *
151402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * @param fingerprint Tell whether only fingerprint scenarios are expected or not.
152402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * @return A list of {@link ScenarioResults}.
153402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll */
154402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollpublic List getScenarios(boolean fingerprint) {
155402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	if (!fingerprint) {
156402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		return Arrays.asList(this.results.getChildren());
157402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	}
158402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	List scenarios = new ArrayList();
159402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	if (this.results != null) {
160402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		Iterator iterator = this.results.getResults();
161402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		while (iterator.hasNext()) {
162402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll			ScenarioResults scenarioResults = (ScenarioResults) iterator.next();
163402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll			if (scenarioResults.hasSummary()) {
164402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll				scenarios.add(scenarioResults);
165402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll			}
166402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		}
167402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	}
168402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	return scenarios;
169402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll}
170402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
171402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll/**
172402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * Get the list of the scenarios names. Put only fingerprint ones if specified.
173402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll *
174402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * @param fingerprint Tell whether only fingerprint scenarios are expected or not.
175402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * @return A list of {@link String}.
176402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll */
177402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollpublic List getScenariosLabels(boolean fingerprint) {
178402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	List labels = new ArrayList();
179402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	if (this.results != null) {
180402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		AbstractResults[] scenarios = this.results.getChildren();
181402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		int length = scenarios.length;
182402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		for (int i=0; i<length; i++) {
183402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll			ScenarioResults scenarioResults = (ScenarioResults) scenarios[i];
184402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll			if (!fingerprint || scenarioResults.hasSummary()) {
185402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll				labels.add(scenarioResults.getLabel());
186402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll			}
187402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		}
188402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	}
189402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	return labels;
190402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll}
191402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
192402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll/*
193402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * (non-Javadoc)
194402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll * @see org.eclipse.test.internal.performance.results.model.ResultsElement#initStatus()
195402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll */
196402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Mollvoid initStatus() {
197402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	if (this.results == null) {
198402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		this.status = UNREAD;
199402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	} else {
200402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		super.initStatus();
201402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	}
202402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll}
203402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
204402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael MollStringBuffer writableStatus(StringBuffer buffer, int kind, StringBuffer excluded) {
205402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	// Write status for scenarios having error
206402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	if ((getStatus() & ERROR_MASK) != 0) {
207402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
208402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		// Get children status
209402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		StringBuffer childrenBuffer = super.writableStatus(new StringBuffer(), kind, excluded);
210402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
211402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		// Write status on file if not excluded
212402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		if (childrenBuffer.length() > 0) {
213402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll			buffer.append(getName());
214402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll			IEclipsePreferences preferences = new InstanceScope().getNode(IPerformancesConstants.PLUGIN_ID);
215402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll			String comment = preferences.get(getId(), null);
216402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll			if (comment != null) {
217402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll				if ((kind & IPerformancesConstants.STATUS_VALUES) != 0) {
218402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll					buffer.append("												");
219402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll				} else {
220402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll					buffer.append("			");
221402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll				}
222402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll				buffer.append(comment);
223402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll			}
224402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll			buffer.append(Util.LINE_SEPARATOR);
225402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll			buffer.append(childrenBuffer);
226402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll			buffer.append(Util.LINE_SEPARATOR);
227402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll		}
228402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	}
229402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll	return buffer;
230402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll}
231402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll
232402794e73aed8611d62eb4b01cd155e2d76fcb87Raphael Moll}
233