lttng/tmf: Enable and fix parameter assignment warnings
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Fri, 4 Jan 2013 20:58:44 +0000 (15:58 -0500)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Mon, 7 Jan 2013 23:18:30 +0000 (18:18 -0500)
FindBugs also warns for these, so might as well have them
enabled straight within Eclipse.

Change-Id: I1318a26c22e1bb379b5af02e1fc4840c2cd39093
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/9472
Tested-by: Hudson CI
32 files changed:
org.eclipse.linuxtools.ctf.core.tests/.settings/org.eclipse.jdt.core.prefs
org.eclipse.linuxtools.ctf.core/.settings/org.eclipse.jdt.core.prefs
org.eclipse.linuxtools.ctf.parser/.settings/org.eclipse.jdt.core.prefs
org.eclipse.linuxtools.lttng2.core.tests/.settings/org.eclipse.jdt.core.prefs
org.eclipse.linuxtools.lttng2.core/.settings/org.eclipse.jdt.core.prefs
org.eclipse.linuxtools.lttng2.kernel.core.tests/.settings/org.eclipse.jdt.core.prefs
org.eclipse.linuxtools.lttng2.kernel.core/.settings/org.eclipse.jdt.core.prefs
org.eclipse.linuxtools.lttng2.kernel.ui.tests/.settings/org.eclipse.jdt.core.prefs
org.eclipse.linuxtools.lttng2.kernel.ui/.settings/org.eclipse.jdt.core.prefs
org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowView.java
org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/resources/ResourcesView.java
org.eclipse.linuxtools.lttng2.ui.tests/.settings/org.eclipse.jdt.core.prefs
org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/shells/LTTngToolsFileShell.java
org.eclipse.linuxtools.lttng2.ui/.settings/org.eclipse.jdt.core.prefs
org.eclipse.linuxtools.tmf.core.tests/.settings/org.eclipse.jdt.core.prefs
org.eclipse.linuxtools.tmf.core/.settings/org.eclipse.jdt.core.prefs
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/StateSystem.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/filter/model/TmfFilterMatchesNode.java
org.eclipse.linuxtools.tmf.ui.tests/.settings/org.eclipse.jdt.core.prefs
org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/test/stub/views/TsfTraceAnalysisView.java
org.eclipse.linuxtools.tmf.ui/.settings/org.eclipse.jdt.core.prefs
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomTxtParserInputWizardPage.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/parsers/wizards/CustomXmlParserInputWizardPage.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/filter/FilterViewer.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramView.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/HistogramZoom.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/TimeGraphViewer.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphScale.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/Utils.java
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/virtualtable/TmfVirtualTable.java

index 917694be1e0bc32659fa58e180e0ce4a4d6ca7ac..bca8c277d1a92859366d3c086a78249037f4e1ed 100644 (file)
@@ -66,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
 org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
 org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
 org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
index c99144bbfef1345e4be7a6d1c66b641f91828784..eaedcd3086eb0c24d0284c646fc835fea74cc290 100644 (file)
@@ -66,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
 org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
 org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
 org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
index 13d904dd2a02cffe6376b55720f499d05fb6f679..9c7325f16a20392ba94f590a738cc7b80576360c 100644 (file)
@@ -66,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
 org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
 org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
 org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
index 917694be1e0bc32659fa58e180e0ce4a4d6ca7ac..bca8c277d1a92859366d3c086a78249037f4e1ed 100644 (file)
@@ -66,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
 org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
 org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
 org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
index 917694be1e0bc32659fa58e180e0ce4a4d6ca7ac..bca8c277d1a92859366d3c086a78249037f4e1ed 100644 (file)
@@ -66,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
 org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
 org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
 org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
index 917694be1e0bc32659fa58e180e0ce4a4d6ca7ac..bca8c277d1a92859366d3c086a78249037f4e1ed 100644 (file)
@@ -66,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
 org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
 org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
 org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
index 917694be1e0bc32659fa58e180e0ce4a4d6ca7ac..bca8c277d1a92859366d3c086a78249037f4e1ed 100644 (file)
@@ -66,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
 org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
 org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
 org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
index 917694be1e0bc32659fa58e180e0ce4a4d6ca7ac..bca8c277d1a92859366d3c086a78249037f4e1ed 100644 (file)
@@ -66,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
 org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
 org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
 org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
index 917694be1e0bc32659fa58e180e0ce4a4d6ca7ac..bca8c277d1a92859366d3c086a78249037f4e1ed 100644 (file)
@@ -66,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
 org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
 org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
 org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
