tmf/lttng: Remove unneeded (non-Javadoc) comments
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / preferences / SDViewPref.java
index 2b184303e6aaa64e07ee3b83d5d069a74de2b3f4..3fc4e272f0a9028b2836fa5c45aa1a83dd8d9b64 100755 (executable)
@@ -1,16 +1,15 @@
 /**********************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
- * Copyright (c) 2011, 2012 Ericsson.
- * 
+ * Copyright (c) 2005, 2013 IBM Corporation, Ericsson
  * All rights reserved.   This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: 
- * IBM - Initial API and implementation
- * Bernd Hufmann - Updated for TMF
+ *
+ * Contributors:
+ *     IBM - Initial API and implementation
+ *     Bernd Hufmann - Updated for TMF
  **********************************************************************/
+
 package org.eclipse.linuxtools.tmf.ui.views.uml2sd.preferences;
 
 import java.util.Arrays;
@@ -36,7 +35,7 @@ import org.eclipse.swt.widgets.Display;
 /**
  * This is the Sequence Diagram preference handler. This class is responsible for accessing the current user preferences
  * selection This class also provider getters for each modifiable preferences.
- * 
+ *
  * @version 1.0
  * @author sveyrier
  */
@@ -46,15 +45,15 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
     // Constants
     // ------------------------------------------------------------------------
     /**
-     * Postfix string for background color property 
+     * Postfix string for background color property
      */
     public static final String BACK_COLOR_POSTFIX = "_BACK_COLOR";//$NON-NLS-1$
     /**
-     * Postfix string for foreground color property 
+     * Postfix string for foreground color property
      */
     public static final String FORE_COLOR_POSTFIX = "_FORE_COLOR";//$NON-NLS-1$
     /**
-     * Postfix string for text color property 
+     * Postfix string for text color property
      */
     public static final String TEXT_COLOR_POSTFIX = "_TEXT_COLOR";//$NON-NLS-1$
     /**
@@ -78,7 +77,7 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
      */
     private static final String[] PREF_TEXT_COLOR_LIST = { PREF_LIFELINE, PREF_SYNC_MESS, PREF_SYNC_MESS_RET, PREF_ASYNC_MESS, PREF_ASYNC_MESS_RET, PREF_LIFELINE_HEADER, PREF_FRAME_NAME };
     /**
-     * Temporary tag 
+     * Temporary tag
      */
     protected static final String TEMP_TAG = "_TEMP";//$NON-NLS-1$
 
