From c6f55e56f17464ebdf08c77709ca712dd86371d7 Mon Sep 17 00:00:00 2001 From: Francois Chouinard Date: Sat, 10 Mar 2012 10:30:06 -0500 Subject: [PATCH] Fix yet another batch of FnidBugs warnings --- .../linuxtools/lttng/ui/TraceDebug.java | 12 +-- .../model/trange/TimeRangeEventProcess.java | 92 +++++++++++++++++++ .../model/trange/TimeRangeViewerProvider.java | 13 ++- .../tracecontrol/actions/ConfigureTrace.java | 24 ++--- .../subsystems/TraceSubSystem.java | 3 +- .../KernelTraceChannelConfigurationPage.java | 5 +- .../ui/views/common/AbsTimeUpdateView.java | 6 +- .../lttng/ui/views/common/ParamsUpdater.java | 33 ++++--- .../ui/views/controlflow/ControlFlowView.java | 30 +++--- .../evProcessor/FlowAfterUpdateHandlers.java | 10 +- .../ui/views/latency/dialogs/AddDialog.java | 8 +- .../views/latency/dialogs/DeleteDialog.java | 8 +- .../ui/views/latency/dialogs/ListDialog.java | 4 +- .../ui/views/resources/ResourcesView.java | 6 +- .../ui/views/statistics/StatisticsView.java | 10 +- .../ui/views/statistics/model/FixedArray.java | 21 +++-- .../model/KernelStatisticsData.java | 17 ++-- .../ui/views/timeframe/SpinnerGroup.java | 5 - 18 files changed, 199 insertions(+), 108 deletions(-) diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/TraceDebug.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/TraceDebug.java index 0e451cfe79..9cefc4b17d 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/TraceDebug.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/TraceDebug.java @@ -39,20 +39,20 @@ public class TraceDebug { String warnTrace = Platform.getDebugOption(pluginID + "/warn"); if (debugTrace != null) { - DEBUG = (new Boolean(debugTrace)).booleanValue(); + DEBUG = Boolean.valueOf(debugTrace); } if (infoTrace != null) { - INFO = (new Boolean(infoTrace)).booleanValue(); + INFO = Boolean.valueOf(infoTrace); } if (warnTrace != null) { - WARN = (new Boolean(warnTrace)).booleanValue(); + WARN = Boolean.valueOf(warnTrace); } String cfvTrace = Platform.getDebugOption(pluginID + "/cfv"); if (cfvTrace != null) { - CFV = (new Boolean(cfvTrace)).booleanValue(); + CFV = Boolean.valueOf(cfvTrace); if (CFV) { try { fCFVfile = new PrintWriter(new FileWriter("CFVTrace.txt")); @@ -64,7 +64,7 @@ public class TraceDebug { String rvTrace = Platform.getDebugOption(pluginID + "/rv"); if (rvTrace != null) { - RV = (new Boolean(rvTrace)).booleanValue(); + RV = Boolean.valueOf(rvTrace); if (RV) { try { fRVfile = new PrintWriter(new FileWriter("RVTrace.txt")); @@ -76,7 +76,7 @@ public class TraceDebug { String svTrace = Platform.getDebugOption(pluginID + "/sv"); if (svTrace != null) { - SV = (new Boolean(svTrace)).booleanValue(); + SV = Boolean.valueOf(svTrace); if (SV) { try { fSVfile = new PrintWriter(new FileWriter("SVTrace.txt")); diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java index 5b40baa464..23e755082a 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeEventProcess.java @@ -229,4 +229,96 @@ public class TimeRangeEventProcess extends TimeRangeComposite implements ",trace=" + traceID + ",ptype=" + processType + ",cpu=" + cpu + ",brand=" + brand + "]"; } + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((brand == null) ? 0 : brand.hashCode()); + result = prime * result + ((cpu == null) ? 0 : cpu.hashCode()); + result = prime * result + ((creationTime == null) ? 0 : creationTime.hashCode()); + result = prime * result + ((pid == null) ? 0 : pid.hashCode()); + result = prime * result + ((ppid == null) ? 0 : ppid.hashCode()); + result = prime * result + ((processType == null) ? 0 : processType.hashCode()); + result = prime * result + ((tgid == null) ? 0 : tgid.hashCode()); + result = prime * result + ((traceID == null) ? 0 : traceID.hashCode()); + return result; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof TimeRangeEventProcess)) { + return false; + } + TimeRangeEventProcess other = (TimeRangeEventProcess) obj; + if (brand == null) { + if (other.brand != null) { + return false; + } + } else if (!brand.equals(other.brand)) { + return false; + } + if (cpu == null) { + if (other.cpu != null) { + return false; + } + } else if (!cpu.equals(other.cpu)) { + return false; + } + if (creationTime == null) { + if (other.creationTime != null) { + return false; + } + } else if (!creationTime.equals(other.creationTime)) { + return false; + } + if (pid == null) { + if (other.pid != null) { + return false; + } + } else if (!pid.equals(other.pid)) { + return false; + } + if (ppid == null) { + if (other.ppid != null) { + return false; + } + } else if (!ppid.equals(other.ppid)) { + return false; + } + if (processType == null) { + if (other.processType != null) { + return false; + } + } else if (!processType.equals(other.processType)) { + return false; + } + if (tgid == null) { + if (other.tgid != null) { + return false; + } + } else if (!tgid.equals(other.tgid)) { + return false; + } + if (traceID == null) { + if (other.traceID != null) { + return false; + } + } else if (!traceID.equals(other.traceID)) { + return false; + } + return true; + } + } diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeViewerProvider.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeViewerProvider.java index 67f0edc200..304f75c661 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeViewerProvider.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/model/trange/TimeRangeViewerProvider.java @@ -13,7 +13,7 @@ package org.eclipse.linuxtools.lttng.ui.model.trange; import java.util.HashMap; import java.util.Map; -import java.util.Set; +import java.util.Map.Entry; import org.eclipse.linuxtools.lttng.core.state.StateStrings.BdevMode; import org.eclipse.linuxtools.lttng.core.state.StateStrings.CpuMode; @@ -230,12 +230,11 @@ public class TimeRangeViewerProvider extends TmfTimeAnalysisProvider { } protected String findObject(StateColor Value, Map map) { - Set keys = map.keySet(); - for (String key : keys) { - if (map.get(key).equals(Value)) { - return key; - } - } + for (Entry entry : map.entrySet()) { + if (entry.getValue().equals(Value)) { + return entry.getKey(); + } + } return "Not Found"; //$NON-NLS-1$ } } diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/ConfigureTrace.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/ConfigureTrace.java index 1de3979504..a95e13a972 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/ConfigureTrace.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/actions/ConfigureTrace.java @@ -97,7 +97,7 @@ public class ConfigureTrace implements IObjectActionDelegate, IWorkbenchWindowAc final TraceConfig result = wizard.getTraceConfig(); if (result != null) { - try { +// try { // Update channel settings TraceChannels channels = result.getTraceChannels(); @@ -167,17 +167,17 @@ public class ConfigureTrace implements IObjectActionDelegate, IWorkbenchWindowAc ISystemRegistry registry = SystemStartHere.getSystemRegistry(); registry.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED, fSelectedTrace, fSelectedTrace.getParent(), fSelectedTrace.getSubSystem(), null); - } catch (Exception e) { - SystemMessageException sysExp; - if (e instanceof SystemMessageException) { - sysExp = (SystemMessageException)e; - } else { - sysExp = new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e)); - } - - SystemBasePlugin.logError(Messages.Lttng_Control_ErrorConfigureTrace + " (" + //$NON-NLS-1$ - Messages.Lttng_Resource_Trace + ": " + fSelectedTrace.getName() + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$ - } +// } catch (SystemMessageException e) { +// SystemMessageException sysExp; +// if (e instanceof SystemMessageException) { +// sysExp = (SystemMessageException)e; +// } else { +// sysExp = new SystemMessageException(LTTngUiPlugin.getDefault().getMessage(e)); +// } +// +// SystemBasePlugin.logError(Messages.Lttng_Control_ErrorConfigureTrace + " (" + //$NON-NLS-1$ +// Messages.Lttng_Resource_Trace + ": " + fSelectedTrace.getName() + ")", sysExp); //$NON-NLS-1$ //$NON-NLS-2$ +// } } } diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/subsystems/TraceSubSystem.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/subsystems/TraceSubSystem.java index 4fe301d3d4..77213aee73 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/subsystems/TraceSubSystem.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/subsystems/TraceSubSystem.java @@ -69,6 +69,7 @@ public class TraceSubSystem extends SubSystem implements ICommunicationsListener // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ + private ProviderResource[] fProviders; // master list of Providers // ------------------------------------------------------------------------ @@ -198,7 +199,7 @@ public class TraceSubSystem extends SubSystem implements ICommunicationsListener } } } - return fProviders; + return (fProviders != null) ? Arrays.copyOf(fProviders, fProviders.length) : null; } /** diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/KernelTraceChannelConfigurationPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/KernelTraceChannelConfigurationPage.java index 1a90b4b2fe..565cfa284b 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/KernelTraceChannelConfigurationPage.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/tracecontrol/wizards/KernelTraceChannelConfigurationPage.java @@ -69,6 +69,7 @@ public class KernelTraceChannelConfigurationPage extends WizardPage implements I // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ + private TraceChannels fChannels; private TraceState fTraceState; private Composite container; @@ -323,7 +324,7 @@ public class KernelTraceChannelConfigurationPage extends WizardPage implements I /* * Local class to configure table columns */ - final public class ColumnData { + private static final class ColumnData { // Name of the column. public final String header; // Width of the column. @@ -477,7 +478,7 @@ public class KernelTraceChannelConfigurationPage extends WizardPage implements I * Local class dialog box implementation for setting values for all * rows for a given column */ - public class SetDialog extends Dialog { + private static final class SetDialog extends Dialog { // ------------------------------------------------------------------------ // Attributes diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java index 204709808e..524db2fb45 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/AbsTimeUpdateView.java @@ -146,7 +146,7 @@ public abstract class AbsTimeUpdateView extends TmfView implements IRequestStatu boolean clearData = request.isclearDataInd(); // Indicate if current data needs to be cleared and if so // specify the new experiment time range that applies - ModelUpdatePrep(trange, clearData); + modelUpdatePrep(trange, clearData); } } @@ -597,7 +597,7 @@ public abstract class AbsTimeUpdateView extends TmfView implements IRequestStatu * - new total time range e.g. Experiment level * @param clearAllData */ - protected void ModelUpdatePrep(TmfTimeRange timeRange, boolean clearAllData) { + protected void modelUpdatePrep(TmfTimeRange timeRange, boolean clearAllData) { ItemContainer itemContainer = getItemContainer(); if (clearAllData) { // start fresh e.g. new experiment selected @@ -632,7 +632,7 @@ public abstract class AbsTimeUpdateView extends TmfView implements IRequestStatu * @param visibleRange * @param source */ - protected void ModelUpdateInit(TmfTimeRange boundaryRange, TmfTimeRange visibleRange, Object source) { + protected void modelUpdateInit(TmfTimeRange boundaryRange, TmfTimeRange visibleRange, Object source) { // Update the view boundaries if (boundaryRange != null) { ItemContainer itemContainer = getItemContainer(); diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/ParamsUpdater.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/ParamsUpdater.java index 5f3b76d368..d1dafc275e 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/ParamsUpdater.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/common/ParamsUpdater.java @@ -30,23 +30,22 @@ public class ParamsUpdater { // Data // ======================================================================== - private long startTime = 0; - private long endTime = Long.MAX_VALUE; - private Long selectedTime = null; - private final int DEFAULT_WIDTH = 2000; // number of estimated pixels - // that - // can hold the time range space - private int width = DEFAULT_WIDTH; // width in pixels used to represent the - // time interval - private double pixelsPerNs = 0; - private int eventsDiscarded = 0; - private int eventsDiscardedOutOfView = 0; - private int eventsDiscardedNotVisible = 0; - private int eventsDiscardedWrongOrder = 0; - private TmfTimeRange trange = null; - - public static final int OUT_OF_VIEWRANGE = 0; - public static final int NOT_VISIBLE = 1; + private long startTime = 0; + private long endTime = Long.MAX_VALUE; + private static Long selectedTime = null; + private final int DEFAULT_WIDTH = 2000; // number of estimated pixels that + // can hold the time range space + private int width = DEFAULT_WIDTH; // width in pixels used to represent the + // time interval + private double pixelsPerNs = 0; + private int eventsDiscarded = 0; + private int eventsDiscardedOutOfView = 0; + private int eventsDiscardedNotVisible = 0; + private int eventsDiscardedWrongOrder = 0; + private TmfTimeRange trange = null; + + public static final int OUT_OF_VIEWRANGE = 0; + public static final int NOT_VISIBLE = 1; // ======================================================================== // Methods diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java index 10c4b4cb60..c8dadad3dc 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/ControlFlowView.java @@ -162,7 +162,7 @@ public class ControlFlowView extends AbsTimeUpdateView implements * example). */ - class ViewContentProvider implements + static class ViewContentProvider implements /* ILazyContentProvider, */IStructuredContentProvider { private TableViewer cviewer = null; private ITmfTimeAnalysisEntry[] elements = null; @@ -198,7 +198,7 @@ public class ControlFlowView extends AbsTimeUpdateView implements } } - class ViewLabelProvider extends LabelProvider implements ITableLabelProvider { + static class ViewLabelProvider extends LabelProvider implements ITableLabelProvider { @Override public String getColumnText(Object obj, int index) { String strRes = ""; //$NON-NLS-1$ @@ -261,7 +261,7 @@ public class ControlFlowView extends AbsTimeUpdateView implements } } - class ViewProcessFilter extends ViewerFilter { + static class ViewProcessFilter extends ViewerFilter { private Vector filteredSet = new Vector(); StructuredViewer viewer; @@ -415,9 +415,6 @@ public class ControlFlowView extends AbsTimeUpdateView implements return; } - TableItem item; - int count; - switch (e.keyCode) { case SWT.PAGE_DOWN: updateScrollPageDown(); @@ -426,16 +423,13 @@ public class ControlFlowView extends AbsTimeUpdateView implements updateScrollUp(); break; case SWT.HOME: - // Home - count = table.getItemCount(); - item = table.getItem(0); // Go to the top scrollFrame.setOrigin(origin.x, 0); break; case SWT.END: // End Selected - count = table.getItemCount(); - item = table.getItem(count - 1); + int count = table.getItemCount(); + TableItem item = table.getItem(count - 1); int itemStartPos = item.getBounds().y; // Get to the bottom scrollFrame.setOrigin(origin.x, itemStartPos); @@ -547,10 +541,10 @@ public class ControlFlowView extends AbsTimeUpdateView implements // as well as time space width in pixels, used by the time analysis // widget // Read relevant values - int timeSpaceWidth = tsfviewer.getTimeSpace(); - if (timeSpaceWidth < 0) { - timeSpaceWidth = -timeSpaceWidth; - } +// int timeSpaceWidth = tsfviewer.getTimeSpace(); +// if (timeSpaceWidth < 0) { +// timeSpaceWidth = -timeSpaceWidth; +// } TmfExperiment experiment = TmfExperiment.getCurrentExperiment(); if (experiment != null) { @@ -562,7 +556,7 @@ public class ControlFlowView extends AbsTimeUpdateView implements experimentTRange); // initialize widget time boundaries and filtering parameters - ModelUpdateInit(experimentTRange, adjustedTimeRange, this); + modelUpdateInit(experimentTRange, adjustedTimeRange, this); } } else { TraceDebug.debug("No selected experiment information available"); //$NON-NLS-1$ @@ -1051,7 +1045,7 @@ public class ControlFlowView extends AbsTimeUpdateView implements initTimeRange = TmfTimeRange.NULL_RANGE; if (experimentTRange != TmfTimeRange.NULL_RANGE) { // prepare time intervals in widget - ModelUpdateInit(experimentTRange, experimentTRange, signal + modelUpdateInit(experimentTRange, experimentTRange, signal .getSource()); // request initial data @@ -1068,7 +1062,7 @@ public class ControlFlowView extends AbsTimeUpdateView implements if (experimentTRange != TmfTimeRange.NULL_RANGE) { // prepare time intervals in widget - ModelUpdateInit(experimentTRange, experimentTRange, signal.getSource()); + modelUpdateInit(experimentTRange, experimentTRange, signal.getSource()); // request initial data initialExperimentDataRequest(signal.getSource(), experimentTRange); diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowAfterUpdateHandlers.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowAfterUpdateHandlers.java index 2f04849d29..e014b7825e 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowAfterUpdateHandlers.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/controlflow/evProcessor/FlowAfterUpdateHandlers.java @@ -65,7 +65,7 @@ class FlowAfterUpdateHandlers { if (localProcess == null) { if ((pid_in == 0) || !pid_in.equals(process_in.getPpid())) { TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow(); - localProcess = addLocalProcess(process_in, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId()); + addLocalProcess(process_in, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId()); } else { TraceDebug @@ -138,7 +138,7 @@ class FlowAfterUpdateHandlers { if (localProcess == null) { if (child_pid == 0 || !child_pid.equals(process_child.getPpid())) { TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow(); - localProcess = addLocalProcess(process_child, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId()); + addLocalProcess(process_child, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId()); } else { TraceDebug.debug("localProcess is null with child_pid not 0 or child_pid equals PPID (getProcessForkHandler)"); //$NON-NLS-1$ @@ -191,7 +191,7 @@ class FlowAfterUpdateHandlers { if (localProcess == null) { if (process.getPid() == 0 || !process.getPid().equals(process.getPpid())) { TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow(); - localProcess = addLocalProcess(process, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId()); + addLocalProcess(process, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId()); } else { TraceDebug.debug("process pid is not 0 or pid equals ppid! (getProcessExitHandler)"); //$NON-NLS-1$ @@ -233,7 +233,7 @@ class FlowAfterUpdateHandlers { if (localProcess == null) { if (process.getPid() == 0 || !process.getPid().equals(process.getPpid())) { TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow(); - localProcess = addLocalProcess(process, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId()); + addLocalProcess(process, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId()); } else { TraceDebug.debug("process pid is not 0 or pid equals ppid! (getProcessExecHandler)"); //$NON-NLS-1$ @@ -283,7 +283,7 @@ class FlowAfterUpdateHandlers { if (localProcess == null) { if (process.getPid() == 0 || !process.getPid().equals(process.getPpid())) { TmfTimeRange timeRange = traceSt.getContext().getTraceTimeWindow(); - localProcess = addLocalProcess(process, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId()); + addLocalProcess(process, timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue(), traceSt.getTraceId()); } else { TraceDebug.debug("process pid is not 0 or pid equals ppid! (GetThreadBrandHandler)"); //$NON-NLS-1$ diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/AddDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/AddDialog.java index aee1ef9e44..692476be8f 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/AddDialog.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/AddDialog.java @@ -77,17 +77,17 @@ public class AddDialog extends AbstractDialog { /** * Start table column names (header titles). */ - protected static final String[] START_COLUMN_NAMES = { "", Messages.LatencyView_Dialogs_AddEvents_Columns_Start }; //$NON-NLS-1$ + static final String[] START_COLUMN_NAMES = { "", Messages.LatencyView_Dialogs_AddEvents_Columns_Start }; //$NON-NLS-1$ /** * End table column names (header titles). */ - protected static final String[] END_COLUMN_NAMES = { "", Messages.LatencyView_Dialogs_AddEvents_Columns_End }; //$NON-NLS-1$ + static final String[] END_COLUMN_NAMES = { "", Messages.LatencyView_Dialogs_AddEvents_Columns_End }; //$NON-NLS-1$ /** * List table column names (header titles). */ - protected static final String[] LIST_COLUMN_NAMES = { + static final String[] LIST_COLUMN_NAMES = { "#", //$NON-NLS-1$ Messages.LatencyView_Dialogs_AddEvents_Columns_List_Trigger, Messages.LatencyView_Dialogs_AddEvents_Columns_List_End }; @@ -95,7 +95,7 @@ public class AddDialog extends AbstractDialog { /** * Column widths. */ - protected static final int[] COLUMN_WIDTHS = { 25, 250, 250 }; + static final int[] COLUMN_WIDTHS = { 25, 250, 250 }; /** * Possible event types. diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/DeleteDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/DeleteDialog.java index c975688aa8..aea8e70d35 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/DeleteDialog.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/DeleteDialog.java @@ -84,18 +84,18 @@ public class DeleteDialog extends ListDialog { int[] selectedIndices = fTable.getSelectionIndices(); - String deletePairs = ""; //$NON-NLS-1$ + StringBuffer deletePairs = new StringBuffer(""); //$NON-NLS-1$ for (int i = 0; i < selectedIndices.length; i++) { int index = selectedIndices[i]; - deletePairs += "\t* " + fEventStartTypes.get(index) + " / " + fEventEndTypes.get(index); //$NON-NLS-1$ //$NON-NLS-2$ + deletePairs.append("\t* ").append(fEventStartTypes.get(index)).append(" / ").append(fEventEndTypes.get(index)); //$NON-NLS-1$ //$NON-NLS-2$ if (i < selectedIndices.length - 1) { - deletePairs += "\n"; //$NON-NLS-1$ + deletePairs.append("\n"); //$NON-NLS-1$ } } boolean confirmDeletion = MessageDialog.openQuestion(getShell(), Messages.LatencyView_Dialogs_DeleteEvents_Confirm_Title, - Messages.LatencyView_Dialogs_DeleteEvents_Confirm_Message + "\n\n" + deletePairs); //$NON-NLS-1$ + Messages.LatencyView_Dialogs_DeleteEvents_Confirm_Message + "\n\n" + deletePairs.toString()); //$NON-NLS-1$ if (confirmDeletion) { // Remove the events starting from the end of the list, otherwise the TableItem elements will lose diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/ListDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/ListDialog.java index fd993525a0..7fef702dc6 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/ListDialog.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/latency/dialogs/ListDialog.java @@ -68,12 +68,12 @@ public class ListDialog extends AbstractDialog { /** * Column names (header titles). */ - protected static final String[] COLUMN_NAMES = { "#", Messages.LatencyView_Dialogs_ListEvents_Columns_Trigger, Messages.LatencyView_Dialogs_ListEvents_Columns_End }; //$NON-NLS-1$ + static final String[] COLUMN_NAMES = { "#", Messages.LatencyView_Dialogs_ListEvents_Columns_Trigger, Messages.LatencyView_Dialogs_ListEvents_Columns_End }; //$NON-NLS-1$ /** * Column widths. */ - protected static final int[] COLUMN_WIDTHS = { 25, 250, 250 }; + static final int[] COLUMN_WIDTHS = { 25, 250, 250 }; /** * The table style. diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/ResourcesView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/ResourcesView.java index bbff53f0ef..8d28a6df3f 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/ResourcesView.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/resources/ResourcesView.java @@ -154,7 +154,7 @@ public class ResourcesView extends AbsTimeUpdateView implements TmfTimeRange adjustedTimeRange = initialExperimentDataRequest(this, experimentTRange); // initialize widget time boundaries and filtering parameters - ModelUpdateInit(experimentTRange, adjustedTimeRange, this); + modelUpdateInit(experimentTRange, adjustedTimeRange, this); } } else { TraceDebug.debug("No selected experiment information available"); //$NON-NLS-1$ @@ -505,7 +505,7 @@ public class ResourcesView extends AbsTimeUpdateView implements initTimeRange = TmfTimeRange.NULL_RANGE; if (experimentTRange != TmfTimeRange.NULL_RANGE) { // prepare time intervals in widget - ModelUpdateInit(experimentTRange, experimentTRange, signal.getSource()); + modelUpdateInit(experimentTRange, experimentTRange, signal.getSource()); // request initial data initialExperimentDataRequest(signal.getSource(), experimentTRange); @@ -520,7 +520,7 @@ public class ResourcesView extends AbsTimeUpdateView implements if (experimentTRange != TmfTimeRange.NULL_RANGE) { // prepare time intervals in widget - ModelUpdateInit(experimentTRange, experimentTRange, signal.getSource()); + modelUpdateInit(experimentTRange, experimentTRange, signal.getSource()); // request initial data initialExperimentDataRequest(signal.getSource(), experimentTRange); diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java index 946739ea81..af60a94bd6 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/StatisticsView.java @@ -127,7 +127,7 @@ public class StatisticsView extends AbsTimeUpdateView { /** * Contains all the information necessary to build a column of the table. */ - private class ColumnData { + private static class ColumnData { // Name of the column. public final String header; // Width of the column. @@ -292,7 +292,7 @@ public class StatisticsView extends AbsTimeUpdateView { * * @see org.eclipse.jface.viewers.ITreeContentProvider */ - class TreeContentProvider implements ITreeContentProvider { + private static class TreeContentProvider implements ITreeContentProvider { /* * (non-Javadoc) * @@ -571,7 +571,7 @@ public class StatisticsView extends AbsTimeUpdateView { } @Override - public void ModelUpdatePrep(TmfTimeRange timeRange, boolean clearAllData) { + public void modelUpdatePrep(TmfTimeRange timeRange, boolean clearAllData) { Object input = treeViewer.getInput(); if ((input != null) && (input instanceof StatisticsTreeNode) && (!treeViewer.getTree().isDisposed())) { if (clearAllData) { @@ -627,9 +627,9 @@ public class StatisticsView extends AbsTimeUpdateView { private static int level = 0; private void printRecursively(StatisticsTreeNode node) { - String tab = ""; //$NON-NLS-1$ + StringBuffer tab = new StringBuffer(""); //$NON-NLS-1$ for (int i = 0; i < level; i++) { - tab += "\t"; //$NON-NLS-1$ + tab.append("\t"); //$NON-NLS-1$ } level++; TraceDebug.traceSV(tab + node.getContent()); diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/FixedArray.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/FixedArray.java index 1275bce39a..7f50fb9e64 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/FixedArray.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/FixedArray.java @@ -26,7 +26,7 @@ import java.util.RandomAccess; * * @param Type of the array content. */ -public final class FixedArray implements RandomAccess { +public final class FixedArray implements RandomAccess, Cloneable { /** * Replace {@link java.util.Arrays#copyOf(Object[], int)} that do not exist in java 5. * @param array Original array to copy from. @@ -121,18 +121,23 @@ public final class FixedArray implements RandomAccess { public Object clone() { return new FixedArray(copyOf(fArray, fArray.length)); } + /* * (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override - public boolean equals(Object o) { - if (o == this) - return true; - if (o == null) - return false; - return Arrays.equals(fArray, ((FixedArray)o).fArray); - } + public boolean equals(Object other) { + if (this == other) + return true; + if (other == null) + return false; + if (!(other instanceof FixedArray)) + return false; + FixedArray array = (FixedArray) other; + return Arrays.equals(fArray, array.fArray); + } + /** * Gets value of given index. * @param index diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/KernelStatisticsData.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/KernelStatisticsData.java index abac0f7392..4e3122ac10 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/KernelStatisticsData.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/statistics/model/KernelStatisticsData.java @@ -16,8 +16,8 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; -import java.util.Set; import java.util.Map; +import java.util.Set; import org.eclipse.linuxtools.lttng.core.LttngConstants; import org.eclipse.linuxtools.lttng.core.event.LttngEvent; @@ -820,7 +820,7 @@ public class KernelStatisticsData extends StatisticsData { * @author bhufmann * */ - final private class KeyProvider { + private static final class KeyProvider { /** *

Instance counter for unique ID generation.

@@ -887,7 +887,7 @@ public class KernelStatisticsData extends StatisticsData { * @author bhufmann * */ - private class KeyHelper implements Cloneable { + private static final class KeyHelper implements Cloneable { // Short pre-fix private final static String UNKNOWN_PREFIX = "P"; //$NON-NLS-1$ @@ -916,7 +916,10 @@ public class KernelStatisticsData extends StatisticsData { return true; if (o == null) return false; - if (fValue == ((KeyHelper) o).fValue && fName.equals(((KeyHelper) o).fName)) { + if (!(o instanceof KeyHelper)) + return false; + KeyHelper kh = (KeyHelper) o; + if (fValue == kh.fValue && fName.equals(kh.fName)) { return true; } return false; @@ -970,7 +973,7 @@ public class KernelStatisticsData extends StatisticsData { * @author bhufmann * */ - final private class ProcessKeyProvider { + private static final class ProcessKeyProvider { /** *

Instance counter for unique ID generation.

*/ @@ -1029,7 +1032,7 @@ public class KernelStatisticsData extends StatisticsData { * @author bhufmann * */ - final class ProcessKey implements Cloneable { + private static final class ProcessKey implements Cloneable { private int fPid = 0; private int fCpuId = 0; private long fCreationTime = 0; @@ -1073,6 +1076,8 @@ public class KernelStatisticsData extends StatisticsData { return true; if (obj == null) return false; + if (!(obj instanceof ProcessKey)) + return false; ProcessKey procKey = (ProcessKey) obj; diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/SpinnerGroup.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/SpinnerGroup.java index d08ee40fa5..2d24800109 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/SpinnerGroup.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/timeframe/SpinnerGroup.java @@ -67,9 +67,6 @@ public class SpinnerGroup { private int currentSeconds; private int currentNanosec; - @SuppressWarnings("unused") - private TimeFrameView fOwner; - /** * Constructor *

@@ -84,8 +81,6 @@ public class SpinnerGroup { */ public SpinnerGroup(TimeFrameView owner, Composite parent, String groupName, TmfTimeRange range, ITmfTimestamp current) { - fOwner = owner; - // Create the group group = new Group(parent, SWT.BORDER); group.setText(groupName); -- 2.34.1