1 /*******************************************************************************
2 * Copyright (c) 2016 Ericsson
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
8 *******************************************************************************/
9 package org
.eclipse
.tracecompass
.internal
.tmf
.analysis
.xml
.ui
.views
;
11 import org
.eclipse
.jdt
.annotation
.Nullable
;
12 import org
.eclipse
.jface
.dialogs
.IDialogSettings
;
13 import org
.eclipse
.tracecompass
.tmf
.analysis
.xml
.ui
.module
.TmfXmlAnalysisOutputSource
;
16 * Class that manages information about a latency view for pattern analysis: its
17 * title, the analysis ID, etc.
19 * @author Jean-Christian Kouame
22 public class XmlLatencyViewInfo
extends AbstractXmlViewInfo
{
24 private static final String XML_LATENCY_VIEW_ANALYSIS_ID_PROPERTY
= "XmlLatencyAnalysisId"; //$NON-NLS-1$
25 private static final String XML_LATENCY_VIEW_LABEL_PROPERTY
= "XmlLatencyViewLabel"; //$NON-NLS-1$
27 private @Nullable String fAnalysisId
= null;
28 private @Nullable String fLabel
= null;
36 public XmlLatencyViewInfo(String viewId
) {
39 IDialogSettings settings
= getPersistentPropertyStore();
40 fAnalysisId
= settings
.get(XML_LATENCY_VIEW_ANALYSIS_ID_PROPERTY
);
41 fLabel
= settings
.get(XML_LATENCY_VIEW_LABEL_PROPERTY
);
45 * Get the analysis ID this view is for
47 * @return The analysis ID this view
49 public String
getViewAnalysisId() {
54 * Set the data for this view and retrieves from it the analysis ID of the
55 * pattern analysis this view belongs to and the view label.
58 * A string of the form "XML analysis ID" +
59 * {@link TmfXmlAnalysisOutputSource#DATA_SEPARATOR} +
60 * "latency view label"
63 public void setViewData(String data
) {
64 String
[] idFile
= data
.split(TmfXmlAnalysisOutputSource
.DATA_SEPARATOR
);
65 fAnalysisId
= (idFile
.length
> 0) ? idFile
[0] : null;
66 fLabel
= (idFile
.length
> 1) ? idFile
[1] : null;
71 protected void savePersistentData() {
72 IDialogSettings settings
= getPersistentPropertyStore();
74 settings
.put(XML_LATENCY_VIEW_ANALYSIS_ID_PROPERTY
, fAnalysisId
);
75 settings
.put(XML_LATENCY_VIEW_LABEL_PROPERTY
, fLabel
);