-
Notifications
You must be signed in to change notification settings - Fork 11
/
ScriptedScatterView.java
67 lines (55 loc) · 2.65 KB
/
ScriptedScatterView.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*******************************************************************************
* Copyright (c) 2020 VMware, Inc.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
* accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.tracecompass.incubator.internal.scripting.ui.views.scatter;
import java.util.Objects;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.tracecompass.incubator.internal.scripting.ui.views.xychart.ScriptedXYTreeViewer;
import org.eclipse.tracecompass.tmf.core.component.DataProviderConstants;
import org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer;
import org.eclipse.tracecompass.tmf.ui.views.xychart.TmfChartView;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer;
import org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfXYChartSettings;
/**
* A data provider view to display the results of a scripted analysis. It uses
* the secondary ID as the data provider ID to display
*
* @author Qing Chi
*/
public class ScriptedScatterView extends TmfChartView {
/**
* Because colons are not allowed in secondary IDs, but can be present in
* data provider IDs, they can be replaced upstream by this string and it
* will be replaced again when getting the data provider ID.
*/
public static final String COLON = "[COLON]"; //$NON-NLS-1$
/** The view ID. */
public static final String ID = "org.eclipse.tracecompass.incubator.internal.scripting.ui.views.scatter"; //$NON-NLS-1$
/**
* Default Constructor
*/
public ScriptedScatterView() {
super(ID);
}
@Override
protected TmfXYChartViewer createChartViewer(Composite parent) {
TmfXYChartSettings settings = new TmfXYChartSettings(Messages.ScriptedScatterTreeViewer_DefaultViewerTitle, Messages.ScriptedScatterTreeViewer_DefaultXAxis, Messages.ScriptedScatterTreeViewer_DefaultYAxis, 1);
return new ScriptedScatterViewer(parent, settings, getSecondaryIdName());
}
@Override
protected @NonNull TmfViewer createLeftChildViewer(@Nullable Composite parent) {
return new ScriptedXYTreeViewer(Objects.requireNonNull(parent), getSecondaryIdName());
}
private String getSecondaryIdName() {
return getViewSite().getSecondaryId().replace(ScriptedScatterView.COLON, DataProviderConstants.ID_SEPARATOR);
}
}