84bd4b52b2905006dee8474eab9b93cf767a7609
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.analysis.xml.ui / src / org / eclipse / tracecompass / internal / tmf / analysis / xml / ui / views / AbstractXmlViewInfo.java
1 /*******************************************************************************
2 * Copyright (c) 2016 Ericsson
3 *
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;
10
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.eclipse.jface.dialogs.IDialogSettings;
13 import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.Activator;
14 import org.eclipse.tracecompass.tmf.analysis.xml.ui.module.TmfXmlAnalysisOutputSource;
15
16 /**
17 * Abstract class to manage information about a view for an XML analysis
18 *
19 * @author Jean-Christian Kouame
20 */
21 public abstract class AbstractXmlViewInfo {
22
23 private final String fViewId;
24
25 /**
26 * Constructor
27 *
28 * @param viewId
29 * The ID of the view
30 */
31 public AbstractXmlViewInfo(String viewId) {
32 fViewId = viewId;
33 }
34
35 /**
36 * Get this view property section from the settings. The property section is
37 * per view ID.
38 *
39 * @return The property section
40 */
41 protected IDialogSettings getPersistentPropertyStore() {
42 IDialogSettings settings = Activator.getDefault().getDialogSettings();
43 IDialogSettings section = settings.getSection(fViewId);
44 if (section == null) {
45 section = settings.addNewSection(fViewId);
46 if (section == null) {
47 throw new IllegalStateException("The persistent property section could not be added"); //$NON-NLS-1$
48 }
49 }
50 return section;
51 }
52
53 /**
54 * Set the data for this view and retrieves from it the parameter the view needs
55 *
56 * @param data
57 * A string of the form "param1" +
58 * {@link TmfXmlAnalysisOutputSource#DATA_SEPARATOR} +
59 * "param2"
60 */
61 public abstract void setViewData(@NonNull String data);
62
63 /**
64 * Save this view persistent data into the settings. For example, user could
65 * save the view ID or the label, ...
66 */
67 protected abstract void savePersistentData();
68 }
This page took 0.033051 seconds and 4 git commands to generate.