import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.linuxtools.internal.tmf.analysis.xml.ui.Activator;
import org.eclipse.linuxtools.internal.tmf.analysis.xml.ui.TmfXmlUiStrings;
import org.eclipse.linuxtools.internal.tmf.analysis.xml.ui.views.xychart.XmlXYView;
/**
* Enum to match the name of a view's XML element to its view ID.
+ * @since 1.1
*/
- private static enum ViewType {
+ public static enum ViewType {
+ /**
+ * Time graph view element
+ */
TIME_GRAPH_VIEW(TmfXmlUiStrings.TIME_GRAPH_VIEW, XmlTimeGraphView.ID),
+ /**
+ * XY chart view element
+ */
XY_VIEW(TmfXmlUiStrings.XY_VIEW, XmlXYView.ID);
- private final String fXmlElem;
+ private final @NonNull String fXmlElem;
private final String fViewId;
- private ViewType(String xmlElem, String viewId) {
+ private ViewType(@NonNull String xmlElem, String viewId) {
fXmlElem = xmlElem;
fViewId = viewId;
}
- public String getXmlElem() {
+ /**
+ * Get the XML element corresponding to this view type
+ *
+ * @return The XML element corresponding to this type
+ */
+ public @NonNull String getXmlElem() {
return fXmlElem;
}
- public String getViewId() {
+ private String getViewId() {
return fViewId;
}
}
String analysisId = analysis.getAttribute(TmfXmlStrings.ID);
if (analysisId.equals(module.getId())) {
String viewId = viewType.getViewId();
- IAnalysisOutput output = new TmfXmlViewOutput(viewId);
+ IAnalysisOutput output = new TmfXmlViewOutput(viewId, viewType);
output.setOutputProperty(TmfXmlUiStrings.XML_OUTPUT_DATA, node.getAttribute(TmfXmlStrings.ID) + DATA_SEPARATOR + xmlFile.getAbsolutePath(), false);
module.registerOutput(output);
}
import org.eclipse.linuxtools.internal.tmf.analysis.xml.ui.TmfXmlUiStrings;
import org.eclipse.linuxtools.tmf.analysis.xml.core.module.XmlUtils;
import org.eclipse.linuxtools.tmf.analysis.xml.core.stateprovider.TmfXmlStrings;
+import org.eclipse.linuxtools.tmf.analysis.xml.ui.module.TmfXmlAnalysisOutputSource.ViewType;
import org.eclipse.linuxtools.tmf.ui.analysis.TmfAnalysisViewOutput;
import org.w3c.dom.Element;
public class TmfXmlViewOutput extends TmfAnalysisViewOutput {
private String fLabel = null;
+ private final @NonNull ViewType fViewType;
/**
* Constructor
* id of the view to display as output
*/
public TmfXmlViewOutput(String viewid) {
+ this(viewid, ViewType.TIME_GRAPH_VIEW);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param viewid
+ * id of the view to display as output
+ * @param viewType
+ * type of view this output is for
+ * @since 1.1
+ */
+ public TmfXmlViewOutput(String viewid, @NonNull ViewType viewType) {
super(viewid);
+ fViewType = viewType;
}
@Override
if ((viewId == null) || (filePath == null)) {
return;
}
- Element viewElement = XmlUtils.getElementInFile(filePath, TmfXmlUiStrings.TIME_GRAPH_VIEW, viewId);
+ Element viewElement = XmlUtils.getElementInFile(filePath, fViewType.getXmlElem(), viewId);
if (viewElement == null) {
return;
}