index 21a382ede72ca473bf2cdf10245d497fe5fbc92d..d5a4ab9a4f369e817d7b2048cf9f71ae74965d6c 100644 (file)
@@ -746,16 +746,16 @@ public class ControlFlowView extends TmfView {
     private static List<ITimeEvent> getEventList(ControlFlowEntry entry,
             long startTime, long endTime, long resolution,
             IProgressMonitor monitor) {
-        startTime = Math.max(startTime, entry.getStartTime());
-        endTime = Math.min(endTime, entry.getEndTime());
-        if (endTime <= startTime) {
+        final long realStart = Math.max(startTime, entry.getStartTime());
+        final long realEnd = Math.min(endTime, entry.getEndTime());
+        if (realEnd <= realStart) {
             return null;
         }
         ITmfStateSystem ssq = entry.getTrace().getStateSystem(CtfKernelTrace.STATE_ID);
         List<ITimeEvent> eventList = null;
         try {
             int statusQuark = ssq.getQuarkRelative(entry.getThreadQuark(), Attributes.STATUS);
-            List<ITmfStateInterval> statusIntervals = ssq.queryHistoryRange(statusQuark, startTime, endTime - 1, resolution, monitor);
+            List<ITmfStateInterval> statusIntervals = ssq.queryHistoryRange(statusQuark, realStart, realEnd - 1, resolution, monitor);
             eventList = new ArrayList<ITimeEvent>(statusIntervals.size());
             long lastEndTime = -1;
             for (ITmfStateInterval statusInterval : statusIntervals) {
index 4001bad67d91f4198f6f2e38dc0dad8a73541100..0348a7f3b6f7c83af0e7167157b05377e649b2bd 100644 (file)
@@ -564,9 +564,9 @@ public class ResourcesView extends TmfView {
             long startTime, long endTime, long resolution, boolean includeNull,
             IProgressMonitor monitor) {
         ITmfStateSystem ssq = entry.getTrace().getStateSystem(CtfKernelTrace.STATE_ID);
-        startTime = Math.max(startTime, ssq.getStartTime());
-        endTime = Math.min(endTime, ssq.getCurrentEndTime() + 1);
-        if (endTime <= startTime) {
+        final long realStart = Math.max(startTime, ssq.getStartTime());
+        final long realEnd = Math.min(endTime, ssq.getCurrentEndTime() + 1);
+        if (realEnd <= realStart) {
             return null;
         }
         List<ITimeEvent> eventList = null;
@@ -574,7 +574,7 @@ public class ResourcesView extends TmfView {
         try {
             if (entry.getType().equals(Type.CPU)) {
                 int statusQuark = ssq.getQuarkRelative(quark, Attributes.STATUS);
-                List<ITmfStateInterval> statusIntervals = ssq.queryHistoryRange(statusQuark, startTime, endTime - 1, resolution, monitor);
+                List<ITmfStateInterval> statusIntervals = ssq.queryHistoryRange(statusQuark, realStart, realEnd - 1, resolution, monitor);
                 eventList = new ArrayList<ITimeEvent>(statusIntervals.size());
                 long lastEndTime = -1;
                 for (ITmfStateInterval statusInterval : statusIntervals) {
@@ -597,7 +597,7 @@ public class ResourcesView extends TmfView {
                     }
                 }
             } else if (entry.getType().equals(Type.IRQ)) {
-                List<ITmfStateInterval> irqIntervals = ssq.queryHistoryRange(quark, startTime, endTime - 1, resolution, monitor);
+                List<ITmfStateInterval> irqIntervals = ssq.queryHistoryRange(quark, realStart, realEnd - 1, resolution, monitor);
                 eventList = new ArrayList<ITimeEvent>(irqIntervals.size());
                 long lastEndTime = -1;
                 boolean lastIsNull = true;
@@ -623,7 +623,7 @@ public class ResourcesView extends TmfView {
                     lastEndTime = time + duration;
                 }
             } else if (entry.getType().equals(Type.SOFT_IRQ)) {
-                List<ITmfStateInterval> softIrqIntervals = ssq.queryHistoryRange(quark, startTime, endTime - 1, resolution, monitor);
+                List<ITmfStateInterval> softIrqIntervals = ssq.queryHistoryRange(quark, realStart, realEnd - 1, resolution, monitor);
                 eventList = new ArrayList<ITimeEvent>(softIrqIntervals.size());
                 long lastEndTime = -1;
                 boolean lastIsNull = true;
index 917694be1e0bc32659fa58e180e0ce4a4d6ca7ac..bca8c277d1a92859366d3c086a78249037f4e1ed 100644 (file)
@@ -66,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
 org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
 org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
 org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
index f96fbef969cb0023326d8c928b0e441efe508e26..ce97fd5b096d1557a243b797631607d31d4311f2 100644 (file)
@@ -230,10 +230,10 @@ public class LTTngToolsFileShell extends TestCommandShell {
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.lttng.stubs.service.shells.TestCommandShell#executeCommand(java.lang.String, org.eclipse.core.runtime.IProgressMonitor, boolean)
      */
-    @SuppressWarnings("nls")
     @Override
    public synchronized ICommandResult executeCommand(String command, IProgressMonitor monitor, boolean checkReturnValue) throws ExecutionException {
         Map<String, ICommandResult> commands = fScenarioMap.get(fScenario);
+        String fullCommand = command;
 
         Matcher matcher = LTTNG_LIST_SESSION_PATTERN.matcher(command);
         if (matcher.matches() && !command.matches(LTTNG_LIST_PROVIDER_PATTERN)) {
@@ -245,15 +245,15 @@ public class LTTngToolsFileShell extends TestCommandShell {
                 i = 0;
             }
             fSessionNameMap.put(sessionName, i);
-            command += String.valueOf(i);
+            fullCommand += String.valueOf(i);
         }
 
-        if (commands.containsKey(command)) {
-            return commands.get(command);
+        if (commands.containsKey(fullCommand)) {
+            return commands.get(fullCommand);
         }
 
         String[] output = new String[1];
-        output[0] = String.valueOf("Command not found");
+        output[0] = String.valueOf("Command not found"); //$NON-NLS-1$
         CommandResult result = new CommandResult(0, null);
         // For verification of setters of class CommandResult
         result.setOutput(output);
index 917694be1e0bc32659fa58e180e0ce4a4d6ca7ac..bca8c277d1a92859366d3c086a78249037f4e1ed 100644 (file)
@@ -66,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
 org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
 org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
 org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
index 917694be1e0bc32659fa58e180e0ce4a4d6ca7ac..bca8c277d1a92859366d3c086a78249037f4e1ed 100644 (file)
@@ -66,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
 org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
 org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
 org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
index 917694be1e0bc32659fa58e180e0ce4a4d6ca7ac..bca8c277d1a92859366d3c086a78249037f4e1ed 100644 (file)
@@ -66,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
 org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
 org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
 org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
index e6baedbd04a5ec00eb650b7b449319d3f4d4920b..a77c8557ab1f8f506e0de2a256263a6443520370 100644 (file)
@@ -603,8 +603,9 @@ public class StateSystem implements ITmfStateSystemBuilder {
         ITmfStateInterval currentInterval;
         long ts, tEnd;
 
-        if (monitor == null) {
-            monitor = new NullProgressMonitor();
+        IProgressMonitor mon = monitor;
+        if (mon == null) {
+            mon = new NullProgressMonitor();
         }
 
         /* Make sure the time range makes sense */
@@ -630,7 +631,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
          */
         for (ts = t1; (currentInterval.getEndTime() != -1) && (ts < tEnd);
                 ts += resolution) {
-            if (monitor.isCanceled()) {
+            if (mon.isCanceled()) {
                 return intervals;
             }
             if (ts <= currentInterval.getEndTime()) {
index eb3d5ae48e7149e22cb5610ec24471515ec350f1..3728a295351d9c350efd880fc79549174a96b70d 100644 (file)
@@ -29,76 +29,80 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
 public class TmfFilterMatchesNode extends TmfFilterTreeNode {
 
     public static final String NODE_NAME = "MATCHES"; //$NON-NLS-1$
-       public static final String NOT_ATTR = "not"; //$NON-NLS-1$
-       public static final String FIELD_ATTR = "field"; //$NON-NLS-1$
-       public static final String REGEX_ATTR = "regex"; //$NON-NLS-1$
-
-       private boolean fNot = false;
-       private String fField;
-       private String fRegex;
-       private Pattern fPattern;
-
-       /**
-        * @param parent the parent node
-        */
-       public TmfFilterMatchesNode(ITmfFilterTreeNode parent) {
-               super(parent);
-       }
-
-       /**
-        * @return the NOT state
-        */
-       public boolean isNot() {
-               return fNot;
-       }
-
-       /**
-        * @param not the NOT state
-        */
-       public void setNot(boolean not) {
-               this.fNot = not;
-       }
-
-       /**
-        * @return the field name
-        */
-       public String getField() {
-               return fField;
-       }
-
-       /**
-        * @param field the field name
-        */
-       public void setField(String field) {
-               this.fField = field;
-       }
-
-       /**
-        * @return the regular expression
-        */
-       public String getRegex() {
-               return fRegex;
-       }
-
-       /**
-        * @param regex the regular expression
-        */
-       public void setRegex(String regex) {
-               this.fRegex = regex;
-               try {
-                       this.fPattern = Pattern.compile(regex);
-               } catch (PatternSyntaxException e) {
-                       this.fPattern = null;
-               }
-       }
-
-       @Override
-       public String getNodeName() {
-               return NODE_NAME;
-       }
-
-       @Override
-       public boolean matches(ITmfEvent event) {
+    public static final String NOT_ATTR = "not"; //$NON-NLS-1$
+    public static final String FIELD_ATTR = "field"; //$NON-NLS-1$
+    public static final String REGEX_ATTR = "regex"; //$NON-NLS-1$
+
+    private boolean fNot = false;
+    private String fField;
+    private String fRegex;
+    private Pattern fPattern;
+
+    /**
+     * @param parent
+     *            the parent node
+     */
+    public TmfFilterMatchesNode(ITmfFilterTreeNode parent) {
+        super(parent);
+    }
+
+    /**
+     * @return the NOT state
+     */
+    public boolean isNot() {
+        return fNot;
+    }
+
+    /**
+     * @param not
+     *            the NOT state
+     */
+    public void setNot(boolean not) {
+        this.fNot = not;
+    }
+
+    /**
+     * @return the field name
+     */
+    public String getField() {
+        return fField;
+    }
+
+    /**
+     * @param field
+     *            the field name
+     */
+    public void setField(String field) {
+        this.fField = field;
+    }
+
+    /**
+     * @return the regular expression
+     */
+    public String getRegex() {
+        return fRegex;
+    }
+
+    /**
+     * @param regex
+     *            the regular expression
+     */
+    public void setRegex(String regex) {
+        this.fRegex = regex;
+        try {
+            this.fPattern = Pattern.compile(regex);
+        } catch (PatternSyntaxException e) {
+            this.fPattern = null;
+        }
+    }
+
+    @Override
+    public String getNodeName() {
+        return NODE_NAME;
+    }
+
+    @Override
+    public boolean matches(ITmfEvent event) {
         if (fPattern == null) {
             return false ^ fNot;
         }
@@ -110,37 +114,39 @@ public class TmfFilterMatchesNode extends TmfFilterTreeNode {
         String valueString = value.toString();
 
         return fPattern.matcher(valueString).matches() ^ fNot;
-       }
-
-       @Override
-       public List<String> getValidChildren() {
-               return new ArrayList<String>(0);
-       }
-
-       @Override
-       public String toString() {
-               return fField + (fNot ? " not" : "") + " matches \"" + fRegex + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-       }
-
-       @Override
-       public ITmfFilterTreeNode clone() {
-               TmfFilterMatchesNode clone = (TmfFilterMatchesNode) super.clone();
-               clone.fField = fField;
-               clone.setRegex(fRegex);
-               return clone;
-       }
-
-       /**
-        * @param pattern the rough regex pattern
-        * @return the compliant regex
-        */
-       public static String regexFix(String pattern) {
-               // if the pattern does not contain one of the expressions .* !^
-               // (at the beginning) $ (at the end), then a .* is added at the
-               // beginning and at the end of the pattern
-               if (!(pattern.indexOf(".*") >= 0 || pattern.charAt(0) == '^' || pattern.charAt(pattern.length() - 1) == '$')) { //$NON-NLS-1$
-                       pattern = ".*" + pattern + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
-               }
-               return pattern;
-       }
+    }
+
+    @Override
+    public List<String> getValidChildren() {
+        return new ArrayList<String>(0);
+    }
+
+    @Override
+    public String toString() {
+        return fField + (fNot ? " not" : "") + " matches \"" + fRegex + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+    }
+
+    @Override
+    public ITmfFilterTreeNode clone() {
+        TmfFilterMatchesNode clone = (TmfFilterMatchesNode) super.clone();
+        clone.fField = fField;
+        clone.setRegex(fRegex);
+        return clone;
+    }
+
+    /**
+     * @param pattern
+     *            the rough regex pattern
+     * @return the compliant regex
+     */
+    public static String regexFix(String pattern) {
+        String ret = pattern;
+        // if the pattern does not contain one of the expressions .* !^
+        // (at the beginning) $ (at the end), then a .* is added at the
+        // beginning and at the end of the pattern
+        if (!(ret.indexOf(".*") >= 0 || ret.charAt(0) == '^' || ret.charAt(ret.length() - 1) == '$')) { //$NON-NLS-1$
+            ret = ".*" + ret + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
+        }
+        return ret;
+    }
 }
index 917694be1e0bc32659fa58e180e0ce4a4d6ca7ac..bca8c277d1a92859366d3c086a78249037f4e1ed 100644 (file)
@@ -66,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
 org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
 org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
 org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
index 6801c60721ce46fb562d4c619d27014565dd7ac6..4c9e8dcf295d546b20ee0bb40af439f9bd545e6c 100644 (file)
@@ -57,539 +57,539 @@ import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.part.DrillDownAdapter;
 import org.eclipse.ui.part.ViewPart;
 
-@SuppressWarnings({"javadoc", "nls"})
+@SuppressWarnings({ "javadoc", "nls" })
 public class TsfTraceAnalysisView extends ViewPart implements
-               ITimeGraphSelectionListener, ITimeGraphTimeListener, ITimeGraphRangeListener {
-
-       // ========================================================================
-       // Data
-       // ========================================================================
-       private TreeViewer viewer;
-       private DrillDownAdapter drillDownAdapter;
-       private Action action1;
-       private Action action2;
-       private Action resetScale;
-       private Action nextEvent;
-       private Action prevEvent;
-       private Action nextTrace;
-       private Action prevTrace;
-       private Action showLegent;
-       private Action zoomIn;
-       private Action zoomOut;
-       private Action events300K;
-
-       private Action doubleClickAction;
-       private TimeGraphViewer tsfviewer;
-       private TimeGraphViewer tsfviewer2;
-
-       private static SimpleDateFormat stimeformat = new SimpleDateFormat(
-                       "yy/MM/dd HH:mm:ss");
-       private TraceModelImplFactory fact;
-
-       // ========================================================================
-       // Inner Classes
-       // ========================================================================
-       /*
-        * The content provider class is responsible for providing objects to the
-        * view. It can wrap existing objects in adapters or simply return objects
-        * as-is. These objects may be sensitive to the current input of the view,
-        * or ignore it and always show the same content (like Task List, for
-        * example).
-        */
-
-       class TreeObject implements IAdaptable {
-               private final String name;
-               private TreeParent parent;
-
-               public TreeObject(String name) {
-                       this.name = name;
-               }
-
-               public String getName() {
-                       return name;
-               }
-
-               public void setParent(TreeParent parent) {
-                       this.parent = parent;
-               }
-
-               public TreeParent getParent() {
-                       return parent;
-               }
-
-               @Override
-               public String toString() {
-                       return getName();
-               }
-
-               @Override
-               public Object getAdapter(Class key) {
-                       return null;
-               }
-       }
-
-       class TreeParent extends TreeObject {
-               private final ArrayList<TreeObject> children;
-
-               public TreeParent(String name) {
-                       super(name);
-                       children = new ArrayList<TreeObject>();
-               }
-
-               public void addChild(TreeObject child) {
-                       children.add(child);
-                       child.setParent(this);
-               }
-
-               public void removeChild(TreeObject child) {
-                       children.remove(child);
-                       child.setParent(null);
-               }
-
-               public TreeObject[] getChildren() {
-                       return children.toArray(new TreeObject[children
-                                       .size()]);
-               }
-
-               public boolean hasChildren() {
-                       return children.size() > 0;
-               }
-       }
-
-       class ViewContentProvider implements ITreeContentProvider {
-               private TreeParent invisibleRoot;
-
-               @Override
-               public void inputChanged(Viewer v, Object oldInput, Object newInput) {
-               }
-
-               @Override
-               public void dispose() {
-               }
-
-               @Override
-               public Object[] getElements(Object parent) {
-                       if (parent.equals(getViewSite())) {
-                               if (invisibleRoot == null) {
+        ITimeGraphSelectionListener, ITimeGraphTimeListener, ITimeGraphRangeListener {
+
+    // ========================================================================
+    // Data
+    // ========================================================================
+    private TreeViewer viewer;
+    private DrillDownAdapter drillDownAdapter;
+    private Action action1;
+    private Action action2;
+    private Action resetScale;
+    private Action nextEvent;
+    private Action prevEvent;
+    private Action nextTrace;
+    private Action prevTrace;
+    private Action showLegent;
+    private Action zoomIn;
+    private Action zoomOut;
+    private Action events300K;
+
+    private Action doubleClickAction;
+    private TimeGraphViewer tsfviewer;
+    private TimeGraphViewer tsfviewer2;
+
+    private static SimpleDateFormat stimeformat = new SimpleDateFormat(
+            "yy/MM/dd HH:mm:ss");
+    private TraceModelImplFactory fact;
+
+    // ========================================================================
+    // Inner Classes
+    // ========================================================================
+    /*
+     * The content provider class is responsible for providing objects to the
+     * view. It can wrap existing objects in adapters or simply return objects
+     * as-is. These objects may be sensitive to the current input of the view,
+     * or ignore it and always show the same content (like Task List, for
+     * example).
+     */
+
+    class TreeObject implements IAdaptable {
+        private final String name;
+        private TreeParent parent;
+
+        public TreeObject(String name) {
+            this.name = name;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public void setParent(TreeParent parent) {
+            this.parent = parent;
+        }
+
+        public TreeParent getParent() {
+            return parent;
+        }
+
+        @Override
+        public String toString() {
+            return getName();
+        }
+
+        @Override
+        public Object getAdapter(Class key) {
+            return null;
+        }
+    }
+
+    class TreeParent extends TreeObject {
+        private final ArrayList<TreeObject> children;
+
+        public TreeParent(String name) {
+            super(name);
+            children = new ArrayList<TreeObject>();
+        }
+
+        public void addChild(TreeObject child) {
+            children.add(child);
+            child.setParent(this);
+        }
+
+        public void removeChild(TreeObject child) {
+            children.remove(child);
+            child.setParent(null);
+        }
+
+        public TreeObject[] getChildren() {
+            return children.toArray(new TreeObject[children
+                    .size()]);
+        }
+
+        public boolean hasChildren() {
+            return children.size() > 0;
+        }
+    }
+
+    class ViewContentProvider implements ITreeContentProvider {
+        private TreeParent invisibleRoot;
+
+        @Override
+        public void inputChanged(Viewer v, Object oldInput, Object newInput) {
+        }
+
+        @Override
+        public void dispose() {
+        }
+
+        @Override
+        public Object[] getElements(Object parent) {
+            if (parent.equals(getViewSite())) {
+                if (invisibleRoot == null) {
                     initialize();
                 }
-                               return getChildren(invisibleRoot);
-                       }
-                       return getChildren(parent);
-               }
-
-               @Override
-               public Object getParent(Object child) {
-                       if (child instanceof TreeObject) {
-                               return ((TreeObject) child).getParent();
-                       }
-                       return null;
-               }
-
-               @Override
-               public Object[] getChildren(Object parent) {
-                       if (parent instanceof TreeParent) {
-                               return ((TreeParent) parent).getChildren();
-                       }
-                       return new Object[0];
-               }
-
-               @Override
-               public boolean hasChildren(Object parent) {
-                       if (parent instanceof TreeParent) {
+                return getChildren(invisibleRoot);
+            }
+            return getChildren(parent);
+        }
+
+        @Override
+        public Object getParent(Object child) {
+            if (child instanceof TreeObject) {
+                return ((TreeObject) child).getParent();
+            }
+            return null;
+        }
+
+        @Override
+        public Object[] getChildren(Object parent) {
+            if (parent instanceof TreeParent) {
+                return ((TreeParent) parent).getChildren();
+            }
+            return new Object[0];
+        }
+
+        @Override
+        public boolean hasChildren(Object parent) {
+            if (parent instanceof TreeParent) {
                 return ((TreeParent) parent).hasChildren();
             }
-                       return false;
-               }
-
-               /*
-                * We will set up a dummy model to initialize tree heararchy. In a real
-                * code, you will connect to a real model and expose its hierarchy.
-                */
-               private void initialize() {
-                       TreeObject to1 = new TreeObject("Leaf 1");
-                       TreeObject to2 = new TreeObject("Leaf 2");
-                       TreeObject to3 = new TreeObject("Leaf 3");
-                       TreeParent p1 = new TreeParent("Parent 1");
-                       p1.addChild(to1);
-                       p1.addChild(to2);
-                       p1.addChild(to3);
-
-                       TreeObject to4 = new TreeObject("Leaf 4");
-                       TreeParent p2 = new TreeParent("Parent 2");
-                       p2.addChild(to4);
-
-                       TreeParent root = new TreeParent("Root");
-                       root.addChild(p1);
-                       root.addChild(p2);
-
-                       invisibleRoot = new TreeParent("");
-                       invisibleRoot.addChild(root);
-               }
-       }
-
-       static class ViewLabelProvider extends LabelProvider {
-
-               @Override
-               public String getText(Object obj) {
-                       return obj.toString();
-               }
-
-               @Override
-               public Image getImage(Object obj) {
-                       String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
-                       if (obj instanceof TreeParent) {
+            return false;
+        }
+
+        /*
+         * We will set up a dummy model to initialize tree heararchy. In a real
+         * code, you will connect to a real model and expose its hierarchy.
+         */
+        private void initialize() {
+            TreeObject to1 = new TreeObject("Leaf 1");
+            TreeObject to2 = new TreeObject("Leaf 2");
+            TreeObject to3 = new TreeObject("Leaf 3");
+            TreeParent p1 = new TreeParent("Parent 1");
+            p1.addChild(to1);
+            p1.addChild(to2);
+            p1.addChild(to3);
+
+            TreeObject to4 = new TreeObject("Leaf 4");
+            TreeParent p2 = new TreeParent("Parent 2");
+            p2.addChild(to4);
+
+            TreeParent root = new TreeParent("Root");
+            root.addChild(p1);
+            root.addChild(p2);
+
+            invisibleRoot = new TreeParent("");
+            invisibleRoot.addChild(root);
+        }
+    }
+
+    static class ViewLabelProvider extends LabelProvider {
+
+        @Override
+        public String getText(Object obj) {
+            return obj.toString();
+        }
+
+        @Override
+        public Image getImage(Object obj) {
+            String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
+            if (obj instanceof TreeParent) {
                 imageKey = ISharedImages.IMG_OBJ_FOLDER;
             }
-                       return PlatformUI.getWorkbench().getSharedImages().getImage(
-                                       imageKey);
-               }
-       }
-
-       static class NameSorter extends ViewerSorter {
-       }
-
-       // ========================================================================
-       // Methods
-       // ========================================================================
-       /**
-        * This is a callback that will allow us to create the viewer and initialize
-        * it.
-        */
-       @Override
-       public void createPartControl(Composite parent) {
-               final SashForm sashForm = new SashForm(parent, SWT.NONE);
-               final SashForm sashForm2 = new SashForm(sashForm, SWT.NONE);
-
-               tsfviewer = new TimeGraphViewer(sashForm2, SWT.NONE);
-               tsfviewer.setTimeGraphProvider(new TsfImplProvider());
-               tsfviewer2 = new TimeGraphViewer(sashForm2, SWT.NONE);
-               tsfviewer2.setTimeGraphProvider(new TsfImplProvider());
-
-               viewer = new TreeViewer(sashForm, SWT.MULTI | SWT.H_SCROLL
-                               | SWT.V_SCROLL);
-               drillDownAdapter = new DrillDownAdapter(viewer);
-               viewer.setContentProvider(new ViewContentProvider());
-               viewer.setLabelProvider(new ViewLabelProvider());
-               viewer.setSorter(new NameSorter());
-               viewer.setInput(getViewSite());
-
-               sashForm.setWeights(new int[] { 5, 1 });
-               sashForm2.setWeights(new int[] { 1, 1 });
-
-               fact = new TraceModelImplFactory();
-               ITimeGraphEntry[] traceArr = fact.createTraces();
-               tsfviewer.setInput(traceArr);
-               tsfviewer.addSelectionListener(this);
-               tsfviewer.addRangeListener(this);
-               tsfviewer.setTimeFormat(TimeFormat.CALENDAR);
-
-               tsfviewer2.setInput(traceArr);
-               tsfviewer2.addSelectionListener(this);
-               tsfviewer2.addRangeListener(this);
-               // tsfviewer2.setTimeFormat(TimeGraphViewer.timeFormat.epoch);
-
-               makeActions();
-               hookContextMenu();
-               hookDoubleClickAction();
-               contributeToActionBars();
-       }
-
-       private void hookContextMenu() {
-               MenuManager menuMgr = new MenuManager("#PopupMenu");
-               menuMgr.setRemoveAllWhenShown(true);
-               menuMgr.addMenuListener(new IMenuListener() {
-                       @Override
-                       public void menuAboutToShow(IMenuManager manager) {
-                               TsfTraceAnalysisView.this.fillContextMenu(manager);
-                       }
-               });
-               Menu menu = menuMgr.createContextMenu(viewer.getControl());
-               viewer.getControl().setMenu(menu);
-               getSite().registerContextMenu(menuMgr, viewer);
-       }
-
-       private void contributeToActionBars() {
-               IActionBars bars = getViewSite().getActionBars();
-               fillLocalPullDown(bars.getMenuManager());
-               fillLocalToolBar(bars.getToolBarManager());
-       }
-
-       private void fillLocalPullDown(IMenuManager manager) {
-               manager.add(action1);
-               manager.add(new Separator());
-               manager.add(action2);
-       }
-
-       private void fillContextMenu(IMenuManager manager) {
-               manager.add(action1);
-               manager.add(action2);
-               manager.add(new Separator());
-               drillDownAdapter.addNavigationActions(manager);
-               // Other plug-ins can contribute there actions here
-               manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-       }
-
-       private void fillLocalToolBar(IToolBarManager manager) {
-               manager.add(new Separator());
-               manager.add(resetScale);
-               manager.add(nextEvent);
-               manager.add(prevEvent);
-               manager.add(nextTrace);
-               manager.add(prevTrace);
-               manager.add(showLegent);
-               manager.add(zoomIn);
-               manager.add(zoomOut);
-               manager.add(events300K);
-               manager.add(new Separator());
-
-               drillDownAdapter.addNavigationActions(manager);
-       }
-
-       private TimeGraphViewer getActiveTsfCtrl() {
-               TimeGraphViewer inFocusViewer = null;
-               if (tsfviewer.isInFocus()) {
+            return PlatformUI.getWorkbench().getSharedImages().getImage(
+                    imageKey);
+        }
+    }
+
+    static class NameSorter extends ViewerSorter {
+    }
+
+    // ========================================================================
+    // Methods
+    // ========================================================================
+    /**
+     * This is a callback that will allow us to create the viewer and initialize
+     * it.
+     */
+    @Override
+    public void createPartControl(Composite parent) {
+        final SashForm sashForm = new SashForm(parent, SWT.NONE);
+        final SashForm sashForm2 = new SashForm(sashForm, SWT.NONE);
+
+        tsfviewer = new TimeGraphViewer(sashForm2, SWT.NONE);
+        tsfviewer.setTimeGraphProvider(new TsfImplProvider());
+        tsfviewer2 = new TimeGraphViewer(sashForm2, SWT.NONE);
+        tsfviewer2.setTimeGraphProvider(new TsfImplProvider());
+
+        viewer = new TreeViewer(sashForm, SWT.MULTI | SWT.H_SCROLL
+                | SWT.V_SCROLL);
+        drillDownAdapter = new DrillDownAdapter(viewer);
+        viewer.setContentProvider(new ViewContentProvider());
+        viewer.setLabelProvider(new ViewLabelProvider());
+        viewer.setSorter(new NameSorter());
+        viewer.setInput(getViewSite());
+
+        sashForm.setWeights(new int[] { 5, 1 });
+        sashForm2.setWeights(new int[] { 1, 1 });
+
+        fact = new TraceModelImplFactory();
+        ITimeGraphEntry[] traceArr = fact.createTraces();
+        tsfviewer.setInput(traceArr);
+        tsfviewer.addSelectionListener(this);
+        tsfviewer.addRangeListener(this);
+        tsfviewer.setTimeFormat(TimeFormat.CALENDAR);
+
+        tsfviewer2.setInput(traceArr);
+        tsfviewer2.addSelectionListener(this);
+        tsfviewer2.addRangeListener(this);
+        // tsfviewer2.setTimeFormat(TimeGraphViewer.timeFormat.epoch);
+
+        makeActions();
+        hookContextMenu();
+        hookDoubleClickAction();
+        contributeToActionBars();
+    }
+
+    private void hookContextMenu() {
+        MenuManager menuMgr = new MenuManager("#PopupMenu");
+        menuMgr.setRemoveAllWhenShown(true);
+        menuMgr.addMenuListener(new IMenuListener() {
+            @Override
+            public void menuAboutToShow(IMenuManager manager) {
+                TsfTraceAnalysisView.this.fillContextMenu(manager);
+            }
+        });
+        Menu menu = menuMgr.createContextMenu(viewer.getControl());
+        viewer.getControl().setMenu(menu);
+        getSite().registerContextMenu(menuMgr, viewer);
+    }
+
+    private void contributeToActionBars() {
+        IActionBars bars = getViewSite().getActionBars();
+        fillLocalPullDown(bars.getMenuManager());
+        fillLocalToolBar(bars.getToolBarManager());
+    }
+
+    private void fillLocalPullDown(IMenuManager manager) {
+        manager.add(action1);
+        manager.add(new Separator());
+        manager.add(action2);
+    }
+
+    private void fillContextMenu(IMenuManager manager) {
+        manager.add(action1);
+        manager.add(action2);
+        manager.add(new Separator());
+        drillDownAdapter.addNavigationActions(manager);
+        // Other plug-ins can contribute there actions here
+        manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+    }
+
+    private void fillLocalToolBar(IToolBarManager manager) {
+        manager.add(new Separator());
+        manager.add(resetScale);
+        manager.add(nextEvent);
+        manager.add(prevEvent);
+        manager.add(nextTrace);
+        manager.add(prevTrace);
+        manager.add(showLegent);
+        manager.add(zoomIn);
+        manager.add(zoomOut);
+        manager.add(events300K);
+        manager.add(new Separator());
+
+        drillDownAdapter.addNavigationActions(manager);
+    }
+
+    private TimeGraphViewer getActiveTsfCtrl() {
+        TimeGraphViewer inFocusViewer = null;
+        if (tsfviewer.isInFocus()) {
             inFocusViewer = tsfviewer;
         } else if (tsfviewer2.isInFocus()) {
             inFocusViewer = tsfviewer2;
         }
-               return inFocusViewer;
-       }
-
-       private void makeActions() {
-               // action1
-               action1 = new Action() {
-                       @Override
-                       public void run() {
-                               showMessage("Action 1 executed");
-                       }
-               };
-               action1.setText("Action 1");
-               action1.setToolTipText("Action 1 tooltip");
-               action1.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
-                               .getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
-
-               // action2
-               action2 = new Action() {
-                       @Override
-                       public void run() {
-                               showMessage("Action 2 executed");
-                       }
-               };
-               action2.setText("Action 2");
-               action2.setToolTipText("Action 2 tooltip");
-               action2.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
-                               .getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
-
-               // action4
-               resetScale = new Action() {
-                       @Override
-                       public void run() {
-                               TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
-                               if (inFocusViewer != null) {
-                                       inFocusViewer.resetStartFinishTime();
-                               }
-
-                       }
-               };
-               resetScale.setText("Reset");
-               resetScale.setToolTipText("Reset the Time Scale to Default");
-
-               // action5
-               nextEvent = new Action() {
-                       @Override
-                       public void run() {
-                               TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
-                               if (inFocusViewer != null) {
-                                       inFocusViewer.selectNextEvent();
-                               }
-                       }
-               };
-               nextEvent.setText("NextEv");
-               nextEvent.setToolTipText("Next Event");
-
-               // action6
-               prevEvent = new Action() {
-                       @Override
-                       public void run() {
-                               TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
-                               if (inFocusViewer != null) {
-                                       inFocusViewer.selectPrevEvent();
-                               }
-                       }
-               };
-               prevEvent.setText("PrevEv");
-               prevEvent.setToolTipText("Previous Event");
-
-               // action7
-               nextTrace = new Action() {
-                       @Override
-                       public void run() {
-                               TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
-                               if (inFocusViewer != null) {
-                                       inFocusViewer.selectNextItem();
-                               }
-                       }
-               };
-               nextTrace.setText("NextTrace");
-               nextTrace.setToolTipText("Select Next Event");
-
-               // action8
-               prevTrace = new Action() {
-                       @Override
-                       public void run() {
-                               TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
-                               if (inFocusViewer != null) {
-                                       inFocusViewer.selectPrevItem();
-                               }
-                       }
-               };
-               prevTrace.setText("PrevTrace");
-               prevTrace.setToolTipText("Select Previous Trace");
-
-               // action9
-               showLegent = new Action() {
-                       @Override
-                       public void run() {
-                               TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
-                               if (inFocusViewer != null) {
-                                       inFocusViewer.showLegend();
-                               }
-                       }
-               };
-               showLegent.setText("Legend");
-               showLegent.setToolTipText("Show Legend");
-
-               // action10
-               zoomIn = new Action() {
-                       @Override
-                       public void run() {
-                               TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
-                               if (inFocusViewer != null) {
-                                       inFocusViewer.zoomIn();
-                               }
-                       }
-               };
-               zoomIn.setText("Zoom In");
-               zoomIn.setToolTipText("Zoom In");
-
-               // action10
-               zoomOut = new Action() {
-                       @Override
-                       public void run() {
-                               TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
-                               if (inFocusViewer != null) {
-                                       inFocusViewer.zoomOut();
-                               }
-                               // ISelection selection = inFocusViewer.getSelection();
-                               // Object sel = null;
-                               // if (selection != null && !selection.isEmpty()) {
-                               // sel = ((IStructuredSelection) selection)
-                               // .getFirstElement();
-                               // if (sel instanceof EventImpl) {
-                               // EventImpl event = (EventImpl) sel;
-                               // inFocusViewer.selectNextEvent();
-                               // }
-                               // }
-                       }
-               };
-               zoomOut.setText("Zoom Out");
-               zoomOut.setToolTipText("Zoom Out");
-
-               // action12
-               events300K = new Action() {
-                       @Override
-                       public void run() {
-                               TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
-                               if (inFocusViewer != null) {
-                                       ITimeGraphEntry[] traceArr = fact
-                                                       .createLargeTraces(60);
-                                       inFocusViewer.setInput(traceArr);
-                               }
-                       }
-               };
-               events300K.setText("300K Events");
-               events300K.setToolTipText("Add 300K Events");
-
-               doubleClickAction = new Action() {
-                       @Override
-                       public void run() {
-                               ISelection selection = viewer.getSelection();
-                               Object obj = ((IStructuredSelection) selection)
-                                               .getFirstElement();
-                               showMessage("Double-click detected on " + obj.toString());
-                       }
-               };
-       }
-
-       private void hookDoubleClickAction() {
-               viewer.addDoubleClickListener(new IDoubleClickListener() {
-                       @Override
-                       public void doubleClick(DoubleClickEvent event) {
-                               doubleClickAction.run();
-                       }
-               });
-       }
-
-       private void showMessage(String message) {
-               MessageDialog.openInformation(viewer.getControl().getShell(),
-                               "TsfTrace Analysis View", message);
-       }
-
-       /**
-        * Passing the focus request to the viewer's control.
-        */
-       @Override
-       public void setFocus() {
-               viewer.getControl().setFocus();
-       }
+        return inFocusViewer;
+    }
+
+    private void makeActions() {
+        // action1
+        action1 = new Action() {
+            @Override
+            public void run() {
+                showMessage("Action 1 executed");
+            }
+        };
+        action1.setText("Action 1");
+        action1.setToolTipText("Action 1 tooltip");
+        action1.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
+                .getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
+
+        // action2
+        action2 = new Action() {
+            @Override
+            public void run() {
+                showMessage("Action 2 executed");
+            }
+        };
+        action2.setText("Action 2");
+        action2.setToolTipText("Action 2 tooltip");
+        action2.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
+                .getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
+
+        // action4
+        resetScale = new Action() {
+            @Override
+            public void run() {
+                TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
+                if (inFocusViewer != null) {
+                    inFocusViewer.resetStartFinishTime();
+                }
 
+            }
+        };
+        resetScale.setText("Reset");
+        resetScale.setToolTipText("Reset the Time Scale to Default");
+
+        // action5
+        nextEvent = new Action() {
+            @Override
+            public void run() {
+                TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
+                if (inFocusViewer != null) {
+                    inFocusViewer.selectNextEvent();
+                }
+            }
+        };
+        nextEvent.setText("NextEv");
+        nextEvent.setToolTipText("Next Event");
+
+        // action6
+        prevEvent = new Action() {
+            @Override
+            public void run() {
+                TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
+                if (inFocusViewer != null) {
+                    inFocusViewer.selectPrevEvent();
+                }
+            }
+        };
+        prevEvent.setText("PrevEv");
+        prevEvent.setToolTipText("Previous Event");
+
+        // action7
+        nextTrace = new Action() {
+            @Override
+            public void run() {
+                TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
+                if (inFocusViewer != null) {
+                    inFocusViewer.selectNextItem();
+                }
+            }
+        };
+        nextTrace.setText("NextTrace");
+        nextTrace.setToolTipText("Select Next Event");
+
+        // action8
+        prevTrace = new Action() {
+            @Override
+            public void run() {
+                TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
+                if (inFocusViewer != null) {
+                    inFocusViewer.selectPrevItem();
+                }
+            }
+        };
+        prevTrace.setText("PrevTrace");
+        prevTrace.setToolTipText("Select Previous Trace");
+
+        // action9
+        showLegent = new Action() {
+            @Override
+            public void run() {
+                TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
+                if (inFocusViewer != null) {
+                    inFocusViewer.showLegend();
+                }
+            }
+        };
+        showLegent.setText("Legend");
+        showLegent.setToolTipText("Show Legend");
+
+        // action10
+        zoomIn = new Action() {
+            @Override
+            public void run() {
+                TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
+                if (inFocusViewer != null) {
+                    inFocusViewer.zoomIn();
+                }
+            }
+        };
+        zoomIn.setText("Zoom In");
+        zoomIn.setToolTipText("Zoom In");
+
+        // action10
+        zoomOut = new Action() {
+            @Override
+            public void run() {
+                TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
+                if (inFocusViewer != null) {
+                    inFocusViewer.zoomOut();
+                }
+                // ISelection selection = inFocusViewer.getSelection();
+                // Object sel = null;
+                // if (selection != null && !selection.isEmpty()) {
+                // sel = ((IStructuredSelection) selection)
+                // .getFirstElement();
+                // if (sel instanceof EventImpl) {
+                // EventImpl event = (EventImpl) sel;
+                // inFocusViewer.selectNextEvent();
+                // }
+                // }
+            }
+        };
+        zoomOut.setText("Zoom Out");
+        zoomOut.setToolTipText("Zoom Out");
+
+        // action12
+        events300K = new Action() {
+            @Override
+            public void run() {
+                TimeGraphViewer inFocusViewer = getActiveTsfCtrl();
+                if (inFocusViewer != null) {
+                    ITimeGraphEntry[] traceArr = fact
+                            .createLargeTraces(60);
+                    inFocusViewer.setInput(traceArr);
+                }
+            }
+        };
+        events300K.setText("300K Events");
+        events300K.setToolTipText("Add 300K Events");
+
+        doubleClickAction = new Action() {
+            @Override
+            public void run() {
+                ISelection selection = viewer.getSelection();
+                Object obj = ((IStructuredSelection) selection)
+                        .getFirstElement();
+                showMessage("Double-click detected on " + obj.toString());
+            }
+        };
+    }
+
+    private void hookDoubleClickAction() {
+        viewer.addDoubleClickListener(new IDoubleClickListener() {
+            @Override
+            public void doubleClick(DoubleClickEvent event) {
+                doubleClickAction.run();
+            }
+        });
+    }
+
+    private void showMessage(String message) {
+        MessageDialog.openInformation(viewer.getControl().getShell(),
+                "TsfTrace Analysis View", message);
+    }
+
+    /**
+     * Passing the focus request to the viewer's control.
+     */
     @Override
-       public void selectionChanged(TimeGraphSelectionEvent event) {
-               Object source = event.getSource();
-               if (source == null || !(source instanceof TimeGraphViewer)) {
-                       return;
-               }
-
-               TimeGraphViewer rViewer = (TimeGraphViewer) event.getSource();
-               TimeGraphViewer synchViewer = null;
-               // Synchronize viewer selections if Enabled,
-               // make sure the selection does not go in loops
-               if (tsfviewer == rViewer) {
-                       synchViewer = tsfviewer2;
-               } else {
-                       synchViewer = tsfviewer;
-               }
-               Object selection = event.getSelection();
-
-               if (selection instanceof EventImpl) {
-                       EventImpl selEvent = (EventImpl) selection;
-                       System.out
-                                       .println("TsfTraceAnalysisView.selectionChanged() Selected Event: \nType: "
-                                                       + selEvent.getType().toString()
-                                                       + "\nTime: "
-                                                       + selEvent.getTime()
-                                                       + "\nTrace Name: "
-                                                       + selEvent.getEntry().getName());
-
-                       synchViewer.setSelectedEvent(selEvent, source);
-
-               } else if (selection instanceof TraceImpl) {
-                       TraceImpl selTrace = (TraceImpl) selection;
-                       System.out
-                                       .println("TsfTraceAnalysisView.selectionChanged() Selected Trace: \nName: "
-                                                       + selTrace.getName().toString()
-                                                       + "\nClass Name: "
-                                                       + selTrace.getClassName());
-
-                       synchViewer.setSelection(selTrace);
-               } else {
-                       System.out
-                                       .println("TsfTmIncubatorListener.tsfTmProcessEvent() Unexpected event source received: "
-                                                       + selection.getClass().getName());
-               }
-
-       }
+    public void setFocus() {
+        viewer.getControl().setFocus();
+    }
+
+    @Override
+    public void selectionChanged(TimeGraphSelectionEvent event) {
+        Object source = event.getSource();
+        if (source == null || !(source instanceof TimeGraphViewer)) {
+            return;
+        }
+
+        TimeGraphViewer rViewer = (TimeGraphViewer) event.getSource();
+        TimeGraphViewer synchViewer = null;
+        // Synchronize viewer selections if Enabled,
+        // make sure the selection does not go in loops
+        if (tsfviewer == rViewer) {
+            synchViewer = tsfviewer2;
+        } else {
+            synchViewer = tsfviewer;
+        }
+        Object selection = event.getSelection();
+
+        if (selection instanceof EventImpl) {
+            EventImpl selEvent = (EventImpl) selection;
+            System.out
+                    .println("TsfTraceAnalysisView.selectionChanged() Selected Event: \nType: "
+                            + selEvent.getType().toString()
+                            + "\nTime: "
+                            + selEvent.getTime()
+                            + "\nTrace Name: "
+                            + selEvent.getEntry().getName());
+
+            synchViewer.setSelectedEvent(selEvent, source);
+
+        } else if (selection instanceof TraceImpl) {
+            TraceImpl selTrace = (TraceImpl) selection;
+            System.out
+                    .println("TsfTraceAnalysisView.selectionChanged() Selected Trace: \nName: "
+                            + selTrace.getName().toString()
+                            + "\nClass Name: "
+                            + selTrace.getClassName());
+
+            synchViewer.setSelection(selTrace);
+        } else {
+            System.out
+                    .println("TsfTmIncubatorListener.tsfTmProcessEvent() Unexpected event source received: "
+                            + selection.getClass().getName());
+        }
+
+    }
 
     @Override
     public void timeSelected(TimeGraphTimeEvent event) {
@@ -617,7 +617,7 @@ public class TsfTraceAnalysisView extends ViewPart implements
     }
 
     @Override
-       public void timeRangeUpdated(TimeGraphRangeUpdateEvent event) {
+    public void timeRangeUpdated(TimeGraphRangeUpdateEvent event) {
         if (event == null) {
             return;
         }
@@ -638,33 +638,33 @@ public class TsfTraceAnalysisView extends ViewPart implements
             synchViewer = tsfviewer;
         }
 
-        synchViewer.setSelectVisTimeWindow(rEvent.getStartTime(), rEvent
-                .getEndTime(), source);
+        synchViewer.setSelectVisTimeWindow(rEvent.getStartTime(), rEvent.getEndTime(), source);
     }
 
-       /**
-        * Obtains the remainder fraction on unit Seconds of the entered value in
-        * nanoseconds. e.g. input: 1241207054171080214 ns The number of seconds can
-        * be obtain by removing the last 9 digits: 1241207054 the fractional
-        * portion of seconds, expressed in ns is: 171080214
-        *
-        * @param v
-        * @return
-        */
-       public String formatNs(long v) {
-               StringBuffer str = new StringBuffer();
-               boolean neg = v < 0;
-               if (neg) {
-                       v = -v;
-                       str.append('-');
-               }
-
-               String strVal = String.valueOf(v);
-               if (v < 1000000000) {
-                       return strVal;
-               }
-
-               // Extract the last nine digits (e.g. fraction of a S expressed in ns
-               return strVal.substring(strVal.length() - 9);
-       }
+    /**
+     * Obtains the remainder fraction on unit Seconds of the entered value in
+     * nanoseconds. e.g. input: 1241207054171080214 ns The number of seconds can
+     * be obtain by removing the last 9 digits: 1241207054 the fractional
+     * portion of seconds, expressed in ns is: 171080214
+     *
+     * @param v
+     * @return
+     */
+    public String formatNs(long v) {
+        StringBuffer str = new StringBuffer();
+        long val = v;
+        boolean neg = val < 0;
+        if (neg) {
+            val = -val;
+            str.append('-');
+        }
+
+        String strVal = String.valueOf(val);
+        if (val < 1000000000) {
+            return strVal;
+        }
+
+        // Extract the last nine digits (e.g. fraction of a S expressed in ns
+        return strVal.substring(strVal.length() - 9);
+    }
 }
\ No newline at end of file
index 917694be1e0bc32659fa58e180e0ce4a4d6ca7ac..bca8c277d1a92859366d3c086a78249037f4e1ed 100644 (file)
@@ -66,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=error
 org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
 org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
 org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
index 9109e6dfd58da2e172152f9f836067fd33f5af52..bba95397f83237fe780273938bb6899f89433d2a 100644 (file)
@@ -1228,9 +1228,10 @@ public class CustomTxtParserInputWizardPage extends WizardPage {
         }
 
         private void removeInput(int inputNumber) {
-            if (--inputNumber < inputs.size()) {
-                inputs.remove(inputNumber).dispose();
-                for (int i = inputNumber; i < inputs.size(); i++) {
+            int nb = inputNumber;
+            if (--nb < inputs.size()) {
+                inputs.remove(nb).dispose();
+                for (int i = nb; i < inputs.size(); i++) {
                     inputs.get(i).setInputNumber(i+1);
                 }
                 lineContainer.layout();
index d6d0398470691a6df3faddfaac9cfc56a1f07f72..8efe1083e9914c32874d9ecfba3cc07524278ef2 100644 (file)
@@ -1161,9 +1161,10 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
         }
 
         private void removeAttribute(int attributeNumber) {
-            if (--attributeNumber < attributes.size()) {
-                attributes.remove(attributeNumber).dispose();
-                for (int i = attributeNumber; i < attributes.size(); i++) {
+            int nb = attributeNumber;
+            if (--nb < attributes.size()) {
+                attributes.remove(nb).dispose();
+                for (int i = nb; i < attributes.size(); i++) {
                     attributes.get(i).setAttributeNumber(i + 1);
                 }
                 elementContainer.layout();
@@ -1382,15 +1383,16 @@ public class CustomXmlParserInputWizardPage extends WizardPage {
     }
 
     private Element getPreviewElement(InputElement inputElement) {
+        InputElement currentElement = inputElement;
         Element element = documentElement;
         if (element != null) {
             if (!documentElement.getNodeName().equals(definition.rootInputElement.elementName)) {
                 return null;
             }
             ArrayList<String> elementNames = new ArrayList<String>();
-            while (inputElement != null) {
-                elementNames.add(inputElement.elementName);
-                inputElement = inputElement.parentElement;
+            while (currentElement != null) {
+                elementNames.add(currentElement.elementName);
+                currentElement = currentElement.parentElement;
             }
             for (int i = elementNames.size() - 1; --i >= 0;) {
                 NodeList childList = element.getChildNodes();
index fdd2add807492ea5f5d761575a666e053e3f45a5..5c7ed8466a1285cc7517531743e1dffc3be77536 100644 (file)
@@ -346,9 +346,9 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
             }
         });
 
-        cacheSize = Math.max(cacheSize, Display.getDefault().getBounds().height / fTable.getItemHeight());
-        cacheSize = Math.min(cacheSize, MAX_CACHE_SIZE);
-        fCache = new TmfEventsCache(cacheSize, this);
+        int realCacheSize = Math.max(cacheSize, Display.getDefault().getBounds().height / fTable.getItemHeight());
+        realCacheSize = Math.min(realCacheSize, MAX_CACHE_SIZE);
+        fCache = new TmfEventsCache(realCacheSize, this);
 
         // Handle the table item requests
         fTable.addListener(SWT.SetData, new Listener() {
index 9977b5c2add8820845645a7ac00fe55906987538..190d8730760c9b473675ec301b61870e8722298e 100644 (file)
@@ -354,9 +354,10 @@ class FilterViewer extends Composite {
 
         protected String[] getFieldsList(ITmfFilterTreeNode node) {
             ArrayList<String> fieldsList = new ArrayList<String>();
-            while (node != null) {
-                if (node instanceof TmfFilterEventTypeNode) {
-                    TmfFilterEventTypeNode eventTypeNode = (TmfFilterEventTypeNode) node;
+            ITmfFilterTreeNode curNode = node;
+            while (curNode != null) {
+                if (curNode instanceof TmfFilterEventTypeNode) {
+                    TmfFilterEventTypeNode eventTypeNode = (TmfFilterEventTypeNode) curNode;
                     for (IConfigurationElement ce : TmfTraceType.getTypeElements()) {
                         if (ce.getAttribute(TmfTraceType.EVENT_TYPE_ATTR).equals(eventTypeNode.getEventType())) {
                             try {
@@ -400,7 +401,7 @@ class FilterViewer extends Composite {
                         }
                     }
                 }
-                node = node.getParent();
+                curNode = curNode.getParent();
             }
 
             fieldsList.add(Messages.FilterViewer_CommonCategory);
index e1f144773383b3da210062e89a99ffba0dd26a8a..2f7f0cb242909f76bf8d8e53fa16b1193846528f 100644 (file)
@@ -341,20 +341,22 @@ public class HistogramView extends TmfView {
     }
 
     private void setNewRange(long startTime, long duration) {
-        if (startTime < fTraceStartTime) {
-            startTime = fTraceStartTime;
+        long realStart = startTime;
+
+        if (realStart < fTraceStartTime) {
+            realStart = fTraceStartTime;
         }
 
-        long endTime = startTime + duration;
+        long endTime = realStart + duration;
         if (endTime > fTraceEndTime) {
             endTime = fTraceEndTime;
             if ((endTime - duration) > fTraceStartTime) {
-                startTime = endTime - duration;
+                realStart = endTime - duration;
             } else {
-                startTime = fTraceStartTime;
+                realStart = fTraceStartTime;
             }
         }
-        updateTimeRange(startTime, endTime);
+        updateTimeRange(realStart, endTime);
     }
 
     // ------------------------------------------------------------------------
index 17f5438c394694bd080cb6f23deff79d314f7ffe..ede4414dc4f8e13798bf013159e3e1121fdc8b24 100644 (file)
@@ -137,22 +137,24 @@ public class HistogramZoom implements MouseWheelListener {
      * @param duration the duration
      */
     public synchronized void setNewRange(long startTime, long duration) {
-        if (startTime < fAbsoluteStartTime) {
-            startTime = fAbsoluteStartTime;
+        long realStart = startTime;
+
+        if (realStart < fAbsoluteStartTime) {
+            realStart = fAbsoluteStartTime;
         }
 
-        long endTime = startTime + duration;
+        long endTime = realStart + duration;
         if (endTime > fAbsoluteEndTime) {
             endTime = fAbsoluteEndTime;
             if (endTime - duration > fAbsoluteStartTime) {
-                startTime = endTime - duration;
+                realStart = endTime - duration;
             } else {
-                startTime = fAbsoluteStartTime;
+                realStart = fAbsoluteStartTime;
             }
         }
 
-        fRangeStartTime = startTime;
-        fRangeDuration = endTime - startTime;
+        fRangeStartTime = realStart;
+        fRangeDuration = endTime - realStart;
     }
 
     // ------------------------------------------------------------------------
@@ -184,23 +186,27 @@ public class HistogramZoom implements MouseWheelListener {
     }
 
     private long validateStart(long start) {
-        if (start < fAbsoluteStartTime) {
-            start = fAbsoluteStartTime;
+        long realStart = start;
+
+        if (realStart < fAbsoluteStartTime) {
+            realStart = fAbsoluteStartTime;
         }
-        if (start > fAbsoluteEndTime) {
-            start = fAbsoluteEndTime - fMinWindowSize;
+        if (realStart > fAbsoluteEndTime) {
+            realStart = fAbsoluteEndTime - fMinWindowSize;
         }
-        return start;
+        return realStart;
     }
 
     private long validateEnd(long start, long end) {
-        if (end > fAbsoluteEndTime) {
-            end = fAbsoluteEndTime;
+        long realEnd = end;
+
+        if (realEnd > fAbsoluteEndTime) {
+            realEnd = fAbsoluteEndTime;
         }
-        if (end < start + fMinWindowSize) {
-            end = start + fMinWindowSize;
+        if (realEnd < start + fMinWindowSize) {
+            realEnd = start + fMinWindowSize;
         }
-        return end;
+        return realEnd;
     }
 
     // ------------------------------------------------------------------------
index 0f4f4d6bdc07a3251231a9f8ce11efa80cb1ec5a..99ede5f8e50d74aad1c2dd89a82b19595d6ab8f9 100644 (file)
@@ -133,19 +133,21 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * Sets or clears the input for this time graph viewer.
      * The input array should only contain top-level elements.
      *
-     * @param input the input of this time graph viewer, or <code>null</code> if none
+     * @param input The input of this time graph viewer, or <code>null</code> if none
      */
     public void setInput(ITimeGraphEntry[] input) {
-        if (null != _stateCtrl) {
-            if (null == input) {
-                input = new ITimeGraphEntry[0];
+        ITimeGraphEntry[] realInput = input;
+
+        if (_stateCtrl != null) {
+            if (realInput == null) {
+                realInput = new ITimeGraphEntry[0];
             }
-            setTimeRange(input);
+            setTimeRange(realInput);
             _verticalScrollBar.setEnabled(true);
             setTopIndex(0);
             _selectedTime = 0;
             _selectedEntry = null;
-            refreshAllData(input);
+            refreshAllData(realInput);
         }
     }
 
@@ -406,19 +408,21 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @param end
      */
     void updateInternalData(ITimeGraphEntry[] traces, long start, long end) {
-        if (null == traces) {
-            traces = new ITimeGraphEntry[0];
+        ITimeGraphEntry[] realTraces = traces;
+
+        if (null == realTraces) {
+            realTraces = new ITimeGraphEntry[0];
         }
         if ((start == 0 && end == 0) || start < 0 || end < 0) {
             // Start and end time are unspecified and need to be determined from
             // individual processes
-            setTimeRange(traces);
+            setTimeRange(realTraces);
         } else {
             _beginTime = start;
             _endTime = end;
         }
 
-        refreshAllData(traces);
+        refreshAllData(realTraces);
     }
 
     /**
@@ -495,9 +499,9 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
     @Override
     public void setNameSpace(int width) {
         _nameWidth = width;
-        width = _stateCtrl.getClientArea().width;
-        if (_nameWidth > width - 6) {
-            _nameWidth = width - 6;
+        int w = _stateCtrl.getClientArea().width;
+        if (_nameWidth > w - 6) {
+            _nameWidth = w - 6;
         }
         if (_nameWidth < 6) {
             _nameWidth = 6;
index 227f82c6b508030154fc9f5fa0c081d9f10164ca..0c4985492f301833b87f51300877ef111346920b 100644 (file)
@@ -366,18 +366,19 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
 
     boolean ensureVisibleItem(int idx, boolean redraw) {
         boolean changed = false;
-        if (idx < 0) {
-            for (idx = 0; idx < _data._expandedItems.length; idx++) {
-                if (_data._expandedItems[idx]._selected) {
+        int index = idx;
+        if (index < 0) {
+            for (index = 0; index < _data._expandedItems.length; index++) {
+                if (_data._expandedItems[index]._selected) {
                     break;
                 }
             }
         }
-        if (idx >= _data._expandedItems.length) {
+        if (index >= _data._expandedItems.length) {
             return changed;
         }
-        if (idx < _topIndex) {
-            setTopIndex(idx);
+        if (index < _topIndex) {
+            setTopIndex(index);
             //FIXME:getVerticalBar().setSelection(_topItem);
             if (redraw) {
                 redraw();
@@ -385,8 +386,8 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
             changed = true;
         } else {
             int page = countPerPage();
-            if (idx >= _topIndex + page) {
-                setTopIndex(idx - page + 1);
+            if (index >= _topIndex + page) {
+                setTopIndex(index - page + 1);
                 //FIXME:getVerticalBar().setSelection(_topItem);
                 if (redraw) {
                     redraw();
@@ -404,9 +405,9 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
      *            The index
      */
     public void setTopIndex(int idx) {
-        idx = Math.min(idx, _data._expandedItems.length - countPerPage());
-        idx = Math.max(0,  idx);
-        _topIndex = idx;
+        int index = Math.min(idx, _data._expandedItems.length - countPerPage());
+        index = Math.max(0,  index);
+        _topIndex = index;
         redraw();
     }
 
@@ -930,12 +931,12 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
     /**
      * Return the time corresponding to an x coordinate
      *
-     * @param x the x coordinate
-     * @return the time corresponding to the x coordinate
+     * @param coord The X coordinate
+     * @return The time corresponding to the x coordinate
      *
      * @since 2.0
      */
-    public long getTimeAtX(int x) {
+    public long getTimeAtX(int coord) {
         if (null == _timeProvider) {
             return -1;
         }
@@ -944,7 +945,7 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
         long time0 = _timeProvider.getTime0();
         long time1 = _timeProvider.getTime1();
         int nameWidth = _timeProvider.getNameSpace();
-        x -= nameWidth;
+        final int x = coord - nameWidth;
         int timeWidth = size.x - nameWidth - RIGHT_MARGIN;
         if (x >= 0 && size.x >= nameWidth) {
             if (time1 - time0 > timeWidth) {
@@ -1394,8 +1395,8 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
                 stateColor = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
             }
 
-            timeSelected = timeSelected && selected;
-            if (timeSelected) {
+            boolean reallySelected = timeSelected && selected;
+            if (reallySelected) {
                 // modify the color?
             }
             // fill all rect area
@@ -1405,7 +1406,7 @@ public class TimeGraphControl extends TimeGraphBaseControl implements FocusListe
             gc.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
 
             // draw bounds
-            if (!timeSelected) {
+            if (!reallySelected) {
                 // Draw the top and bottom borders i.e. no side borders
                 // top
                 gc.drawLine(rect.x, rect.y, rect.x + rect.width - 1, rect.y);
index 3cb48fa72ddadfd1cad2b5b2bd19b83d1a4d630e..fb7314301053e286628e8be25a4ae4a1621a7e98 100644 (file)
@@ -358,8 +358,10 @@ public class TimeGraphScale extends TimeGraphBaseControl implements
     }
 
     private long floorToCalendar(long time, long timeDelta) {
+        long ret = time;
+
         if (_timeDelta >= YEAR_IN_NS) {
-            GREGORIAN_CALENDAR.setTime(new Date(time / 1000000));
+            GREGORIAN_CALENDAR.setTime(new Date(ret / 1000000));
             int year = GREGORIAN_CALENDAR.get(Calendar.YEAR);
             int yearDelta = (int) (timeDelta / YEAR_IN_NS);
             year = (year / yearDelta) * yearDelta;
@@ -370,9 +372,9 @@ public class TimeGraphScale extends TimeGraphBaseControl implements
             GREGORIAN_CALENDAR.set(Calendar.MINUTE, 0);
             GREGORIAN_CALENDAR.set(Calendar.SECOND, 0);
             GREGORIAN_CALENDAR.set(Calendar.MILLISECOND, 0);
-            time = GREGORIAN_CALENDAR.getTimeInMillis() * 1000000;
+            ret = GREGORIAN_CALENDAR.getTimeInMillis() * 1000000;
         } else if (_timeDelta >= MONTH_IN_NS) {
-            GREGORIAN_CALENDAR.setTime(new Date(time / 1000000));
+            GREGORIAN_CALENDAR.setTime(new Date(ret / 1000000));
             int month = GREGORIAN_CALENDAR.get(Calendar.MONTH);
             int monthDelta = (int) (timeDelta / MONTH_IN_NS);
             month = (month / monthDelta) * monthDelta;
@@ -382,14 +384,14 @@ public class TimeGraphScale extends TimeGraphBaseControl implements
             GREGORIAN_CALENDAR.set(Calendar.MINUTE, 0);
             GREGORIAN_CALENDAR.set(Calendar.SECOND, 0);
             GREGORIAN_CALENDAR.set(Calendar.MILLISECOND, 0);
-            time = GREGORIAN_CALENDAR.getTimeInMillis() * 1000000;
+            ret = GREGORIAN_CALENDAR.getTimeInMillis() * 1000000;
         } else {
-            long offset = GREGORIAN_CALENDAR.getTimeZone().getOffset(time / 1000000L) * 1000000L;
-            time += offset;
-            time = (time / timeDelta) * timeDelta;
-            time -= offset;
+            long offset = GREGORIAN_CALENDAR.getTimeZone().getOffset(ret / 1000000L) * 1000000L;
+            ret += offset;
+            ret = (ret / timeDelta) * timeDelta;
+            ret -= offset;
         }
-        return time;
+        return ret;
     }
 
     private int calculateDigits(long time0, long time1) {
@@ -586,8 +588,8 @@ class TimeDrawSec extends TimeDraw {
 
     @Override
     public void draw(GC gc, long time, Rectangle rect) {
-        time /= 1000000000;
-        Utils.drawText(gc, sep(time), rect, true);
+        long correctTime = time / 1000000000;
+        Utils.drawText(gc, sep(correctTime), rect, true);
     }
 
     @Override
@@ -601,10 +603,10 @@ class TimeDrawMillisec extends TimeDraw {
 
     @Override
     public void draw(GC gc, long time, Rectangle rect) {
-        time /= 1000000;
-        long ms = time % 1000;
-        time /= 1000;
-        Utils.drawText(gc, sep(time) + "." + pad(ms), rect, true); //$NON-NLS-1$
+        long correctTime = time / 1000000;
+        long ms = correctTime % 1000;
+        correctTime /= 1000;
+        Utils.drawText(gc, sep(correctTime) + "." + pad(ms), rect, true); //$NON-NLS-1$
     }
 
     @Override
@@ -618,12 +620,12 @@ class TimeDrawMicrosec extends TimeDraw {
 
     @Override
     public void draw(GC gc, long time, Rectangle rect) {
-        time /= 1000;
-        long mcs = time % 1000;
-        time /= 1000;
-        long ms = time % 1000;
-        time /= 1000;
-        Utils.drawText(gc, sep(time) + "." + pad(ms) + " " + pad(mcs), rect, true); //$NON-NLS-1$ //$NON-NLS-2$
+        long correctTime = time / 1000;
+        long mcs = correctTime % 1000;
+        correctTime /= 1000;
+        long ms = correctTime % 1000;
+        correctTime /= 1000;
+        Utils.drawText(gc, sep(correctTime) + "." + pad(ms) + " " + pad(mcs), rect, true); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
     @Override
@@ -638,12 +640,12 @@ class TimeDrawNanosec extends TimeDraw {
     @Override
     public void draw(GC gc, long time, Rectangle rect) {
         long ns = time % 1000;
-        time /= 1000;
-        long mcs = time % 1000;
-        time /= 1000;
-        long ms = time % 1000;
-        time /= 1000;
-        Utils.drawText(gc, sep(time) + "." + pad(ms) + " " + pad(mcs) + " " + pad(ns), rect, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+        long correctTime = time / 1000;
+        long mcs = correctTime % 1000;
+        correctTime /= 1000;
+        long ms = correctTime % 1000;
+        correctTime /= 1000;
+        Utils.drawText(gc, sep(correctTime) + "." + pad(ms) + " " + pad(mcs) + " " + pad(ns), rect, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     }
 
     @Override
index d929f18db84a36b51d76b9a1e2ce615767ddbf45..d4beca798e6f387f34961e0c7f522da8e8c264c8 100644 (file)
@@ -287,19 +287,22 @@ public class Utils {
     static public int drawText(GC gc, String text, int x, int y, int width, boolean isCentered, boolean isTransparent) {
         int len = text.length();
         int textWidth = 0;
+        boolean isReallyCentered = isCentered;
+        int realX = x;
+
         while (len > 0) {
             textWidth = gc.stringExtent(text.substring(0, len)).x;
             if (textWidth <= width) {
                 break;
             }
-            isCentered = false;
+            isReallyCentered = false;
             len--;
         }
         if (len > 0) {
-            if (isCentered) {
-                x += (width - textWidth) / 2;
+            if (isReallyCentered) {
+                realX += (width - textWidth) / 2;
             }
-            gc.drawText(text.substring(0, len), x, y, isTransparent);
+            gc.drawText(text.substring(0, len), realX, y, isTransparent);
         }
         return len;
     }
@@ -321,13 +324,14 @@ public class Utils {
         }
 
         StringBuffer str = new StringBuffer();
-        boolean neg = time < 0;
+        long t = time;
+        boolean neg = t < 0;
         if (neg) {
-            time = -time;
+            t = -t;
             str.append('-');
         }
 
-        long sec = (long) (time * 1E-9);
+        long sec = (long) (t * 1E-9);
         // TODO: Expand to make it possible to select the minute, second, nanosecond format
         //printing minutes is suppressed just sec and ns
         // if (sec / 60 < 10)
@@ -338,7 +342,7 @@ public class Utils {
         // if (sec < 10)
         // str.append('0');
         str.append(sec);
-        String ns = formatNs(time, resolution);
+        String ns = formatNs(t, resolution);
         if (!ns.equals("")) { //$NON-NLS-1$
             str.append('.');
             str.append(ns);
@@ -387,14 +391,15 @@ public class Utils {
      * seconds can be obtained by removing the last 9 digits: 1241207054 the
      * fractional portion of seconds, expressed in ns is: 171080214
      *
-     * @param time
+     * @param srcTime
      *            The source time in ns
      * @param res
      *            The Resolution to use
      * @return the formatted nanosec
      */
-    public static String formatNs(long time, Resolution res) {
+    public static String formatNs(long srcTime, Resolution res) {
         StringBuffer str = new StringBuffer();
+        long time = srcTime;
         boolean neg = time < 0;
         if (neg) {
             time = -time;
@@ -545,11 +550,12 @@ public class Utils {
     /**
      * Pretty-print a method signature.
      *
-     * @param sig
+     * @param origSig
      *            The original signature
      * @return The pretty signature
      */
-    static public String fixMethodSignature(String sig) {
+    static public String fixMethodSignature(String origSig) {
+        String sig = origSig;
         int pos = sig.indexOf('(');
         if (pos >= 0) {
             String ret = sig.substring(0, pos);
@@ -562,12 +568,14 @@ public class Utils {
     /**
      * Restore an original method signature from a pretty-printed one.
      *
-     * @param sig
+     * @param ppSig
      *            The pretty-printed signature
      * @return The original method signature
      */
-    static public String restoreMethodSignature(String sig) {
+    static public String restoreMethodSignature(String ppSig) {
         String ret = ""; //$NON-NLS-1$
+        String sig = ppSig;
+
         int pos = sig.indexOf('(');
         if (pos >= 0) {
             ret = sig.substring(0, pos);
@@ -593,13 +601,14 @@ public class Utils {
     /**
      * Get the mangled type information from an array of types.
      *
-     * @param type
+     * @param typeStr
      *            The types to convert. See method implementation for what it
      *            expects.
      * @return The mangled string of types
      */
-    static public String getTypeSignature(String type) {
+    public static String getTypeSignature(String typeStr) {
         int dim = 0;
+        String type = typeStr;
         for (int j = 0; j < type.length(); j++) {
             if (type.charAt(j) == '[') {
                 dim++;
@@ -612,7 +621,7 @@ public class Utils {
         StringBuffer sig = new StringBuffer(""); //$NON-NLS-1$
         for (int j = 0; j < dim; j++)
          {
-            sig.append("[");                 //$NON-NLS-1$
+            sig.append("["); //$NON-NLS-1$
         }
         if (type.equals("boolean")) { //$NON-NLS-1$
             sig.append('Z');
index 30fe3ddd2e629212b1f12deb72cd229ef50dd8ba..1e609f7fa0f8e4ddcc7cebc02eea7e3069051eb2 100644 (file)
@@ -698,12 +698,12 @@ public class TmfVirtualTable extends Composite {
         *
      */
     public void setItemCount(int nbItems) {
-        nbItems = Math.max(0, nbItems);
+        final int nb = Math.max(0, nbItems);
 
-        if (nbItems != fTableItemCount) {
-            fTableItemCount = nbItems;
+        if (nb != fTableItemCount) {
+            fTableItemCount = nb;
             fTable.remove(fTableItemCount, fTable.getItemCount() - 1);
-            fSlider.setMaximum(nbItems);
+            fSlider.setMaximum(nb);
             resize();
             int tableHeight = Math.max(0, fTable.getClientArea().height - fTable.getHeaderHeight());
             fFullyVisibleRows = tableHeight / getItemHeight();
@@ -764,11 +764,11 @@ public class TmfVirtualTable extends Composite {
 
     /**
      * Method setTopIndex.
-     * @param i int suggested top index for the table.
+     * @param index int suggested top index for the table.
      */
-    public void setTopIndex(int i) {
+    public void setTopIndex(int index) {
         if (fTableItemCount > 0) {
-            i = Math.min(i, fTableItemCount - 1);
+            int i = Math.min(index, fTableItemCount - 1);
             i = Math.max(i, fFrozenRowCount);
 
             fTableTopEventRank = i - fFrozenRowCount;
@@ -928,11 +928,11 @@ public class TmfVirtualTable extends Composite {
 
     /**
      * Method setSelection.
-     * @param i int the item number to select in the table.
+     * @param index int the item number to select in the table.
      */
-    public void setSelection(int i) {
+    public void setSelection(int index) {
         if (fTableItemCount > 0) {
-            i = Math.min(i, fTableItemCount - 1);
+            int i = Math.min(index, fTableItemCount - 1);
             i = Math.max(i, 0);
 
             fSelectedEventRank = i;
This page took 0.075563 seconds and 5 git commands to generate.