@@ -91,19 +90,19 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
      */
     private static SDViewPref fHandle = null;
     /**
-     * Hashtable for font preferences 
+     * Hashtable for font preferences
      */
     protected Map<String, IFont> fFontPref;
     /**
-     * Hashtable for foreground color preferences 
+     * Hashtable for foreground color preferences
      */
     protected Map<String, IColor> fForeColorPref;
     /**
-     * Hashtable for background color preferences 
+     * Hashtable for background color preferences
      */
     protected Map<String, IColor> fBackColorPref;
     /**
-     * Hashtable for text color preferences 
+     * Hashtable for text color preferences
      */
     protected Map<String, IColor> fTextColorPref;
     /**
@@ -122,7 +121,7 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
-    
+
     /**
      * Builds the Sequence Diagram preference handler: - Define the preference default values. - Load the currently used
      * preferences setting
@@ -212,7 +211,7 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
 
     /**
      * Returns the PreferenceStore
-     * 
+     *
      * @return the PreferenceStore
      */
     public IPreferenceStore getPreferenceStore() {
@@ -229,7 +228,7 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
 
     /**
      * Returns an unique instance of the Sequence Diagram preference handler
-     * 
+     *
      * @return the preference handler instance
      */
     public static synchronized SDViewPref getInstance() {
@@ -239,46 +238,30 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
         return fHandle;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.ISDPreferences#getForeGroundColor(java.lang.String)
-     */
     @Override
     public IColor getForeGroundColor(String prefName) {
         if ((fForeColorPref.get(prefName + FORE_COLOR_POSTFIX) != null) && (fForeColorPref.get(prefName + FORE_COLOR_POSTFIX) instanceof ColorImpl)) {
-            return (IColor) fForeColorPref.get(prefName + FORE_COLOR_POSTFIX);
+            return fForeColorPref.get(prefName + FORE_COLOR_POSTFIX);
         }
         return ColorImpl.getSystemColor(SWT.COLOR_BLACK);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.ISDPreferences#getBackGroundColor(java.lang.String)
-     */
     @Override
     public IColor getBackGroundColor(String prefName) {
         if ((fBackColorPref.get(prefName + BACK_COLOR_POSTFIX) != null) && (fBackColorPref.get(prefName + BACK_COLOR_POSTFIX) instanceof ColorImpl)) {
-            return (IColor) fBackColorPref.get(prefName + BACK_COLOR_POSTFIX);
+            return fBackColorPref.get(prefName + BACK_COLOR_POSTFIX);
         }
         return ColorImpl.getSystemColor(SWT.COLOR_WHITE);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.ISDPreferences#getFontColor(java.lang.String)
-     */
     @Override
     public IColor getFontColor(String prefName) {
         if ((fTextColorPref.get(prefName + TEXT_COLOR_POSTFIX) != null) && (fTextColorPref.get(prefName + TEXT_COLOR_POSTFIX) instanceof ColorImpl)) {
-            return (IColor) fTextColorPref.get(prefName + TEXT_COLOR_POSTFIX);
+            return fTextColorPref.get(prefName + TEXT_COLOR_POSTFIX);
         }
         return ColorImpl.getSystemColor(SWT.COLOR_BLACK);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.ISDPreferences#getForeGroundColorSelection()
-     */
     @Override
     public IColor getForeGroundColorSelection() {
         if (fNoFocusSelection) {
@@ -287,10 +270,6 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
         return ColorImpl.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.ISDPreferences#getBackGroundColorSelection()
-     */
     @Override
     public IColor getBackGroundColorSelection() {
         if (fNoFocusSelection) {
@@ -299,21 +278,17 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
         return ColorImpl.getSystemColor(SWT.COLOR_LIST_SELECTION);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.ISDPreferences#getFont(java.lang.String)
-     */
     @Override
     public IFont getFont(String prefName) {
-        if ((fFontPref.get(prefName) != null) && (fFontPref.get(prefName) instanceof IFont)) {
-            return (IFont) fFontPref.get(prefName);
+        if (fFontPref.get(prefName) != null) {
+            return fFontPref.get(prefName);
         }
         return FontImpl.getSystemFont();
     }
 
     /**
      * Returns the SwimLane width chosen
-     * 
+     *
      * @return the SwimLane width
      */
     public int getLifelineWidth() {
@@ -322,7 +297,7 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
 
     /**
      * Returns if font linkage with zoom has been chosen
-     * 
+     *
      * @return true if checked false otherwise
      */
     public boolean fontLinked() {
@@ -331,7 +306,7 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
 
     /**
      * Returns the tooltip enablement
-     * 
+     *
      * @return true if checked false otherwise
      */
     public boolean tooltipEnabled() {
@@ -341,26 +316,18 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
     /**
      * Return true if the user do not want to take external time (basically found and lost messages with time) into
      * account in the min max computation
-     * 
+     *
      * @return true if checked false otherwise
      */
     public boolean excludeExternalTime() {
         return fPrefStore.getBoolean(PREF_EXCLUDE_EXTERNAL_TIME);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.ISDPreferences#useGradienColor()
-     */
     @Override
     public boolean useGradienColor() {
         return fPrefStore.getBoolean(PREF_USE_GRADIENT);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.ISDPreferences#getTimeCompressionSelectionColor()
-     */
     @Override
     public IColor getTimeCompressionSelectionColor() {
         return fTimeCompressionSelectionColor;
@@ -375,32 +342,32 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
 
         for (int i = 0; i < FONT_LIST.length; i++) {
             FontData fontData = PreferenceConverter.getFontData(fPrefStore, FONT_LIST[i]);
-            if ((fFontPref.get(FONT_LIST[i]) != null) && (fFontPref.get(FONT_LIST[i]) instanceof IFont)) {
-                ((IFont) fFontPref.get(FONT_LIST[i])).dispose();
+            if (fFontPref.get(FONT_LIST[i]) != null) {
+                fFontPref.get(FONT_LIST[i]).dispose();
             }
             fFontPref.put(FONT_LIST[i], new FontImpl(display, fontData));
         }
 
         for (int i = 0; i < PREF_BACK_COLOR_LIST.length; i++) {
             RGB rgb = PreferenceConverter.getColor(fPrefStore, PREF_BACK_COLOR_LIST[i] + BACK_COLOR_POSTFIX);
-            if ((fBackColorPref.get(PREF_BACK_COLOR_LIST[i] + BACK_COLOR_POSTFIX) != null) && (fBackColorPref.get(PREF_BACK_COLOR_LIST[i] + BACK_COLOR_POSTFIX) instanceof IColor)) {
-                ((IColor) fBackColorPref.get(PREF_BACK_COLOR_LIST[i] + BACK_COLOR_POSTFIX)).dispose();
+            if (fBackColorPref.get(PREF_BACK_COLOR_LIST[i] + BACK_COLOR_POSTFIX) != null) {
+                fBackColorPref.get(PREF_BACK_COLOR_LIST[i] + BACK_COLOR_POSTFIX).dispose();
             }
             fBackColorPref.put(PREF_BACK_COLOR_LIST[i] + BACK_COLOR_POSTFIX, new ColorImpl(display, rgb.red, rgb.green, rgb.blue));
         }
 
         for (int i = 0; i < PREF_FORE_COLOR_LIST.length; i++) {
             RGB rgb = PreferenceConverter.getColor(fPrefStore, PREF_FORE_COLOR_LIST[i] + FORE_COLOR_POSTFIX);
-            if ((fForeColorPref.get(PREF_FORE_COLOR_LIST[i] + FORE_COLOR_POSTFIX) != null) && (fForeColorPref.get(PREF_FORE_COLOR_LIST[i] + FORE_COLOR_POSTFIX) instanceof IColor)) {
-                ((IColor) fForeColorPref.get(PREF_FORE_COLOR_LIST[i] + FORE_COLOR_POSTFIX)).dispose();
+            if (fForeColorPref.get(PREF_FORE_COLOR_LIST[i] + FORE_COLOR_POSTFIX) != null) {
+                fForeColorPref.get(PREF_FORE_COLOR_LIST[i] + FORE_COLOR_POSTFIX).dispose();
             }
             fForeColorPref.put(PREF_FORE_COLOR_LIST[i] + FORE_COLOR_POSTFIX, new ColorImpl(display, rgb.red, rgb.green, rgb.blue));
         }
 
         for (int i = 0; i < PREF_TEXT_COLOR_LIST.length; i++) {
             RGB rgb = PreferenceConverter.getColor(fPrefStore, PREF_TEXT_COLOR_LIST[i] + TEXT_COLOR_POSTFIX);
-            if ((fTextColorPref.get(PREF_TEXT_COLOR_LIST[i] + TEXT_COLOR_POSTFIX) != null) && (fTextColorPref.get(PREF_TEXT_COLOR_LIST[i] + TEXT_COLOR_POSTFIX) instanceof IColor)) {
-                ((IColor) fTextColorPref.get(PREF_TEXT_COLOR_LIST[i] + TEXT_COLOR_POSTFIX)).dispose();
+            if (fTextColorPref.get(PREF_TEXT_COLOR_LIST[i] + TEXT_COLOR_POSTFIX) != null) {
+                fTextColorPref.get(PREF_TEXT_COLOR_LIST[i] + TEXT_COLOR_POSTFIX).dispose();
             }
             fTextColorPref.put(PREF_TEXT_COLOR_LIST[i] + TEXT_COLOR_POSTFIX, new ColorImpl(display, rgb.red, rgb.green, rgb.blue));
         }
@@ -412,69 +379,83 @@ public class SDViewPref implements ISDPreferences, IPropertyChangeListener {
         fTimeCompressionSelectionColor = new ColorImpl(display, rgb.red, rgb.green, rgb.blue);
     }
 
+    /**
+     * Add a property-change listener
+     *
+     * @param listener
+     *            The listener to add
+     */
     public void addPropertyChangeListener(IPropertyChangeListener listener) {
         fPrefStore.addPropertyChangeListener(listener);
     }
 
+    /**
+     * Remove a property-change listener
+     *
+     * @param listener
+     *            The listerner to remove
+     */
     public void removePropertyChangeListener(IPropertyChangeListener listener) {
         fPrefStore.removePropertyChangeListener(listener);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
-     */
     @Override
     public void propertyChange(PropertyChangeEvent event) {
         if (!event.getProperty().equals("PREFOK")) { //$NON-NLS-1$
             buildFontsAndColors();
-            fPrefStore.firePropertyChangeEvent("PREFOK", null, null); //$NON-NLS-1$    
+            fPrefStore.firePropertyChangeEvent("PREFOK", null, null); //$NON-NLS-1$
         }
     }
 
+    /**
+     * Set the "no focus selection" preference
+     *
+     * @param v
+     *            New value to use
+     */
     public void setNoFocusSelection(boolean v) {
         fNoFocusSelection = v;
     }
 
     /**
      * Returns the static font list.
-     * 
+     *
      * @return static font list
      */
     public static String[] getFontList() {
         return Arrays.copyOf(FONT_LIST, FONT_LIST.length);
     }
-    
+
     /**
      * Returns the 2nd static font list.
-     * 
+     *
      * @return 2nd static font list
      */
     public static String[] getFontList2() {
         return Arrays.copyOf(FONT_LIST2, FONT_LIST2.length);
     }
-    
+
     /**
      * Returns the preference background color list.
-     * 
+     *
      * @return preference background color list
      */
     public static String[] getPrefBackColorList() {
         return Arrays.copyOf(PREF_BACK_COLOR_LIST, PREF_BACK_COLOR_LIST.length);
     }
-    
+
     /**
      * Returns the preference foreground color list.
-     * 
+     *
      * @return preference foreground color list
      */
     public static String[] getPrefForeColorList() {
         return Arrays.copyOf(PREF_FORE_COLOR_LIST, PREF_FORE_COLOR_LIST.length);
     }
-    
+
     /**
      * Returns the preference text color list color list.
-     * 
+     *
      * @return preference text color list color list
      */
     public static String[] getPrefTextColorList() {
This page took 0.028639 seconds and 5 git commands to generate.