1+
12package net .sourceforge .pmd .eclipse .plugin ;
23
34import java .io .File ;
@@ -87,17 +88,17 @@ public class PMDPlugin extends AbstractUIPlugin {
8788
8889 public static final String PLUGIN_ID = "net.sourceforge.pmd.eclipse.plugin" ;
8990
90- private static Map <IProject , IJavaProject > JavaProjectsByIProject = new HashMap <IProject , IJavaProject >();
91+ private static Map <IProject , IJavaProject > javaProjectsByIProject = new HashMap <IProject , IJavaProject >();
9192
9293 // The shared instance
9394 private static PMDPlugin plugin ;
9495
95- public static String VERSION = "unknown" ;
96+ public static String version = "unknown" ;
9697
97- private static final Integer [] priorityValues = new Integer [] { Integer .valueOf (1 ), Integer .valueOf (2 ),
98- Integer .valueOf (3 ), Integer .valueOf (4 ), Integer .valueOf (5 ) };
98+ private static final Integer [] PRIORITY_VALUES = new Integer [] { Integer .valueOf (1 ), Integer .valueOf (2 ),
99+ Integer .valueOf (3 ), Integer .valueOf (4 ), Integer .valueOf (5 ), };
99100
100- private static final Logger log = Logger .getLogger (PMDPlugin .class );
101+ private static final Logger LOG = Logger .getLogger (PMDPlugin .class );
101102
102103 private StringTable stringTable ; // NOPMD by Herlin on 11/10/06 00:22
103104
@@ -117,8 +118,9 @@ public PMDPlugin() {
117118 public Color colorFor (RGB rgb ) {
118119
119120 Color color = coloursByRGB .get (rgb );
120- if (color != null )
121+ if (color != null ) {
121122 return color ;
123+ }
122124
123125 color = new Color (null , rgb .red , rgb .green , rgb .blue );
124126 coloursByRGB .put (rgb , color );
@@ -148,10 +150,10 @@ public static void setJavaClassLoader(PMDConfiguration config, IProject project)
148150 */
149151 public static LanguageVersion javaVersionFor (IProject project ) {
150152
151- IJavaProject jProject = JavaProjectsByIProject .get (project );
153+ IJavaProject jProject = javaProjectsByIProject .get (project );
152154 if (jProject == null ) {
153155 jProject = JavaCore .create (project );
154- JavaProjectsByIProject .put (project , jProject );
156+ javaProjectsByIProject .put (project , jProject );
155157 }
156158
157159 if (jProject .exists ()) {
@@ -162,10 +164,10 @@ public static LanguageVersion javaVersionFor(IProject project) {
162164 }
163165
164166 public static IClasspathEntry buildSourceClassPathEntryFor (IProject project ) {
165- IJavaProject jProject = JavaProjectsByIProject .get (project );
167+ IJavaProject jProject = javaProjectsByIProject .get (project );
166168 if (jProject == null ) {
167169 jProject = JavaCore .create (project );
168- JavaProjectsByIProject .put (project , jProject );
170+ javaProjectsByIProject .put (project , jProject );
169171 }
170172 if (jProject .exists ()) {
171173 try {
@@ -177,7 +179,7 @@ public static IClasspathEntry buildSourceClassPathEntryFor(IProject project) {
177179 }
178180 }
179181 } catch (JavaModelException e ) {
180- log .error ("Couldn't determine source classpath" , e );
182+ LOG .error ("Couldn't determine source classpath" , e );
181183 }
182184 }
183185 return null ;
@@ -189,8 +191,9 @@ private void disposeResources() {
189191 }
190192
191193 public static void disposeAll (Collection <Color > colors ) {
192- for (Color color : colors )
194+ for (Color color : colors ) {
193195 color .dispose ();
196+ }
194197 }
195198
196199 public static File getPluginFolder () {
@@ -211,9 +214,8 @@ public static File getPluginFolder() {
211214 /*
212215 * (non-Javadoc)
213216 *
214- * @see
215- * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
216- * )
217+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.
218+ * BundleContext )
217219 */
218220 public void start (BundleContext context ) throws Exception {
219221 super .start (context );
@@ -238,16 +240,17 @@ public void resourceChanged(IResourceChangeEvent arg0) {
238240 }
239241 });
240242
241- VERSION = context .getBundle ().getHeaders ().get ("Bundle-Version" );
243+ version = context .getBundle ().getHeaders ().get ("Bundle-Version" );
242244 }
243245
244246 public void fileChangeListenerEnabled (boolean flag ) {
245247
246248 IWorkspace workspace = ResourcesPlugin .getWorkspace ();
247249
248250 if (flag ) {
249- if (changeReviewer == null )
251+ if (changeReviewer == null ) {
250252 changeReviewer = new FileChangeReviewer ();
253+ }
251254 workspace .addResourceChangeListener (changeReviewer );
252255 } else {
253256 if (changeReviewer != null ) {
@@ -260,9 +263,8 @@ public void fileChangeListenerEnabled(boolean flag) {
260263 /*
261264 * (non-Javadoc)
262265 *
263- * @see
264- * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
265- * )
266+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.
267+ * BundleContext )
266268 */
267269 public void stop (BundleContext context ) throws Exception {
268270
@@ -320,8 +322,8 @@ public Image getImage(String key, String iconPath) {
320322 */
321323 public void logError (String message , Throwable t ) {
322324 getLog ().log (new Status (IStatus .ERROR , getBundle ().getSymbolicName (), 0 , message + t .getMessage (), t ));
323- if (log != null ) {
324- log .error (message , t );
325+ if (LOG != null ) {
326+ LOG .error (message , t );
325327 }
326328 }
327329
@@ -332,8 +334,8 @@ public void logError(String message, Throwable t) {
332334 */
333335 public void logError (IStatus status ) {
334336 getLog ().log (status );
335- if (log != null ) {
336- log .error (status .getMessage (), status .getException ());
337+ if (LOG != null ) {
338+ LOG .error (status .getMessage (), status .getException ());
337339 }
338340 }
339341
@@ -382,7 +384,7 @@ public StringTable getStringTable() {
382384 * @deprecated
383385 */
384386 public Integer [] getPriorityValues () {
385- return priorityValues ;
387+ return PRIORITY_VALUES ;
386388 }
387389
388390 /**
@@ -554,8 +556,9 @@ public RuleLabelDecorator ruleLabelDecorator() {
554556 public void changedFiles (Collection <IFile > changedFiles ) {
555557
556558 RuleLabelDecorator rld = ruleLabelDecorator ();
557- if (rld == null )
559+ if (rld == null ) {
558560 return ;
561+ }
559562
560563 Collection <IResource > withParents = new HashSet <IResource >(changedFiles .size () * 2 );
561564 withParents .addAll (changedFiles );
@@ -607,8 +610,9 @@ private void addFilesTo(IResource resource, Collection<IResource> allKids) {
607610
608611 private void addKids (Collection <IResource > allKids , IResource [] kids ) {
609612
610- if (kids == null )
613+ if (kids == null ) {
611614 return ;
615+ }
612616
613617 for (IResource irc : kids ) {
614618 if (irc instanceof IFile ) {
@@ -624,8 +628,9 @@ private void addKids(Collection<IResource> allKids, IResource[] kids) {
624628 public void removedMarkersIn (IResource resource ) {
625629
626630 RuleLabelDecorator decorator = ruleLabelDecorator ();
627- if (decorator == null )
631+ if (decorator == null ) {
628632 return ;
633+ }
629634
630635 Collection <IResource > changes = new ArrayList <IResource >();
631636
0 commit comments