Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: I3abe736fd48fbfa2ee159e2c059c3c95bce37b11 Signed-off-by: Qing Chi <chiqing2010@163.com> Reviewed-on: https://git.eclipse.org/r/160134 Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org> Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net> Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net> Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
- Loading branch information
1 parent
c69f7e2
commit ac0abb4
Showing
8 changed files
with
200 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...rc/org/eclipse/tracecompass/incubator/internal/scripting/ui/views/histogram/Messages.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 VMware | ||
* | ||
* 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.histogram; | ||
|
||
import org.eclipse.osgi.util.NLS; | ||
|
||
/** | ||
* Messages related to the {@link ScriptedHistogramView} | ||
* | ||
* @author Qing Chi | ||
*/ | ||
public class Messages extends NLS { | ||
|
||
private static final String BUNDLE_NAME = "org.eclipse.tracecompass.incubator.internal.scripting.ui.views.histogram.messages"; //$NON-NLS-1$ | ||
|
||
/** Default Viewer title */ | ||
public static String ScriptedHistogramTreeViewer_DefaultViewerTitle; | ||
/** default x axis title */ | ||
public static String ScriptedHistogramTreeViewer_DefaultXAxis; | ||
/** default y axis title */ | ||
public static String ScriptedHistogramTreeViewer_DefaultYAxis; | ||
|
||
static { | ||
// initialize resource bundle | ||
NLS.initializeMessages(BUNDLE_NAME, Messages.class); | ||
} | ||
|
||
private Messages() { | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
...e/tracecompass/incubator/internal/scripting/ui/views/histogram/ScriptedHistogramView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 VMware | ||
* | ||
* 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.histogram; | ||
|
||
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.ui.viewers.TmfViewer; | ||
import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.TmfXYChartViewer; | ||
import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.linecharts.TmfXYChartSettings; | ||
import org.eclipse.tracecompass.tmf.ui.views.TmfChartView; | ||
|
||
/** | ||
* 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 ScriptedHistogramView 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.histogram"; //$NON-NLS-1$ | ||
|
||
/** | ||
* Default Constructor | ||
*/ | ||
public ScriptedHistogramView() { | ||
super(ID); | ||
} | ||
|
||
@Override | ||
protected TmfXYChartViewer createChartViewer(Composite parent) { | ||
TmfXYChartSettings settings = new TmfXYChartSettings(Messages.ScriptedHistogramTreeViewer_DefaultViewerTitle, Messages.ScriptedHistogramTreeViewer_DefaultXAxis, Messages.ScriptedHistogramTreeViewer_DefaultYAxis, 1); | ||
return new ScriptedHistogramViewer(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(ScriptedHistogramView.COLON, ":"); //$NON-NLS-1$ | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
...tracecompass/incubator/internal/scripting/ui/views/histogram/ScriptedHistogramViewer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 VMware | ||
* | ||
* 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.histogram; | ||
|
||
import org.eclipse.jdt.annotation.NonNull; | ||
import org.eclipse.swt.widgets.Composite; | ||
import org.eclipse.tracecompass.tmf.core.presentation.IYAppearance; | ||
import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.linecharts.TmfFilteredXYChartViewer; | ||
import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.linecharts.TmfXYChartSettings; | ||
|
||
/** | ||
* Viewer for the {@link ScriptedHistogramView} | ||
* | ||
* @author Qing Chi | ||
*/ | ||
public class ScriptedHistogramViewer extends TmfFilteredXYChartViewer { | ||
|
||
private static final int DEFAULT_SERIES_WIDTH = 1; | ||
|
||
public ScriptedHistogramViewer(Composite parent, TmfXYChartSettings settings, String providerId) { | ||
super(parent, settings, providerId); | ||
} | ||
|
||
@Override | ||
public IYAppearance getSeriesAppearance(@NonNull String seriesName) { | ||
return getPresentationProvider().getAppearance(seriesName, IYAppearance.Type.BAR, DEFAULT_SERIES_WIDTH); | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
.../eclipse/tracecompass/incubator/internal/scripting/ui/views/histogram/messages.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
############################################################################### | ||
# Copyright (c) 2020 VMware | ||
# | ||
# 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 | ||
############################################################################### | ||
|
||
ScriptedHistogramTreeViewer_DefaultViewerTitle=Scripted Histogram Viewer | ||
ScriptedHistogramTreeViewer_DefaultXAxis=Time | ||
ScriptedHistogramTreeViewer_DefaultYAxis=Unit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters