More fixes of static analysis warnings for UML2SD
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / core / HotSpot.java
index b6c6ac1f8bd507fede2679342f544a48cf49d0c1..db099e50d3024cf5c99d180a4b77323b2fb39558 100755 (executable)
@@ -16,6 +16,7 @@ package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IGC;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IImage;
 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.ISDPreferences;
+import org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences.SDViewPref;
 
 /**
  * Class to add a hot spot marker.
@@ -38,15 +39,15 @@ public class HotSpot extends GraphNode {
     /**
      * The execution occurrence the hot spot marker is for.
      */
-    protected BasicExecutionOccurrence execOcc = null;
+    protected BasicExecutionOccurrence fExecOcc = null;
     /**
      * The occurrence number.
      */
-    protected int occurrence = 0;
+    protected int fOccurrence = 0;
     /**
      * The marker image to display.
      */
-    protected IImage image = null;
+    protected IImage fImage = null;
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -56,7 +57,7 @@ public class HotSpot extends GraphNode {
      * Default constructor
      */
     public HotSpot() {
-        prefId = ISDPreferences.PREF_EXEC;
+        fPrefId = ISDPreferences.PREF_EXEC;
     }
 
     // ------------------------------------------------------------------------
@@ -69,7 +70,7 @@ public class HotSpot extends GraphNode {
      * @param img A image to set
      */
     public void setImage(IImage img) {
-        image = img;
+        fImage = img;
     }
 
     /*
@@ -78,8 +79,8 @@ public class HotSpot extends GraphNode {
      */
     @Override
     public int getX() {
-        if (execOcc != null) {
-            return execOcc.getX() - 3;
+        if (fExecOcc != null) {
+            return fExecOcc.getX() - 3;
         }
         return 0;
     }
@@ -90,8 +91,8 @@ public class HotSpot extends GraphNode {
      */
     @Override
     public int getY() {
-        if (execOcc != null){
-            return execOcc.getY();
+        if (fExecOcc != null){
+            return fExecOcc.getY();
         }
         return 0;
     }
@@ -102,8 +103,8 @@ public class HotSpot extends GraphNode {
      */
     @Override
     public int getWidth() {
-        if (execOcc != null) {
-            return execOcc.getWidth() + 7;
+        if (fExecOcc != null) {
+            return fExecOcc.getWidth() + 7;
         }
         return 0;
     }
@@ -114,8 +115,8 @@ public class HotSpot extends GraphNode {
      */
     @Override
     public int getHeight() {
-        if (execOcc != null) {
-            return execOcc.getWidth() + 10;
+        if (fExecOcc != null) {
+            return fExecOcc.getWidth() + 10;
         }
         return 0;
     }
@@ -126,8 +127,8 @@ public class HotSpot extends GraphNode {
      * @param occ the parent lifeline
      */
     public void setExecution(BasicExecutionOccurrence occ) {
-        execOcc = occ;
-        execOcc.addNode(this);
+        fExecOcc = occ;
+        fExecOcc.addNode(this);
     }
 
     /**
@@ -136,7 +137,7 @@ public class HotSpot extends GraphNode {
      * @return - the parent lifeline
      */
     public BasicExecutionOccurrence getExecOcc() {
-        return execOcc;
+        return fExecOcc;
     }
 
     /**
@@ -145,7 +146,7 @@ public class HotSpot extends GraphNode {
      * @return the occurrence number.
      */
     public int getOccurrence() {
-        return occurrence;
+        return fOccurrence;
     }
 
     /**
@@ -154,7 +155,7 @@ public class HotSpot extends GraphNode {
      * @param occ A number to set.
      */
     public void setOccurrence(int occ) {
-        occurrence = occ;
+        fOccurrence = occ;
     }
 
     /*
@@ -164,16 +165,18 @@ public class HotSpot extends GraphNode {
     @Override
     public void draw(IGC context) {
 
+        ISDPreferences pref = SDViewPref.getInstance();
+
         // The execution occurrence is selected
         // if the owning lifeline is selected
-        if (isSelected() || (execOcc != null && execOcc.isSelected()) || (execOcc != null && execOcc.getLifeline() != null && execOcc.getLifeline().isSelected())) {
-            context.setBackground(Frame.getUserPref().getBackGroundColorSelection());
-            context.setForeground(Frame.getUserPref().getForeGroundColorSelection());
+        if (isSelected() || (fExecOcc != null && fExecOcc.isSelected()) || (fExecOcc != null && fExecOcc.getLifeline() != null && fExecOcc.getLifeline().isSelected())) {
+            context.setBackground(pref.getBackGroundColorSelection());
+            context.setForeground(pref.getForeGroundColorSelection());
         } else {
-            context.setBackground(Frame.getUserPref().getBackGroundColor(ISDPreferences.PREF_EXEC));
-            context.setForeground(Frame.getUserPref().getForeGroundColor(ISDPreferences.PREF_EXEC));
+            context.setBackground(pref.getBackGroundColor(ISDPreferences.PREF_EXEC));
+            context.setForeground(pref.getForeGroundColor(ISDPreferences.PREF_EXEC));
         }
-        context.drawImage(image, getX(), getY(), getWidth(), getHeight());
+        context.drawImage(fImage, getX(), getY(), getWidth(), getHeight());
     }
 
     /*
@@ -199,13 +202,13 @@ public class HotSpot extends GraphNode {
      * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.GraphNode#contains(int, int)
      */
     @Override
-    public boolean contains(int _x, int _y) {
+    public boolean contains(int xValue, int yValue) {
         int x = getX();
         int y = getY();
         int width = getWidth();
         int height = getHeight();
 
-        if (Frame.contains(x, y, width, height, _x, _y)) {
+        if (Frame.contains(x, y, width, height, xValue, yValue)) {
             return true;
         }
         return false;
This page took 0.027088 seconds and 5 git commands to generate.