diff options
author | Alexander Kurtakov | 2014-04-15 12:23:16 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2014-04-15 13:22:38 +0000 |
commit | 48452f86c53ca061696626799793634424e919fa (patch) | |
tree | 5bc05813e8e80ae6160606512b1cecbbd074b581 /oprofile/org.eclipse.linuxtools.oprofile.ui/src/org | |
parent | 98142e9b8ae6e1408706320980c22f38f4b4bf12 (diff) | |
download | org.eclipse.linuxtools-48452f86c53ca061696626799793634424e919fa.tar.gz org.eclipse.linuxtools-48452f86c53ca061696626799793634424e919fa.tar.xz org.eclipse.linuxtools-48452f86c53ca061696626799793634424e919fa.zip |
oprofile: Fix warnings.
As identified by Sonar.
Change-Id: I1b68ee593df699d19372edf1a28e8ec913dab1ae
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Reviewed-on: https://git.eclipse.org/r/25048
Tested-by: Hudson CI
Diffstat (limited to 'oprofile/org.eclipse.linuxtools.oprofile.ui/src/org')
2 files changed, 116 insertions, 116 deletions
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/OprofileUiMessages.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/OprofileUiMessages.java index bcf84ce48e..a75158d05e 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/OprofileUiMessages.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/OprofileUiMessages.java @@ -14,20 +14,20 @@ package org.eclipse.linuxtools.internal.oprofile.ui; import java.util.MissingResourceException; import java.util.ResourceBundle; -public class OprofileUiMessages { +public final class OprofileUiMessages { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.oprofile.ui.oprofileui"; //$NON-NLS-1$ + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.oprofile.ui.oprofileui"; //$NON-NLS-1$ - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - private OprofileUiMessages() { - } + private OprofileUiMessages() { + } - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } } diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/OprofileUiPlugin.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/OprofileUiPlugin.java index 7cb0d52da2..de1637d83c 100644 --- a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/OprofileUiPlugin.java +++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/internal/oprofile/ui/OprofileUiPlugin.java @@ -27,108 +27,108 @@ import org.osgi.framework.BundleContext; * The main plugin class to be used in the desktop. */ public class OprofileUiPlugin extends AbstractUIPlugin { - //The shared instance. - private static OprofileUiPlugin plugin; - - private OprofileView oprofileview = null; - - public static final String PLUGIN_ID = "org.eclipse.linuxtools.oprofile.ui"; //$NON-NLS-1$ - public static final String ID_OPROFILE_VIEW = PLUGIN_ID + ".OProfileView"; //$NON-NLS-1$ - - private static final String ICON_PATH = "icons/"; //$NON-NLS-1$ - public static final String SESSION_ICON = ICON_PATH + "session.gif"; //$NON-NLS-1$ - public static final String EVENT_ICON = ICON_PATH + "event.gif"; //$NON-NLS-1$ - public static final String IMAGE_ICON = ICON_PATH + "image.gif"; //$NON-NLS-1$ - public static final String DEPENDENT_ICON = ICON_PATH + "dependent.gif"; //$NON-NLS-1$ - public static final String SYMBOL_ICON = ICON_PATH + "symbol.gif"; //$NON-NLS-1$ - public static final String SAMPLE_ICON = ICON_PATH + "sample.gif"; //$NON-NLS-1$ - public static final String ERROR_ICON = ICON_PATH + "error.png"; //$NON-NLS-1$ - - public static final double MINIMUM_SAMPLE_PERCENTAGE = 0.0001; - - public static final String ANNOTATION_TYPE_LT_MIN_PERCENTAGE = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.min.pct"; //$NON-NLS-1$ - public static final String ANNOTATION_TYPE_LT_05 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.05.pct"; //$NON-NLS-1$ - public static final String ANNOTATION_TYPE_LT_10 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.10.pct"; //$NON-NLS-1$ - public static final String ANNOTATION_TYPE_LT_20 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.20.pct"; //$NON-NLS-1$ - public static final String ANNOTATION_TYPE_LT_30 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.30.pct"; //$NON-NLS-1$ - public static final String ANNOTATION_TYPE_LT_40 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.40.pct"; //$NON-NLS-1$ - public static final String ANNOTATION_TYPE_LT_50 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.50.pct"; //$NON-NLS-1$ - public static final String ANNOTATION_TYPE_GT_50 = "org.eclipse.linuxtools.oprofile.ui.annotation.gt.50.pct"; //$NON-NLS-1$ - - /** - * The constructor. - */ - public OprofileUiPlugin() { - } - - /** - * This method is called upon plug-in activation - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /** - * This method is called when the plug-in is stopped - */ - @Override - public void stop(BundleContext context) throws Exception { - super.stop(context); - plugin = null; - } - - - /** - * Returns the shared instance. - */ - public static OprofileUiPlugin getDefault() { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given - * plug-in relative path - * - * @param path the path - * @return the image descriptor - */ - public static ImageDescriptor getImageDescriptor(String path) { - return imageDescriptorFromPlugin(PLUGIN_ID, path); - } - - public OprofileView getOprofileView() { - return oprofileview; - } - - public void setOprofileView(OprofileView oprofileview) { - this.oprofileview = oprofileview; - } - - public static IWorkbenchWindow getActiveWorkbenchWindow() { - return getDefault().getWorkbench().getActiveWorkbenchWindow(); - } - - public static Shell getActiveWorkbenchShell() { - IWorkbenchWindow window = getActiveWorkbenchWindow(); - if (window != null) { - return window.getShell(); - } - return null; - } - - public static String getPercentageString(double percentage) { - NumberFormat nf = NumberFormat.getPercentInstance(); - if (nf instanceof DecimalFormat) { - nf.setMinimumFractionDigits(2); - nf.setMaximumFractionDigits(2); - } - - if (percentage < OprofileUiPlugin.MINIMUM_SAMPLE_PERCENTAGE) { - return "<" + nf.format(OprofileUiPlugin.MINIMUM_SAMPLE_PERCENTAGE); //$NON-NLS-1$ - } else { - return nf.format(percentage); - } - } + //The shared instance. + private static OprofileUiPlugin plugin; + + private OprofileView oprofileview = null; + + public static final String PLUGIN_ID = "org.eclipse.linuxtools.oprofile.ui"; //$NON-NLS-1$ + public static final String ID_OPROFILE_VIEW = PLUGIN_ID + ".OProfileView"; //$NON-NLS-1$ + + private static final String ICON_PATH = "icons/"; //$NON-NLS-1$ + public static final String SESSION_ICON = ICON_PATH + "session.gif"; //$NON-NLS-1$ + public static final String EVENT_ICON = ICON_PATH + "event.gif"; //$NON-NLS-1$ + public static final String IMAGE_ICON = ICON_PATH + "image.gif"; //$NON-NLS-1$ + public static final String DEPENDENT_ICON = ICON_PATH + "dependent.gif"; //$NON-NLS-1$ + public static final String SYMBOL_ICON = ICON_PATH + "symbol.gif"; //$NON-NLS-1$ + public static final String SAMPLE_ICON = ICON_PATH + "sample.gif"; //$NON-NLS-1$ + public static final String ERROR_ICON = ICON_PATH + "error.png"; //$NON-NLS-1$ + + public static final double MINIMUM_SAMPLE_PERCENTAGE = 0.0001; + + public static final String ANNOTATION_TYPE_LT_MIN_PERCENTAGE = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.min.pct"; //$NON-NLS-1$ + public static final String ANNOTATION_TYPE_LT_05 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.05.pct"; //$NON-NLS-1$ + public static final String ANNOTATION_TYPE_LT_10 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.10.pct"; //$NON-NLS-1$ + public static final String ANNOTATION_TYPE_LT_20 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.20.pct"; //$NON-NLS-1$ + public static final String ANNOTATION_TYPE_LT_30 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.30.pct"; //$NON-NLS-1$ + public static final String ANNOTATION_TYPE_LT_40 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.40.pct"; //$NON-NLS-1$ + public static final String ANNOTATION_TYPE_LT_50 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.50.pct"; //$NON-NLS-1$ + public static final String ANNOTATION_TYPE_GT_50 = "org.eclipse.linuxtools.oprofile.ui.annotation.gt.50.pct"; //$NON-NLS-1$ + + /** + * The constructor. + */ + public OprofileUiPlugin() { + } + + /** + * This method is called upon plug-in activation + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /** + * This method is called when the plug-in is stopped + */ + @Override + public void stop(BundleContext context) throws Exception { + super.stop(context); + plugin = null; + } + + + /** + * Returns the shared instance. + */ + public static OprofileUiPlugin getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + public OprofileView getOprofileView() { + return oprofileview; + } + + public void setOprofileView(OprofileView oprofileview) { + this.oprofileview = oprofileview; + } + + public static IWorkbenchWindow getActiveWorkbenchWindow() { + return getDefault().getWorkbench().getActiveWorkbenchWindow(); + } + + public static Shell getActiveWorkbenchShell() { + IWorkbenchWindow window = getActiveWorkbenchWindow(); + if (window != null) { + return window.getShell(); + } + return null; + } + + public static String getPercentageString(double percentage) { + NumberFormat nf = NumberFormat.getPercentInstance(); + if (nf instanceof DecimalFormat) { + nf.setMinimumFractionDigits(2); + nf.setMaximumFractionDigits(2); + } + + if (percentage < OprofileUiPlugin.MINIMUM_SAMPLE_PERCENTAGE) { + return "<" + nf.format(OprofileUiPlugin.MINIMUM_SAMPLE_PERCENTAGE); //$NON-NLS-1$ + } else { + return nf.format(percentage); + } + } } |