/*******************************************************************************
- * Copyright (c) 2014 École Polytechnique de Montréal
+ * Copyright (c) 2014, 2015 É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
package org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.xychart;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.Activator;
import org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems;
import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.linecharts.TmfCommonXLineChartViewer;
import org.w3c.dom.Element;
/** Timeout between updates in the updateData thread */
private static final long BUILD_UPDATE_TIMEOUT = 500;
- @SuppressWarnings("null")
- private static final @NonNull Pattern WILDCARD_PATTERN = Pattern.compile("\\*"); //$NON-NLS-1$
+ private static final Pattern WILDCARD_PATTERN = checkNotNull(Pattern.compile("\\*")); //$NON-NLS-1$
private final ITmfXmlModelFactory fFactory = TmfXmlReadOnlyModelFactory.getInstance();
private final Map<Integer, SeriesData> fSeriesData = new HashMap<>();
public List<Integer> getQuarks() {
/* Get the list of quarks to process with this path */
String[] paths = fPath.split(SPLIT_STRING);
- @SuppressWarnings("null")
- @NonNull List<Integer> quarks = Collections.singletonList(IXmlStateSystemContainer.ROOT_QUARK);
+ List<Integer> quarks = checkNotNull(Collections.singletonList(IXmlStateSystemContainer.ROOT_QUARK));
try {
for (String path : paths) {
seriesName = ss.getAttributeName(quark);
}
}
- if (seriesName == null) {
- throw new IllegalStateException();
- }
fSeriesData.put(quark, new SeriesData(xvalues.length, display.getAttributeQuark(quark), seriesName, entry.getType()));
}
double yvalue = 0.0;
/*
* No analysis specified, take all state system analysis modules
*/
- for (ITmfAnalysisModuleWithStateSystems module : trace.getAnalysisModulesOfClass(ITmfAnalysisModuleWithStateSystems.class)) {
+ for (ITmfAnalysisModuleWithStateSystems module : TmfTraceUtils.getAnalysisModulesOfClass(trace, ITmfAnalysisModuleWithStateSystems.class)) {
stateSystemModules.add(module);
}
} else {
for (String moduleId : analysisIds) {
- @SuppressWarnings("resource")
- ITmfAnalysisModuleWithStateSystems module = trace.getAnalysisModuleOfClass(ITmfAnalysisModuleWithStateSystems.class, moduleId);
+ moduleId = checkNotNull(moduleId);
+ ITmfAnalysisModuleWithStateSystems module = TmfTraceUtils.getAnalysisModuleOfClass(trace, ITmfAnalysisModuleWithStateSystems.class, moduleId);
if (module != null) {
stateSystemModules.add(module);
}
return;
}
Element displayElement = displayElements.get(0);
+ if (displayElement == null) {
+ throw new IllegalStateException();
+ }
fDisplay = fFactory.createStateAttribute(displayElement, entry);
/* Get the series name element to use */
List<Element> seriesNameElements = XmlUtils.getChildElements(entryElement, TmfXmlUiStrings.NAME_ELEMENT);
if (!seriesNameElements.isEmpty()) {
Element seriesNameElement = seriesNameElements.get(0);
+ if (seriesNameElement == null) {
+ throw new IllegalStateException();
+ }
fSeriesName = fFactory.createStateAttribute(seriesNameElement, entry);
}