org.eclipse.tracecompass.segmentstore.core,
org.eclipse.tracecompass.analysis.timing.core
Export-Package: org.eclipse.tracecompass.internal.tmf.analysis.xml.core;x-friends:="org.eclipse.tracecompass.tmf.analysis.xml.core.tests",
- org.eclipse.tracecompass.internal.tmf.analysis.xml.core.pattern.stateprovider;x-internal:=true,
+ org.eclipse.tracecompass.internal.tmf.analysis.xml.core.pattern.stateprovider;x-friends:="org.eclipse.tracecompass.tmf.analysis.xml.ui",
org.eclipse.tracecompass.tmf.analysis.xml.core.model,
org.eclipse.tracecompass.tmf.analysis.xml.core.model.readonly,
org.eclipse.tracecompass.tmf.analysis.xml.core.model.readwrite,
org.eclipse.tracecompass.common.core,
org.eclipse.tracecompass.tmf.core,
org.eclipse.tracecompass.tmf.ui,
- org.eclipse.tracecompass.tmf.analysis.xml.core
+ org.eclipse.tracecompass.tmf.analysis.xml.core,
+ org.eclipse.tracecompass.analysis.timing.core,
+ org.eclipse.tracecompass.analysis.timing.ui,
+ org.eclipse.tracecompass.segmentstore.core,
+ org.swtchart
Export-Package: org.eclipse.tracecompass.internal.tmf.analysis.xml.ui;x-friends:="org.eclipse.tracecompass.tmf.analysis.xml.ui.tests",
org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.handler;x-internal:=true,
+ org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.module;x-internal:=true,
org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views;x-internal:=true,
+ org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency;x-internal:=true,
org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.xychart;x-internal:=true,
org.eclipse.tracecompass.tmf.analysis.xml.ui.module,
org.eclipse.tracecompass.tmf.analysis.xml.ui.views.timegraph
xmltimegraph.view.name = XML Time Graph View
xmlxychart.view.name = XML XY Chart View
+
+latency.view.name = Latency Table
name="%xmlxychart.view.name"
restorable="true">
</view>
+ <view
+ allowMultiple="false"
+ category="org.eclipse.linuxtools.tmf.ui.views.category"
+ class="org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency.PatternLatencyTableView"
+ icon="icons/eview16/latency.png"
+ id="org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latencytable"
+ name="%latency.view.name"
+ restorable="true">
+ </view>
</extension>
</plugin>
/* Generic strings for the XML module */
static final String XML_OUTPUT_DATA = "xmlOutputData";
+ static final String XML_LATENCY_OUTPUT_DATA = "xmlLatencyOutputData";
+
}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.module;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Message for the XML analysis output
+ *
+ * @author Jean-Christian Kouame
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.module.messages"; //$NON-NLS-1$
+ /** Latency table */
+ public static String TmfXmlAnalysisOutputSource_LatencyTable;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
--- /dev/null
+###############################################################################
+# Copyright (c) 2016 Ericsson
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+TmfXmlAnalysisOutputSource_LatencyTable=Latency Table
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.Activator;
+import org.eclipse.tracecompass.tmf.analysis.xml.ui.module.TmfXmlAnalysisOutputSource;
+
+/**
+ * Abstract class to manage information about a view for an XML analysis
+ *
+ * @author Jean-Christian Kouame
+ */
+public abstract class AbstractXmlViewInfo {
+
+ private final String fViewId;
+
+ /**
+ * Constructor
+ *
+ * @param viewId
+ * The ID of the view
+ */
+ public AbstractXmlViewInfo(String viewId) {
+ fViewId = viewId;
+ }
+
+ /**
+ * Get this view property section from the settings. The property section is
+ * per view ID.
+ *
+ * @return The property section
+ */
+ protected IDialogSettings getPersistentPropertyStore() {
+ IDialogSettings settings = Activator.getDefault().getDialogSettings();
+ IDialogSettings section = settings.getSection(fViewId);
+ if (section == null) {
+ section = settings.addNewSection(fViewId);
+ if (section == null) {
+ throw new IllegalStateException("The persistent property section could not be added"); //$NON-NLS-1$
+ }
+ }
+ return section;
+ }
+
+ /**
+ * Set the data for this view and retrieves from it the parameter the view needs
+ *
+ * @param data
+ * A string of the form "param1" +
+ * {@link TmfXmlAnalysisOutputSource#DATA_SEPARATOR} +
+ * "param2"
+ */
+ public abstract void setViewData(@NonNull String data);
+
+ /**
+ * Save this view persistent data into the settings. For example, user could
+ * save the view ID or the label, ...
+ */
+ protected abstract void savePersistentData();
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.tracecompass.tmf.analysis.xml.ui.module.TmfXmlAnalysisOutputSource;
+
+/**
+ * Class that manages information about a latency view for pattern analysis: its
+ * title, the analysis ID, etc.
+ *
+ * @author Jean-Christian Kouame
+ *
+ */
+public class XmlLatencyViewInfo extends AbstractXmlViewInfo {
+
+ private static final String XML_LATENCY_VIEW_ANALYSIS_ID_PROPERTY = "XmlLatencyAnalysisId"; //$NON-NLS-1$
+ private static final String XML_LATENCY_VIEW_LABEL_PROPERTY = "XmlLatencyViewLabel"; //$NON-NLS-1$
+
+ private @Nullable String fAnalysisId = null;
+ private @Nullable String fLabel = null;
+
+ /**
+ * Constructor
+ *
+ * @param viewId
+ * The ID of the view
+ */
+ public XmlLatencyViewInfo(String viewId) {
+ super(viewId);
+
+ IDialogSettings settings = getPersistentPropertyStore();
+ fAnalysisId = settings.get(XML_LATENCY_VIEW_ANALYSIS_ID_PROPERTY);
+ fLabel = settings.get(XML_LATENCY_VIEW_LABEL_PROPERTY);
+ }
+
+ /**
+ * Get the analysis ID this view is for
+ *
+ * @return The analysis ID this view
+ */
+ public String getViewAnalysisId() {
+ return fAnalysisId;
+ }
+
+ /**
+ * Set the data for this view and retrieves from it the analysis ID of the
+ * pattern analysis this view belongs to and the view label.
+ *
+ * @param data
+ * A string of the form "XML analysis ID" +
+ * {@link TmfXmlAnalysisOutputSource#DATA_SEPARATOR} +
+ * "latency view label"
+ */
+ @Override
+ public void setViewData(String data) {
+ String[] idFile = data.split(TmfXmlAnalysisOutputSource.DATA_SEPARATOR);
+ fAnalysisId = (idFile.length > 0) ? idFile[0] : null;
+ fLabel = (idFile.length > 1) ? idFile[1] : null;
+ savePersistentData();
+ }
+
+ @Override
+ protected void savePersistentData() {
+ IDialogSettings settings = getPersistentPropertyStore();
+
+ settings.put(XML_LATENCY_VIEW_ANALYSIS_ID_PROPERTY, fAnalysisId);
+ settings.put(XML_LATENCY_VIEW_LABEL_PROPERTY, fLabel);
+ }
+}
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.Activator;
import org.eclipse.tracecompass.tmf.analysis.xml.core.module.XmlUtils;
import org.eclipse.tracecompass.tmf.analysis.xml.core.stateprovider.TmfXmlStrings;
import org.eclipse.tracecompass.tmf.analysis.xml.ui.module.TmfXmlAnalysisOutputSource;
* @author Geneviève Bastien
*/
@NonNullByDefault
-public class XmlViewInfo {
+public class XmlViewInfo extends AbstractXmlViewInfo {
private static final String XML_VIEW_ID_PROPERTY = "XmlViewId"; //$NON-NLS-1$
private static final String XML_VIEW_FILE_PROPERTY = "XmlViewFile"; //$NON-NLS-1$
- private final String fViewId;
+ /** This is the ID of the view described in the XML file */
private @Nullable String fId = null;
private @Nullable String fFilePath = null;
* The ID of the view
*/
public XmlViewInfo(String viewId) {
- fViewId = viewId;
+ super(viewId);
IDialogSettings settings = getPersistentPropertyStore();
-
fId = settings.get(XML_VIEW_ID_PROPERTY);
fFilePath = settings.get(XML_VIEW_FILE_PROPERTY);
}
* {@link TmfXmlAnalysisOutputSource#DATA_SEPARATOR} +
* "path of the file containing the XML element"
*/
+ @Override
public void setViewData(String data) {
String[] idFile = data.split(TmfXmlAnalysisOutputSource.DATA_SEPARATOR);
fId = (idFile.length > 0) ? idFile[0] : null;
savePersistentData();
}
- private IDialogSettings getPersistentPropertyStore() {
- IDialogSettings settings = Activator.getDefault().getDialogSettings();
- IDialogSettings section = settings.getSection(fViewId);
- if (section == null) {
- section = settings.addNewSection(fViewId);
- if (section == null) {
- throw new IllegalStateException();
- }
- }
- return section;
- }
-
- private void savePersistentData() {
+ @Override
+ protected void savePersistentData() {
IDialogSettings settings = getPersistentPropertyStore();
settings.put(XML_VIEW_ID_PROPERTY, fId);
}
return analysisIds;
}
-
}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.table.AbstractSegmentStoreTableView;
+import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.table.AbstractSegmentStoreTableViewer;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.TmfXmlUiStrings;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.XmlLatencyViewInfo;
+
+/**
+ * The latency table view for pattern analysis
+ *
+ * @author Jean-Christian Kouame
+ */
+public class PatternLatencyTableView extends AbstractSegmentStoreTableView {
+
+ /** The view's ID */
+ public static final @NonNull String ID = "org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latencytable"; //$NON-NLS-1$
+
+ private final XmlLatencyViewInfo fViewInfo = new XmlLatencyViewInfo(ID);
+
+ private PatternLatencyTableViewer fViewer;
+
+ /**
+ * Constructor
+ */
+ public PatternLatencyTableView() {
+ this.addPartPropertyListener(new IPropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getProperty().equals(TmfXmlUiStrings.XML_LATENCY_OUTPUT_DATA)) {
+ Object newValue = event.getNewValue();
+ if (newValue instanceof String) {
+ String data = (String) newValue;
+ fViewInfo.setViewData(data);
+ loadLatencyView();
+ }
+ }
+ }
+ });
+ }
+
+ private void loadLatencyView() {
+ if (fViewer != null) {
+ fViewer.updateViewer(fViewInfo.getViewAnalysisId());
+ }
+ }
+
+ @Override
+ protected @NonNull AbstractSegmentStoreTableViewer createSegmentStoreViewer(@NonNull TableViewer tableViewer) {
+ PatternLatencyTableViewer viewer = new PatternLatencyTableViewer(tableViewer);
+ fViewer = viewer;
+ loadLatencyView();
+ return viewer;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider;
+import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.table.AbstractSegmentStoreTableViewer;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.pattern.stateprovider.XmlPatternAnalysis;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
+
+/**
+ * Displays the latency analysis data in a column table
+ *
+ * @author Jean-Christian Kouame
+ */
+public class PatternLatencyTableViewer extends AbstractSegmentStoreTableViewer {
+
+ private String fAnalysisId;
+
+ /**
+ * Constructor
+ *
+ * @param tableViewer
+ * The table viewer
+ */
+ public PatternLatencyTableViewer(@NonNull TableViewer tableViewer) {
+ super(tableViewer);
+ }
+
+ @Override
+ protected @Nullable ISegmentStoreProvider getSegmentStoreProvider(@NonNull ITmfTrace trace) {
+ return fAnalysisId != null ? TmfTraceUtils.getAnalysisModuleOfClass(trace, XmlPatternAnalysis.class, fAnalysisId) : null;
+ }
+
+ /**
+ * Set the analysis ID and update the view
+ *
+ * @param analysisId
+ * The analysis ID
+ */
+ public void updateViewer(String analysisId) {
+ if (analysisId != null) {
+ fAnalysisId = analysisId;
+ final ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
+ if (trace != null) {
+ setData(getSegmentStoreProvider(trace));
+ }
+ }
+ }
+
+}
/*******************************************************************************
- * Copyright (c) 2014 École Polytechnique de Montréal
+ * Copyright (c) 2016 École Polytechnique de Montréal and others
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.pattern.stateprovider.XmlPatternAnalysis;
import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.Activator;
import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.TmfXmlUiStrings;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.module.Messages;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency.PatternLatencyTableView;
import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.xychart.XmlXYView;
import org.eclipse.tracecompass.tmf.analysis.xml.core.module.XmlUtils;
import org.eclipse.tracecompass.tmf.analysis.xml.core.stateprovider.TmfXmlStrings;
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisOutput;
import org.eclipse.tracecompass.tmf.core.analysis.ITmfNewAnalysisModuleListener;
-import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
+import org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
}
}
+ /**
+ * Enum for latency view type.
+ *
+ * @author Jean-Christian Kouame
+ * @since 2.0
+ *
+ */
+ public static enum LatencyViewType {
+
+ /**
+ * Latency Table View type
+ */
+ LATENCY_TABLE(PatternLatencyTableView.ID, Messages.TmfXmlAnalysisOutputSource_LatencyTable);
+
+ private @NonNull String fLatencyViewId;
+ private String fLatencyViewLabel;
+
+ private LatencyViewType(@NonNull String viewId, String label) {
+ fLatencyViewId = viewId;
+ fLatencyViewLabel = label;
+ }
+
+ /**
+ * Get the ID of the latency view
+ *
+ * @return The ID
+ */
+ public String getViewId() {
+ return fLatencyViewId;
+ }
+
+ /**
+ * Get the label of the view
+ *
+ * @return The label
+ */
+ public String getLabel() {
+ return fLatencyViewLabel;
+ }
+ }
@Override
public void moduleCreated(IAnalysisModule module) {
doc.getDocumentElement().normalize();
/* get state provider views if the analysis has state systems */
- if (module instanceof TmfStateSystemAnalysisModule) {
+ if (module instanceof ITmfAnalysisModuleWithStateSystems) {
for (ViewType viewType : ViewType.values()) {
NodeList ssViewNodes = doc.getElementsByTagName(viewType.getXmlElem());
for (int i = 0; i < ssViewNodes.getLength(); i++) {
}
}
}
+
+ //Add the latency views for pattern analysis
+ if (module instanceof XmlPatternAnalysis) {
+ for (LatencyViewType viewType : LatencyViewType.values()) {
+ IAnalysisOutput output = new TmfXmlLatencyViewOutput(viewType.getViewId(), viewType.getLabel());
+ output.setOutputProperty(TmfXmlUiStrings.XML_LATENCY_OUTPUT_DATA, module.getId() + DATA_SEPARATOR + viewType.getLabel(), false);
+ module.registerOutput(output);
+ }
+ }
+
} catch (ParserConfigurationException | SAXException | IOException e) {
Activator.logError("Error opening XML file", e); //$NON-NLS-1$
}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.tracecompass.tmf.analysis.xml.ui.module;
+
+import org.eclipse.tracecompass.tmf.ui.analysis.TmfAnalysisViewOutput;
+
+/**
+ * Class overriding the default analysis view output for XML pattern analysis
+ * latency views
+ *
+ * @author Jean-Christian Kouame
+ * @since 2.0
+ *
+ */
+public class TmfXmlLatencyViewOutput extends TmfAnalysisViewOutput {
+
+ private String fLabel;
+
+ /**
+ * @param viewid
+ * The ID of the view
+ * @param label
+ * The label of view
+ */
+ public TmfXmlLatencyViewOutput(String viewid, String label) {
+ super(viewid);
+ fLabel = label;
+ }
+
+ @Override
+ public String getName() {
+ return fLabel;
+ }
+}