Commits

Anonymous committed 4538c1a

Introducing Checkstyle to improve code quality.
Added checks and fixed issues for:
- avoid star import
- illegal import
- redundant import
- unused import
- modifier order
- redundant modifier
- constant name
- type name
- class type parameter name
- member name
- local final variable name
- local variable name
- method name
- method type parameter name
- parameter name
- static variable name
- package name
- left curly
- right curly
- need braces
- avoid nested blocks
- generic whitespace
- empty for initializer pad
- empty for iterator pad
- no whitespace after
- no whitespace before
- operator wrap
- method param pad
- paren pad
- typecast paren pad
- whitespace after
- no finalizer
- no clone
- package declaration
- unnecessary parentheses
- redundant throws
- string literal equality
- default comes last
- equals avoid null
- equals hash code
- fall through
- multiple variable declarations
- explicit initialization
- simplify boolean expression
- simplify boolean return
- covariant equals
- final class
- hide utility class constructor
- interface is type
- mutable exception
- array type style
- upper ell
- uncommented main
- system.out / err

  • Participants
  • Parent commits 9ed11ec

Comments (0)

Files changed (207)

+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true">
+  <local-check-config name="MercurialEclipse Checkstyle Configuration" location=".settings/checkstyle.xml" type="project" description="">
+    <additional-data name="protect-config-file" value="false"/>
+  </local-check-config>
+  <fileset name="all" enabled="true" check-config-name="MercurialEclipse Checkstyle Configuration" local="true">
+    <file-match-pattern match-pattern="." include-pattern="true"/>
+  </fileset>
+</fileset-config>
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>MercurialEclipse</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.pde.ManifestBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.pde.SchemaBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.pde.PluginNature</nature>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-		<nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
-	</natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>MercurialEclipse</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
+		<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
+	</natures>
+</projectDescription>

.settings/checkstyle.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+
+<!--
+    This configuration file was written by the eclipse-cs plugin configuration editor
+-->
+<!--
+    Checkstyle-Configuration: MercurialEclipse Checkstyle Configuration
+    Description: none
+-->
+<module name="Checker">
+  <property name="severity" value="warning"/>
+  <module name="TreeWalker">
+    <module name="AvoidStarImport"/>
+    <module name="IllegalImport"/>
+    <module name="RedundantImport"/>
+    <module name="UnusedImports"/>
+    <module name="ModifierOrder"/>
+    <module name="RedundantModifier"/>
+    <module name="ConstantName"/>
+    <module name="TypeName"/>
+    <module name="ClassTypeParameterName"/>
+    <module name="MemberName"/>
+    <module name="LocalFinalVariableName"/>
+    <module name="LocalVariableName"/>
+    <module name="MethodName"/>
+    <module name="MethodTypeParameterName"/>
+    <module name="ParameterName"/>
+    <module name="StaticVariableName"/>
+    <module name="PackageName">
+      <property name="format" value="^\Qcom.vectrace.MercurialEclipse\E(\.[a-z][a-z0-9]*)*$"/>
+    </module>
+    <module name="LeftCurly"/>
+    <module name="RightCurly"/>
+    <module name="NeedBraces"/>
+    <module name="AvoidNestedBlocks"/>
+    <module name="GenericWhitespace"/>
+    <module name="EmptyForInitializerPad"/>
+    <module name="EmptyForIteratorPad"/>
+    <module name="NoWhitespaceAfter">
+      <property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
+    </module>
+    <module name="NoWhitespaceBefore"/>
+    <module name="OperatorWrap"/>
+    <module name="MethodParamPad"/>
+    <module name="ParenPad"/>
+    <module name="TypecastParenPad">
+      <property name="tokens" value="RPAREN,TYPECAST"/>
+    </module>
+    <module name="WhitespaceAfter"/>
+    <module name="NoFinalizer"/>
+    <module name="PackageDeclaration"/>
+    <module name="NoClone"/>
+    <module name="UnnecessaryParentheses"/>
+    <module name="RedundantThrows">
+      <property name="allowUnchecked" value="true"/>
+      <property name="allowSubclasses" value="true"/>
+      <property name="logLoadErrors" value="true"/>
+      <property name="suppressLoadErrors" value="true"/>
+    </module>
+    <module name="StringLiteralEquality"/>
+    <module name="DefaultComesLast"/>
+    <module name="EqualsAvoidNull"/>
+    <module name="EqualsHashCode"/>
+    <module name="ExplicitInitialization"/>
+    <module name="FallThrough"/>
+    <module name="MultipleVariableDeclarations"/>
+    <module name="SimplifyBooleanExpression"/>
+    <module name="SimplifyBooleanReturn"/>
+    <module name="CovariantEquals"/>
+    <module name="FinalClass"/>
+    <module name="HideUtilityClassConstructor"/>
+    <module name="InterfaceIsType"/>
+    <module name="MutableException"/>
+    <module name="ArrayTypeStyle"/>
+    <module name="UpperEll"/>
+    <module name="UncommentedMain"/>
+    <module name="RegexpSinglelineJava">
+      <metadata name="net.sf.eclipsecs.core.comment" value="Do not use System.out or System.err."/>
+      <property name="id" value="SystemOutErr"/>
+      <property name="format" value="System\.(out|err)"/>
+      <property name="message" value="Do not use System.out or System.err. Use MercurialEclipsePlugin.logXXX() instead."/>
+      <property name="ignoreComments" value="true"/>
+    </module>
+  </module>
+  <module name="SuppressionFilter">
+    <property name="file" value="${config_loc}/checkstyle_suppressions.xml"/>
+  </module>
+</module>

.settings/checkstyle_suppressions.xml

+<?xml version="1.0"?>
+<!DOCTYPE suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN" "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
+
+<suppressions>
+	<!--
+		Suppress static variable name check for Messages classes that extend
+		NLS and therefore need to follow a special naming convention for its
+		members.
+	-->
+	<suppress checks="StaticVariableName" files="Messages.java" />
+	
+	<!--
+		Allow System.out and System.err in tests.
+	-->
+	<suppress checks="RegexpSinglelineJava" id="SystemOutErr" files="[\\\/]test[\\\/]" />
+</suppressions>

src/com/vectrace/MercurialEclipse/AdapterFactory.java

 	@SuppressWarnings("unchecked")
 	public MercurialHistoryPageSource getAdapter(Object adaptableObject, Class adapterType) {
 		if((adaptableObject instanceof MercurialHistoryProvider) && adapterType == IHistoryPageSource.class) {
-			return new MercurialHistoryPageSource((MercurialHistoryProvider)adaptableObject);
+			return new MercurialHistoryPageSource((MercurialHistoryProvider) adaptableObject);
 		}
 		if((adaptableObject instanceof HgRoot) && adapterType == IHistoryPageSource.class) {
 			return new MercurialHistoryPageSource(null);

src/com/vectrace/MercurialEclipse/MercurialEclipsePlugin.java

 import com.vectrace.MercurialEclipse.commands.HgCommand;
 import com.vectrace.MercurialEclipse.commands.HgDebugInstallClient;
 import com.vectrace.MercurialEclipse.exception.HgException;
-import com.vectrace.MercurialEclipse.model.HgRoot;
 import com.vectrace.MercurialEclipse.preferences.MercurialPreferenceConstants;
 import com.vectrace.MercurialEclipse.storage.HgCommitMessageManager;
 import com.vectrace.MercurialEclipse.storage.HgRepositoryLocationManager;
 
 	public static final String ID = "com.vectrace.MercurialEclipse"; //$NON-NLS-1$
 
-	public static final String ID_ChangeLogView = "com.vectrace.MercurialEclipse.views.ChangeLogView"; //$NON-NLS-1$
+	public static final String ID_CHANGELOG_VIEW = "com.vectrace.MercurialEclipse.views.ChangeLogView"; //$NON-NLS-1$
 
 	public static final String BUNDLE_FILE_PREFIX = "bundlefile"; //$NON-NLS-1$
 
 	/**
 	 * Gets the repository manager
 	 */
-	static public HgRepositoryLocationManager getRepoManager() {
+	public static HgRepositoryLocationManager getRepoManager() {
 		return repoManager;
 	}
 
 		return new Status(severity, ID, code, msg, ex);
 	}
 
-	public final static void logError(Throwable ex) {
+	public static final void logError(Throwable ex) {
 		logError(ex.getMessage(), ex);
 	}
 

src/com/vectrace/MercurialEclipse/Messages.java

  * @author bastian
  *
  */
-public class Messages {
+public final class Messages {
 	private static final String BUNDLE_NAME = "com.vectrace.MercurialEclipse.messages"; //$NON-NLS-1$
 
 	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle

src/com/vectrace/MercurialEclipse/SafeUiJob.java

 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.progress.UIJob;
 
-public class SafeUiJob extends UIJob
-{
+public class SafeUiJob extends UIJob {
 
-/**
-   * @param name
-   */
-public SafeUiJob(String name)
-{
-	super(name);
-}
+	/**
+	 * @param name
+	 */
+	public SafeUiJob(String name) {
+		super(name);
+	}
 
-/**
-   * @param jobDisplay
-   * @param name
-   */
-public SafeUiJob(Display jobDisplay, String name)
-{
-	super(jobDisplay, name);
-}
+	/**
+	 * @param jobDisplay
+	 * @param name
+	 */
+	public SafeUiJob(Display jobDisplay, String name) {
+		super(jobDisplay, name);
+	}
 
-/*
-   * (non-Javadoc)
-   *
-   * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor)
-   */
-@Override
-public final IStatus runInUIThread(IProgressMonitor monitor)
-{
-	try
-	{
-	  return runSafe(monitor);
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	@Override
+	public final IStatus runInUIThread(IProgressMonitor monitor) {
+		try {
+			return runSafe(monitor);
+		} catch (RuntimeException error) {
+			MercurialEclipsePlugin.logError(error);
+			return Status.CANCEL_STATUS;
+		}
 	}
-	catch (RuntimeException error)
-	{
-	  MercurialEclipsePlugin.logError(error);
-	  return Status.CANCEL_STATUS;
+
+	/**
+	 * @param monitor
+	 * @return
+	 */
+	protected IStatus runSafe(IProgressMonitor monitor) {
+		return Status.OK_STATUS;
 	}
-}
-
-/**
-   * @param monitor
-   * @return
-   */
-protected IStatus runSafe(IProgressMonitor monitor)
-{
-	return Status.OK_STATUS;
-}
 
 }

src/com/vectrace/MercurialEclipse/TableColumnSorter.java

 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.widgets.TableColumn;
 
-public abstract class TableColumnSorter extends ViewerComparator
-{
-public static final int ASC = 1;
+public abstract class TableColumnSorter extends ViewerComparator {
+	public static final int ASC = 1;
 
-public static final int NONE = 0;
+	public static final int NONE = 0;
 
-public static final int DESC = -1;
+	public static final int DESC = -1;
 
-private int direction = 0;
+	private int direction;
 
-private TableColumn column;
+	private final TableColumn column;
 
-private TableViewer viewer;
+	private final TableViewer viewer;
 
-public TableColumnSorter(TableViewer viewer, TableColumn column)
-{
-	this.column = column;
-	this.viewer = viewer;
-	this.column.addSelectionListener(new SelectionAdapter()
-	{
+	public TableColumnSorter(TableViewer viewer, TableColumn column) {
+		this.column = column;
+		this.viewer = viewer;
+		this.column.addSelectionListener(new SelectionAdapter() {
 
-	  @Override
-	public void widgetSelected(SelectionEvent e)
-	  {
-		if (TableColumnSorter.this.viewer.getComparator() != null)
-		{
-		  if (TableColumnSorter.this.viewer.getComparator() == TableColumnSorter.this)
-		  {
-			int tdirection = TableColumnSorter.this.direction;
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				if (TableColumnSorter.this.viewer.getComparator() != null) {
+					if (TableColumnSorter.this.viewer.getComparator() == TableColumnSorter.this) {
+						int tdirection = TableColumnSorter.this.direction;
 
-			if (tdirection == ASC)
-			{
-			  setSorter(TableColumnSorter.this, DESC);
-			} else if (tdirection == DESC)
-			{
-			  setSorter(TableColumnSorter.this, ASC);
+						if (tdirection == ASC) {
+							setSorter(TableColumnSorter.this, DESC);
+						} else if (tdirection == DESC) {
+							setSorter(TableColumnSorter.this, ASC);
+						}
+					} else {
+						setSorter(TableColumnSorter.this, ASC);
+					}
+				} else {
+					setSorter(TableColumnSorter.this, ASC);
+				}
 			}
-		  }
-		  else
-		  {
-			setSorter(TableColumnSorter.this, ASC);
-		  }
+		});
+	}
+
+	public void setSorter(TableColumnSorter sorter, int direction) {
+		if (direction == NONE) {
+			column.getParent().setSortColumn(null);
+			column.getParent().setSortDirection(SWT.NONE);
+			viewer.setComparator(null);
+		} else {
+			column.getParent().setSortColumn(column);
+			sorter.direction = direction;
+
+			if (direction == ASC) {
+				column.getParent().setSortDirection(SWT.DOWN);
+			} else {
+				column.getParent().setSortDirection(SWT.UP);
+			}
+
+			if (viewer.getComparator() == sorter) {
+				viewer.refresh();
+			} else {
+				viewer.setComparator(sorter);
+			}
+
 		}
-		else
-		{
-		  setSorter(TableColumnSorter.this, ASC);
-		}
-	  }
-	});
+	}
+
+	@Override
+	public int compare(Viewer cViewer, Object e1, Object e2) {
+		return direction * doCompare(cViewer, e1, e2);
+	}
+
+	protected abstract int doCompare(Viewer tableViewer, Object e1, Object e2);
 }
-
-public void setSorter(TableColumnSorter sorter, int direction)
-{
-	if (direction == NONE)
-	{
-	  column.getParent().setSortColumn(null);
-	  column.getParent().setSortDirection(SWT.NONE);
-	  viewer.setComparator(null);
-	}
-	else
-	{
-	  column.getParent().setSortColumn(column);
-	  sorter.direction = direction;
-
-	  if (direction == ASC)
-	  {
-		column.getParent().setSortDirection(SWT.DOWN);
-	  }
-	  else
-	  {
-		column.getParent().setSortDirection(SWT.UP);
-	  }
-
-	  if (viewer.getComparator() == sorter)
-	  {
-		viewer.refresh();
-	  }
-	  else
-	  {
-		viewer.setComparator(sorter);
-	  }
-
-	}
-}
-
-@Override
-public int compare(Viewer cViewer, Object e1, Object e2)
-{
-	return direction * doCompare(cViewer, e1, e2);
-}
-
-protected abstract int doCompare(Viewer TableViewer, Object e1, Object e2);
-}

src/com/vectrace/MercurialEclipse/actions/ExportAsBundleAction.java

 	private final MercurialHistoryPage mhp;
 	private String file;
 	private String base;
-	private final static ImageDescriptor imageDesc = MercurialEclipsePlugin
+	private static final ImageDescriptor IMAGE_DESC = MercurialEclipsePlugin
 			.getImageDescriptor("export.gif"); //$NON-NLS-1$
 
 	private void determineFileAndBase() {
 	}
 
 	public ExportAsBundleAction(MercurialHistoryPage mhp) {
-		super(Messages.getString("ExportAsBundleAction.exportSelectedRevisionAsBundle"), imageDesc);
+		super(Messages.getString("ExportAsBundleAction.exportSelectedRevisionAsBundle"), IMAGE_DESC);
 		this.mhp = mhp;
 	}
 

src/com/vectrace/MercurialEclipse/actions/HgOperation.java

 		return getActionDescription();
 	}
 
-	abstract protected String getActionDescription();
+	protected abstract String getActionDescription();
 }

src/com/vectrace/MercurialEclipse/actions/MergeWithCurrentChangesetAction.java

  */
 public class MergeWithCurrentChangesetAction extends Action {
 	private final MercurialHistoryPage mhp;
-	private final static ImageDescriptor imageDesc = MercurialEclipsePlugin
+	private static final ImageDescriptor IMAGE_DESC = MercurialEclipsePlugin
 			.getImageDescriptor("actions/merge.gif"); //$NON-NLS-1$
 
 	/**
 	 *
 	 */
 	public MergeWithCurrentChangesetAction(MercurialHistoryPage mhp) {
-		super(Messages.getString("MergeWithCurrentChangesetAction.mergeSelectedChangesetWithCurrentChangeset"), imageDesc); //$NON-NLS-1$
+		super(Messages.getString("MergeWithCurrentChangesetAction.mergeSelectedChangesetWithCurrentChangeset"), IMAGE_DESC); //$NON-NLS-1$
 		this.mhp = mhp;
 	}
 

src/com/vectrace/MercurialEclipse/actions/Messages.java

  * @author bastian
  *
  */
-public class Messages {
+public final class Messages {
 	private static final String BUNDLE_NAME = "com.vectrace.MercurialEclipse.actions.messages"; //$NON-NLS-1$
 
 	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle

src/com/vectrace/MercurialEclipse/annotations/AnnotateBlock.java

 
 private HgRevision revision = new HgRevision("", -1); //$NON-NLS-1$
 private String user = ""; //$NON-NLS-1$
-private int startLine = 0;
-private int endLine = 0;
+private final int startLine;
+private int endLine;
 private Date date;
 
 public AnnotateBlock(HgRevision revision, String user, Date date, int startLine, int endLine) {
 }
 
 /**
-   * Answer true if the receiver contains the given line number, false otherwse.
+   * Answer true if the receiver contains the given line number, false otherwise.
    * @param i a line number
    * @return true if receiver contains a line number.
    */
 public boolean contains(int i) {
-	return (i >= startLine && i <= endLine);
+	return i >= startLine && i <= endLine;
 }
 
 /**

src/com/vectrace/MercurialEclipse/annotations/AnnotateBlocks.java

 import java.util.LinkedList;
 import java.util.List;
 
-public class AnnotateBlocks
-{
-private List<AnnotateBlock> blocks = new LinkedList<AnnotateBlock>();
+public class AnnotateBlocks {
+	private final List<AnnotateBlock> blocks = new LinkedList<AnnotateBlock>();
 
-/**
-   * Add an annotate block merging this block with the previous block if it is
-   * part of the same change.
-   *
-   * @param aBlock
-   */
-public void add(AnnotateBlock aBlock)
-{
+	/**
+	 * Add an annotate block merging this block with the previous block if it is part of the same
+	 * change.
+	 *
+	 * @param aBlock
+	 */
+	public void add(AnnotateBlock aBlock) {
 
-	int size = blocks.size();
-	if (size == 0)
-	{
-	  blocks.add(aBlock);
-	} else
-	{
-	  AnnotateBlock lastBlock = blocks.get(size - 1);
-	  if (lastBlock.getRevision().equals(aBlock.getRevision()))
-	  {
-		lastBlock.setEndLine(aBlock.getStartLine());
-	  } else
-	  {
-		blocks.add(aBlock);
-	  }
+		int size = blocks.size();
+		if (size == 0) {
+			blocks.add(aBlock);
+		} else {
+			AnnotateBlock lastBlock = blocks.get(size - 1);
+			if (lastBlock.getRevision().equals(aBlock.getRevision())) {
+				lastBlock.setEndLine(aBlock.getStartLine());
+			} else {
+				blocks.add(aBlock);
+			}
+		}
 	}
-}
 
-public List<AnnotateBlock> getAnnotateBlocks()
-{
-	return blocks;
-}
+	public List<AnnotateBlock> getAnnotateBlocks() {
+		return blocks;
+	}
 
 }

src/com/vectrace/MercurialEclipse/annotations/AnnotateCommand.java

 		}
 		HgRoot root = AbstractClient.getHgRoot(resource);
 		String relPath = root.toRelative(resource.getLocation().toFile());
-		String launchCmd[] = { MercurialUtilities.getHGExecutable(),
+		String[] launchCmd = { MercurialUtilities.getHGExecutable(),
 				"annotate", "--follow", "--user", "--number", "--changeset", "--date", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
 				"--", relPath }; //$NON-NLS-1$
 

src/com/vectrace/MercurialEclipse/annotations/CommitterColors.java

 	}
 
 	/** The color map. */
-	private final Map<String,RGB> fColors= new HashMap<String,RGB>();
+	private final Map<String, RGB> fColors = new HashMap<String, RGB>();
 
 	/** The number of colors that have been issued. */
-	private int fCount= 0;
+	private int fCount;
 
 	private CommitterColors() {
 	}
 
 	private float computeHue(int ordinal) {
 		int base= 3;
-		int l= ordinal < base ? 0 : (int) Math.floor(Math.log(ordinal / (double)base) / Math.log(2));
+		int l = ordinal < base
+		        ? 0
+		        : (int) Math.floor(Math.log(ordinal / (double) base) / Math.log(2));
 		int m= ((int) Math.pow(2, l)) * base;
 		int j= ordinal < base ? ordinal : ordinal - m;
 		float offset= ordinal < base ? 0.0f : (float) (180.0f / base / Math.pow(2, l));

src/com/vectrace/MercurialEclipse/annotations/HgPristineCopyQuickDiffProvider.java

 		documentProvider = editor.getDocumentProvider();
 
 		if (documentProvider != null) {
-			(documentProvider).addElementStateListener(documentListener);
+			documentProvider.addElementStateListener(documentListener);
 		}
 		isReferenceInitialized = true;
 	}
 			InputStream contentStream, String encoding) throws CoreException {
 		Reader in = null;
 		try {
-			final int DEFAULT_FILE_SIZE = 15 * 1024;
+			final int defaultFileSize = 15 * 1024;
 
 			in = new BufferedReader(new InputStreamReader(contentStream,
-					encoding), DEFAULT_FILE_SIZE);
-			CharArrayWriter caw = new CharArrayWriter(DEFAULT_FILE_SIZE);
+					encoding), defaultFileSize);
+			CharArrayWriter caw = new CharArrayWriter(defaultFileSize);
 			char[] readBuffer = new char[2048];
 			int n = in.read(readBuffer);
 			while (n > 0) {

src/com/vectrace/MercurialEclipse/annotations/Messages.java

  * @author bastian
  *
  */
-public class Messages {
+public final class Messages {
 	private static final String BUNDLE_NAME = "com.vectrace.MercurialEclipse.annotations.messages"; //$NON-NLS-1$
 
 	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle

src/com/vectrace/MercurialEclipse/annotations/SourceViewerInformationControl.java

 
 
 			@Override
-			protected Map<String,? extends Object> getHyperlinkDetectorTargets(ISourceViewer sourceViewer) {
+			protected Map<String, ? extends Object> getHyperlinkDetectorTargets(ISourceViewer sourceViewer) {
 				return Collections.singletonMap("org.eclipse.ui.DefaultTextEditor",  //$NON-NLS-1$
 					null);
 		//            new IAdaptable() {
 
 	public void setInput(Object input) {
 		if (input instanceof String) {
-			setInformation((String)input);
+			setInformation((String) input);
 		} else {
 			setInformation(null);
 		}
 	public void setSize(int width, int height) {
 
 		if (fStatusField != null) {
-			GridData gd= (GridData)fViewer.getTextWidget().getLayoutData();
+			GridData gd= (GridData) fViewer.getTextWidget().getLayoutData();
 			Point statusSize= fStatusField.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
 			Point separatorSize= fSeparator.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
 			gd.heightHint= height - statusSize.y - separatorSize.y;

src/com/vectrace/MercurialEclipse/commands/AbstractClient.java

  */
 public abstract class AbstractClient {
 
-	private final static String HTTP_PATTERN_STRING = "[hH][tT][tT][pP]:.*[@]"; //$NON-NLS-1$
-	private final static String HTTPS_PATTERN_STRING = "[hH][tT][tT][pP][sS]:.*[@]"; //$NON-NLS-1$
-	private final static String SSH_PATTERN_STRING = "[sS][sS][hH]:.*[@]"; //$NON-NLS-1$
-	private final static String SVN_PATTERN_STRING = "[sS][vV][nN]:.*[@]"; //$NON-NLS-1$
+	private static final String HTTP_PATTERN_STRING = "[hH][tT][tT][pP]:.*[@]"; //$NON-NLS-1$
+	private static final String HTTPS_PATTERN_STRING = "[hH][tT][tT][pP][sS]:.*[@]"; //$NON-NLS-1$
+	private static final String SSH_PATTERN_STRING = "[sS][sS][hH]:.*[@]"; //$NON-NLS-1$
+	private static final String SVN_PATTERN_STRING = "[sS][vV][nN]:.*[@]"; //$NON-NLS-1$
 
-	private final static Pattern HTTP_PATTERN = Pattern.compile(HTTP_PATTERN_STRING);
-	private final static Pattern HTTPS_PATTERN = Pattern.compile(HTTPS_PATTERN_STRING);
-	private final static Pattern SSH_PATTERN = Pattern.compile(SSH_PATTERN_STRING);
-	private final static Pattern SVN_PATTERN = Pattern.compile(SVN_PATTERN_STRING);
+	private static final Pattern HTTP_PATTERN = Pattern.compile(HTTP_PATTERN_STRING);
+	private static final Pattern HTTPS_PATTERN = Pattern.compile(HTTPS_PATTERN_STRING);
+	private static final Pattern SSH_PATTERN = Pattern.compile(SSH_PATTERN_STRING);
+	private static final Pattern SVN_PATTERN = Pattern.compile(SVN_PATTERN_STRING);
 
-	public AbstractClient() {
+	protected AbstractClient() {
 		super();
 	}
 
 		// see bug http://bitbucket.org/mercurialeclipse/main/issue/224/
 		// If hg command uses non-null directory, which is NOT under the hg control,
 		// MercurialTeamProvider.getAndStoreHgRoot() throws an exception
-		AbstractShellCommand command = new HgCommand("help", (File)null, false);
+		AbstractShellCommand command = new HgCommand("help", (File) null, false);
 		if (extensionEnabler != null && extensionEnabler.length() != 0) {
 			command.addOptions("--config", "extensions." + extensionEnabler); //$NON-NLS-1$ //$NON-NLS-2$
 		}

src/com/vectrace/MercurialEclipse/commands/AbstractParseChangesetClient.java

 			style = DEFAULT;
 			break;
 		}
-		String style_tmpl = style + TEMP_EXTN;
+		String styleTemplate = style + TEMP_EXTN;
 
 		IPath sl = MercurialEclipsePlugin.getDefault().getStateLocation();
 
 		File stylefile = sl.append(style).toFile();
-		File tmplfile = sl.append(style_tmpl).toFile();
+		File tmplfile = sl.append(styleTemplate).toFile();
 
 		if (stylefile.canRead() && tmplfile.canRead()) {
 			// Already have copies, return the file reference to the style file
 		// set delete on exit so a new copy is made each time eclipse is started
 		// so we don't use stale copies on plugin updates.
 		InputStream styleistr = cl.getResourceAsStream(STYLES + style);
-		InputStream tmplistr = cl.getResourceAsStream(STYLES + style_tmpl);
+		InputStream tmplistr = cl.getResourceAsStream(STYLES + styleTemplate);
 		OutputStream styleostr = null;
 		OutputStream tmplostr = null;
 		try {
 			tmplostr = new FileOutputStream(tmplfile);
 			tmplfile.deleteOnExit();
 
-			byte buffer[] = new byte[1024];
+			byte[] buffer = new byte[1024];
 			int n;
 			while ((n = styleistr.read(buffer)) != -1) {
 				styleostr.write(buffer, 0, n);

src/com/vectrace/MercurialEclipse/commands/AbstractShellCommand.java

 		env.put("LANGUAGE", "C"); //$NON-NLS-1$ //$NON-NLS-2$
 
 		// HGPLAIN normalizes output in Mercurial 1.5+
-		env.put("HGPLAIN","set by MercurialEclipse"); //$NON-NLS-1$ //$NON-NLS-2$
+		env.put("HGPLAIN", "set by MercurialEclipse"); //$NON-NLS-1$ //$NON-NLS-2$
 		Charset charset = setupEncoding(cmd);
 		if (charset != null) {
 			env.put("HGENCODING", charset.name()); //$NON-NLS-1$

src/com/vectrace/MercurialEclipse/commands/ChangesetContentHandler.java

 
 	public void endElement(String uri, String localName, String name) throws SAXException {
 
-		if (name.equals("de")) {
+		if ("de".equals(name)) {
 			description = descriptionChars.toString();
-		} else if (name.equals("cs")) {
+		} else if ("cs".equals(name)) {
 			// only collect changesets from requested branch. Null is: collect everything.
 			if(expectedBranch == null || Branch.same(branchStr, expectedBranch)){
 				ChangeSet.Builder csb = new ChangeSet.Builder(rev, nodeLong, branchStr, dateIso, unescape(author), hgRoot);
 		 * <de>{desc|escape|tabindent}</de>
 		 */
 		readDescription = false;
-		if (name.equals("br")) {
+		if ("br".equals(name)) {
 			branchStr = atts.getValue(0);
-		} else if (name.equals("tg")) {
+		} else if ("tg".equals(name)) {
 			tags = atts.getValue(0);
-		} else if (name.equals("rv")) {
+		} else if ("rv".equals(name)) {
 			rev = Integer.parseInt(atts.getValue(0));
-		} else if (name.equals("ns")) {
+		} else if ("ns".equals(name)) {
 			nodeShort = atts.getValue(0);
-		} else if (name.equals("nl")) {
+		} else if ("nl".equals(name)) {
 			nodeLong = atts.getValue(0);
-		} else if (name.equals("di")) {
+		} else if ("di".equals(name)) {
 			dateIso = atts.getValue(0);
-		} else if (name.equals("da")) {
+		} else if ("da".equals(name)) {
 			dateAge = atts.getValue(0);
-		} else if (name.equals("au")) {
+		} else if ("au".equals(name)) {
 			author = atts.getValue(0);
-		} else if (name.equals("pr")) {
+		} else if ("pr".equals(name)) {
 			parents = atts.getValue(0);
-		} else if (name.equals("de")) {
+		} else if ("de".equals(name)) {
 			description = null;
 			descriptionChars = new StringBuilder(42);
 			readDescription = true;
-		} else if (name.equals("fl")) {
+		} else if ("fl".equals(name)) {
 			action = FileStatus.Action.MODIFIED;
-		} else if (name.equals("fa")) {
+		} else if ("fa".equals(name)) {
 			action = FileStatus.Action.ADDED;
-		} else if (name.equals("fd")) {
+		} else if ("fd".equals(name)) {
 			action = FileStatus.Action.REMOVED;
-		} else if (name.equals("f")) {
+		} else if ("f".equals(name)) {
 			if (action == Action.MODIFIED) {
 				filesModified.add(atts.getValue(0));
 			} else if (action == Action.ADDED) {
 		}
 	}
 
-	private final void addChangesetToResourceMap(final ChangeSet cs) {
+	private void addChangesetToResourceMap(final ChangeSet cs) {
 		if(withFiles) {
 			if (cs.getChangedFiles() != null) {
 				for (FileStatus file : cs.getChangedFiles()) {

src/com/vectrace/MercurialEclipse/commands/HgBackoutClient.java

 			command.addOptions("--config", "ui.merge=simplemerge"); //$NON-NLS-1$ //$NON-NLS-2$
 		}
 
-		command.addOptions("-r", backoutRevision.getChangeset(), "-m", msg);//$NON-NLS-1$ //$NON-NLS-2$
+		command.addOptions("-r", backoutRevision.getChangeset(), "-m", msg); //$NON-NLS-1$ //$NON-NLS-2$
 		command.addUserName(user);
 		if (merge) {
 			command.addOptions("--merge"); //$NON-NLS-1$

src/com/vectrace/MercurialEclipse/commands/HgBisectClient.java

 			}
 
 		} catch (IOException e) {
-			throw new HgException(e.getLocalizedMessage(),e);
+			throw new HgException(e.getLocalizedMessage(), e);
 		} finally {
 			try {
 				if (reader != null) {

src/com/vectrace/MercurialEclipse/commands/HgBranchClient.java

 	private static final Pattern GET_BRANCHES_PATTERN = Pattern
 			.compile("^(.+[^ ]) +([0-9]+):([a-f0-9]+)( +(.+))?$"); //$NON-NLS-1$
 
-	private static Map<RemoteKey, Boolean> KNOWN_BRANCHES = new ConcurrentHashMap<RemoteKey, Boolean>();
+	private static final Map<RemoteKey, Boolean> KNOWN_BRANCHES = new ConcurrentHashMap<RemoteKey, Boolean>();
 
 	/**
 	 * Returns all available (not closed) branches

src/com/vectrace/MercurialEclipse/commands/HgClients.java

 	private static IConfiguration config;
 	private static IErrorHandler error;
 
+	private HgClients() {
+		// hide constructor of utility class.
+	}
 	public static void initialize(IConsole c, IErrorHandler errorHandler,
 			IConfiguration configuration) {
 		HgClients.config = configuration;

src/com/vectrace/MercurialEclipse/commands/HgDebugInstallClient.java

 	/**
 	 * Key is the charset name, value is "true" if hg supports this charset encoding
 	 */
-	public final static Map<String, Boolean> ENCODINGS = Collections
+	public static final Map<String, Boolean> ENCODINGS = Collections
 			.synchronizedMap(new HashMap<String, Boolean>());
 
 	public static String debugInstall() throws HgException {

src/com/vectrace/MercurialEclipse/commands/HgIdentClient.java

 	private static int getNextInt(byte[] b, int idx) {
 		int result = 0;
 		for(int i = 0; i < 4 && i + idx < b.length; i++) {
-			result = ((result << 8) + (b[i + idx] & 0xff));
+			result = (result << 8) + (b[i + idx] & 0xff);
 		}
 		return result;
 	}
 			int size = s.length();
 			while(size < 8) {
 				id.append('0');
-				size ++;
+				size++;
 			}
 			id.append(s);
 		}

src/com/vectrace/MercurialEclipse/commands/HgIgnoreClient.java

 		try {
 			File hgignore = new File(hgRoot, ".hgignore");
 			// append to file if it exists, else create a new one
-			buffer = new BufferedOutputStream(new FileOutputStream(hgignore,true));
+			buffer = new BufferedOutputStream(new FileOutputStream(hgignore, true));
 			// write contents
-			buffer.write(new byte[]{'\n','s','y','n','t','a','x',':',' '});
+			buffer.write(new byte[] { '\n', 's', 'y', 'n', 't', 'a', 'x', ':', ' ' });
 			buffer.write(syntax.getBytes());
 			buffer.write('\n');
 			buffer.write(pattern.getBytes());
 				try {
 					buffer.close();
 				} catch (IOException e) {
-				throw new HgException(Messages.getString("HgIgnoreClient.failedToCloseHgIgnore"),e); //$NON-NLS-1$
+					throw new HgException(Messages
+							.getString("HgIgnoreClient.failedToCloseHgIgnore"), e); //$NON-NLS-1$
 				}
 			}
 		}

src/com/vectrace/MercurialEclipse/commands/HgPathsClient.java

 
 	public static Map<String, String> getPaths(HgRoot hgRoot) throws HgException {
 		File hgrc = hgRoot.getConfig();
-		Map<String,String> paths = new HashMap<String, String>();
+		Map<String, String> paths = new HashMap<String, String>();
 		if (hgrc == null) {
 			return paths;
 		}
 		try {
 			IniFile ini = new IniFile(hgrc.getAbsolutePath());
-			Map<String,String> section = ini.getSection(PATHS_SECTION);
+			Map<String, String> section = ini.getSection(PATHS_SECTION);
 			if (section != null) {
 				paths.putAll(section);
 			}

src/com/vectrace/MercurialEclipse/commands/HgResolveClient.java

 			command.addOptions("-m", file.getCanonicalPath()); //$NON-NLS-1$
 			String result = command.executeToString();
 			// cleanup .orig files left after merge
-			File orig_file = new File(file.getAbsolutePath() + ".orig");
-			if(orig_file.isFile()){
-				IResource file_to_delete = ResourceUtils.convert(orig_file);
-				boolean deleted = orig_file.delete();
+			File origFile = new File(file.getAbsolutePath() + ".orig");
+			if(origFile.isFile()){
+				IResource fileToDelete = ResourceUtils.convert(origFile);
+				boolean deleted = origFile.delete();
 				if(!deleted){
-					MercurialEclipsePlugin.logInfo("Failed to cleanup " + orig_file + " file after merge", null);
+					MercurialEclipsePlugin.logInfo("Failed to cleanup " + origFile + " file after merge", null);
 				} else {
 					try {
-						file_to_delete.refreshLocal(IResource.DEPTH_ZERO, null);
+						fileToDelete.refreshLocal(IResource.DEPTH_ZERO, null);
 					} catch (CoreException e) {
 						MercurialEclipsePlugin.logError(e);
 					}

src/com/vectrace/MercurialEclipse/commands/HgRootClient.java

  */
 public class HgRootClient extends AbstractClient {
 
-	private final static Map<File, HgRoot> roots = new HashMap<File, HgRoot>();
+	private static final Map<File, HgRoot> ROOTS = new HashMap<File, HgRoot>();
 
 	/**
 	 * @param file
 
 		File dir = ResourceUtils.getFirstExistingDirectory(file);
 		// test if we have the path "as is" already
-		HgRoot hgRoot = roots.get(dir);
+		HgRoot hgRoot = ROOTS.get(dir);
 		if(hgRoot != null){
 			return hgRoot;
 		}
 			throw new HgException(Messages.getString("HgRootClient.error.cannotGetCanonicalPath")+file.getName()); //$NON-NLS-1$
 		}
 		// test with canonical version of the same file
-		hgRoot = roots.get(testRoot);
+		hgRoot = ROOTS.get(testRoot);
 		if(hgRoot != null){
 			// remember NON canonical version too
-			roots.put(dir, hgRoot);
+			ROOTS.put(dir, hgRoot);
 			return hgRoot;
 		}
 		// search up the parents recursive if we see .hg directory there
 		} catch (IOException e) {
 			throw new HgException(Messages.getString("HgRootClient.error.cannotGetCanonicalPath")+file.getName()); //$NON-NLS-1$
 		}
-		roots.put(root, hgRoot);
+		ROOTS.put(root, hgRoot);
 		return hgRoot;
 	}
 
 	public static HgRoot hasHgRoot(File file) {
 		File dir = ResourceUtils.getFirstExistingDirectory(file);
 		// test if we have the path "as is" already
-		HgRoot hgRoot = roots.get(dir);
+		HgRoot hgRoot = ROOTS.get(dir);
 		if(hgRoot != null){
 			return hgRoot;
 		}
 			return null;
 		}
 		// test with canonical version of the same file
-		hgRoot = roots.get(testRoot);
+		hgRoot = ROOTS.get(testRoot);
 		if(hgRoot != null){
 			// remember NON canonical version too
-			roots.put(dir, hgRoot);
+			ROOTS.put(dir, hgRoot);
 			return hgRoot;
 		}
 		// search up the parents recursive if we see .hg directory there
 		} catch (IOException e) {
 			return null;
 		}
-		roots.put(root, hgRoot);
+		ROOTS.put(root, hgRoot);
 		return hgRoot;
 	}
 

src/com/vectrace/MercurialEclipse/commands/HgStatusClient.java

 	public static boolean isDirty(List<? extends IResource> resources) throws HgException {
 		AbstractShellCommand command = new HgCommand("status", true); //$NON-NLS-1$
 		command.setUsePreferenceTimeout(MercurialPreferenceConstants.STATUS_TIMEOUT);
-		command.addOptions("-mard");// modified, added, removed, deleted //$NON-NLS-1$
+		command.addOptions("-mard"); // modified, added, removed, deleted //$NON-NLS-1$
 		command.addFiles(resources);
 		return command.executeToBytes().length != 0;
 	}
 	public static boolean isDirty(HgRoot root) throws HgException {
 		AbstractShellCommand command = new HgCommand("status", root, true); //$NON-NLS-1$
 		command.setUsePreferenceTimeout(MercurialPreferenceConstants.STATUS_TIMEOUT);
-		command.addOptions("-mard");// modified, added, removed, deleted //$NON-NLS-1$
+		command.addOptions("-mard"); // modified, added, removed, deleted //$NON-NLS-1$
 		return command.executeToBytes().length != 0;
 	}
 
 	public static String[] getIdMergeAndBranch(HgRoot root) throws HgException {
 		AbstractShellCommand command = new HgCommand("id", root, true); //$NON-NLS-1$
 		// Full global IDs + branch name
-		command.addOptions("-ib","--debug"); //$NON-NLS-1$ //$NON-NLS-2$
+		command.addOptions("-ib", "--debug"); //$NON-NLS-1$ //$NON-NLS-2$
 		command.setUsePreferenceTimeout(MercurialPreferenceConstants.STATUS_TIMEOUT);
 		String versionIds = command.executeToString().trim();
 
 	 * @throws HgException
 	 */
 	public static File getPossibleSourcePath(HgRoot root, File file, int firstKnownRevision) throws HgException{
-		return getPossibleSourcePath(root, file, (firstKnownRevision - 1), "" + firstKnownRevision);
+		return getPossibleSourcePath(root, file, firstKnownRevision - 1, "" + firstKnownRevision);
 	}
 
 	/**

src/com/vectrace/MercurialEclipse/commands/Messages.java

  * @author bastian
  *
  */
-public class Messages {
+public final class Messages {
 	private static final String BUNDLE_NAME = "com.vectrace.MercurialEclipse.commands.messages"; //$NON-NLS-1$
 
 	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle

src/com/vectrace/MercurialEclipse/commands/extensions/HgAtticClient.java

 		HgCommand cmd = new HgCommand("attic-shelve", hgRoot, false);
 
 		if (commitMessage != null && commitMessage.length() > 0) {
-			cmd.addOptions("-m", commitMessage);// $NON-NLS-1$
+			cmd.addOptions("-m", commitMessage); // $NON-NLS-1$
 		}
 
 		if (git) {
-			cmd.addOptions("--git");// $NON-NLS-1$
+			cmd.addOptions("--git"); // $NON-NLS-1$
 		}
 
 		cmd.addUserName(user);
 
-		cmd.addOptions("--currentdate", name);// $NON-NLS-1$
+		cmd.addOptions("--currentdate", name); // $NON-NLS-1$
 		String result = cmd.executeToString();
 		cmd.rememberUserName();
 		return result;
 		AbstractShellCommand cmd = new HgCommand("attic-unshelve", hgRoot, false);
 
 		if (guessRenamedFiles) {
-			cmd.addOptions("--similarity");// $NON-NLS-1$
+			cmd.addOptions("--similarity"); // $NON-NLS-1$
 		}
 
 		if (delete) {

src/com/vectrace/MercurialEclipse/commands/extensions/HgSignClient.java

  * @author Bastian Doetsch
  *
  */
-public class HgSignClient {
+public final class HgSignClient {
 
-
+	private HgSignClient() {
+		// hide constructor of utility class.
+	}
 
 	/**
 	 * Calls hg sign. add a signature for the current or given revision If no
 			boolean noCommit, String passphrase) throws HgException {
 		HgCommand command = new HgCommand("sign", hgRoot, true); //$NON-NLS-1$
 		File file = new File("me.gpg.tmp"); //$NON-NLS-1$
-		String cmd = "gpg.cmd=".concat( //$NON-NLS-1$
-				MercurialUtilities.getGpgExecutable(true)).concat(
-				" --batch --no-tty --armor"); //$NON-NLS-1$
+		String cmd = "gpg.cmd=" + //$NON-NLS-1$
+				MercurialUtilities.getGpgExecutable(true) + " --batch --no-tty --armor"; //$NON-NLS-1$
 		if (passphrase != null && passphrase.length() > 0) {
 			FileWriter fw = null;
 			try {
 				fw = new FileWriter(file);
 				fw.write(passphrase.concat("\n")); //$NON-NLS-1$
 				fw.flush();
-				cmd = cmd.concat(" --passphrase-file ").concat( //$NON-NLS-1$
-						file.getCanonicalPath());
+				cmd = cmd + " --passphrase-file " + //$NON-NLS-1$
+						file.getCanonicalPath();
 			} catch (IOException e) {
 				throw new HgException(e.getMessage());
 			} finally {
 				}
 			}
 		}
-		command.addOptions("-k", key, "--config","extensions.gpg=","--config", cmd); //$NON-NLS-1$ //$NON-NLS-2$
+		command.addOptions("-k", key, "--config", "extensions.gpg=", "--config", cmd); //$NON-NLS-1$ //$NON-NLS-2$
 		if (local) {
 			command.addOptions("-l"); //$NON-NLS-1$
 		}
 			command.rememberUserName();
 			return result;
 		} finally {
-			if (file.delete() == false) {
+			if (!file.delete()) {
 				throw new HgException(file.getName()+" could not be deleted.");
 			}
 		}

src/com/vectrace/MercurialEclipse/commands/extensions/HgSigsClient.java

 					reader = new LineNumberReader(new FileReader(sigFile));
 					String line = reader.readLine();
 					while (line != null) {
-						String nodeId = line.substring(0,line.indexOf(" 0 ")); //$NON-NLS-1$
+						String nodeId = line.substring(0, line.indexOf(" 0 ")); //$NON-NLS-1$
 						Signature sig = new Signature(null, nodeId, hgRoot);
 						nodes.add(sig);
 						line = reader.readLine();
 		try {
 			AbstractShellCommand c = new HgCommand("sigcheck", hgRoot, //$NON-NLS-1$
 					false);
-			c.addOptions("--config","extensions.gpg=");
+			c.addOptions("--config", "extensions.gpg=");
 			c.setUsePreferenceTimeout(MercurialPreferenceConstants.DEFAULT_TIMEOUT);
 			c.addOptions(nodeId);
 			return c.executeToString();

src/com/vectrace/MercurialEclipse/commands/extensions/HgStripClient.java

  *
  * @author bastian
  */
-public class HgStripClient {
+public final class HgStripClient {
+
+	private HgStripClient() {
+		// hide constructor of utility class.
+	}
 
 	/**
 	 * strip a revision and all later revs on the same branch

src/com/vectrace/MercurialEclipse/commands/extensions/HgTransplantClient.java

 import com.vectrace.MercurialEclipse.model.IHgRepositoryLocation;
 import com.vectrace.MercurialEclipse.preferences.MercurialPreferenceConstants;
 
-public class HgTransplantClient {
+public final class HgTransplantClient {
 
 	public static class TransplantOptions {
 		public boolean all;
 		public SortedSet<ChangeSet> nodes;
 	}
 
+	private HgTransplantClient() {
+		// hide constructor of utility class.
+	}
+
 	/**
 	 * Cherrypicks given ChangeSets from repository or branch.
 	 */
 			} else {
 				command.addOptions("--source"); //$NON-NLS-1$
 				URI uri = repo.getUri();
-				if (uri != null ) {
+				if (uri != null) {
 					command.addOptions(uri.toASCIIString());
 				} else {
 					command.addOptions(repo.getLocation());

src/com/vectrace/MercurialEclipse/commands/extensions/mq/HgQAppliedClient.java

 public class HgQAppliedClient extends AbstractClient {
 	public static List<Patch> getAppliedPatches(IResource resource) throws HgException {
 		Assert.isNotNull(resource);
-		AbstractShellCommand command = new HgCommand("qapplied",getWorkingDirectory(resource),true);       //$NON-NLS-1$
+		AbstractShellCommand command = new HgCommand(
+				"qapplied", getWorkingDirectory(resource), true); //$NON-NLS-1$
 		command.addOptions("--config", "extensions.hgext.mq="); //$NON-NLS-1$ //$NON-NLS-2$
 		command.addOptions("-v"); //$NON-NLS-1$
 		command.addOptions("-s"); //$NON-NLS-1$
 
 	public static List<Patch> getUnappliedPatches(IResource resource) throws HgException{
 		Assert.isNotNull(resource);
-		AbstractShellCommand command = new HgCommand("qunapplied",getWorkingDirectory(resource),true);       //$NON-NLS-1$
+		AbstractShellCommand command = new HgCommand(
+				"qunapplied", getWorkingDirectory(resource), true); //$NON-NLS-1$
 		command.addOptions("--config", "extensions.hgext.mq="); //$NON-NLS-1$ //$NON-NLS-2$
 		command.addOptions("-v"); //$NON-NLS-1$
 		command.addOptions("-s"); //$NON-NLS-1$

src/com/vectrace/MercurialEclipse/commands/extensions/mq/HgQImportClient.java

 		}
 
 		if (changesets != null && changesets.length>0) {
-			command.addOptions("--rev", changesets[changesets.length-1].getChangeset()+ ":" +changesets[0].getChangeset() );                        //$NON-NLS-1$ //$NON-NLS-2$
+			command.addOptions("--rev", changesets[changesets.length-1].getChangeset()+ ":" +changesets[0].getChangeset()); //$NON-NLS-1$ //$NON-NLS-2$
 		} else {
 			Assert.isNotNull(patchFile);
 			if (existing) {

src/com/vectrace/MercurialEclipse/commands/extensions/mq/HgQInitClient.java

  */
 public class HgQInitClient extends AbstractClient {
 	public static String init(IResource resource, boolean repository) throws HgException {
-		AbstractShellCommand command = new HgCommand("qinit",getWorkingDirectory(resource),true); //$NON-NLS-1$
+		AbstractShellCommand command = new HgCommand("qinit", getWorkingDirectory(resource), true); //$NON-NLS-1$
 		command.addOptions("--config", "extensions.hgext.mq="); //$NON-NLS-1$ //$NON-NLS-2$
 
 		if (repository) {

src/com/vectrace/MercurialEclipse/commands/extensions/mq/HgQSeriesClient.java

 
 				Patch p = new Patch();
 				p.setIndex(patchData[0]);
-				p.setApplied(patchData[1].equals("A") ? true : false); //$NON-NLS-1$
+				p.setApplied("A".equals(patchData[1])); //$NON-NLS-1$
 				p.setName(patchData[2].trim());
 
 				if (components.length>1) {

src/com/vectrace/MercurialEclipse/compare/HgCompareEditorInput.java

 
 	@Override
 	protected Object prepareInput(IProgressMonitor monitor)
-	throws InvocationTargetException, InterruptedException
-	{
+	throws InvocationTargetException, InterruptedException {
 		return DIFFERENCER.findDifferences(ancestor != null, monitor, null, ancestor, left, right);
 	}
 
 	}
 
 	@Override
-	public void saveChanges(IProgressMonitor monitor) throws CoreException
-	{
+	public void saveChanges(IProgressMonitor monitor) throws CoreException {
 		boolean save = isSaveNeeded();
 		super.saveChanges(monitor);
 		if(save) {
-			((IFile)left.getResource()).setContents(left.getContents(), true, true, monitor);
+			((IFile) left.getResource()).setContents(left.getContents(), true, true, monitor);
 		}
 	}
 

src/com/vectrace/MercurialEclipse/compare/TagComparator.java

  * @version $Id$
  */
 public class TagComparator implements Comparator<Tag> {
-	private final static String TIP = HgRevision.TIP.getChangeset();
+	private static final String TIP = HgRevision.TIP.getChangeset();
 
 	public int compare(Tag tag1, Tag tag2) {
 		/* "tip" must be always the first in the collection */

src/com/vectrace/MercurialEclipse/dialogs/CommitDialog.java

 	}
 
 	private void createOldCommitCombo(Composite container) {
-		final String oldCommits[] = MercurialEclipsePlugin.getCommitMessageManager()
+		final String[] oldCommits = MercurialEclipsePlugin.getCommitMessageManager()
 				.getCommitMessages();
 		if (oldCommits.length > 0) {
 			oldCommitComboBox = SWTWidgetHelper.createCombo(container);
 
 		// set old commit message
 		IDocument msg = commitTextBox.getDocument();
-		if (msg.get().equals("") || msg.get().equals(DEFAULT_COMMIT_MESSAGE)) {
+		if ("".equals(msg.get()) || msg.get().equals(DEFAULT_COMMIT_MESSAGE)) {
 			msg.set(currentChangeset.getComment());
 		}
 

src/com/vectrace/MercurialEclipse/dialogs/Messages.java

  * @author bastian
  *
  */
-public class Messages {
+public final class Messages {
 	private static final String BUNDLE_NAME = "com.vectrace.MercurialEclipse.dialogs.messages"; //$NON-NLS-1$
 
 	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle

src/com/vectrace/MercurialEclipse/dialogs/RevisionChooserPanel.java

 			protected IStatus runSafe(IProgressMonitor monitor) {
 				try {
 					Branch[] branches = dataLoader.getBranches();
-					if(data.highlightDefaultBranch &&  branches.length == 0 &&
-							Branch.DEFAULT.equals(text.getText())){
+					if (data.highlightDefaultBranch && branches.length == 0
+							&& Branch.DEFAULT.equals(text.getText())) {
 						text.setText("");
 					}
 					table.setBranches(branches);
 	/**
 	 * Proposal provider for the revision text field.
 	 */
-	private static class RevisionContentProposalProvider implements IContentProposalProvider {
+	private static final class RevisionContentProposalProvider implements IContentProposalProvider {
 
 		private final Future<SortedSet<ChangeSet>> changeSets;
 		private final Future<List<Bookmark>> bookmarks;
 
 		private static enum ContentType {REVISION, TAG, BRANCH}
 
-		private static class ChangeSetContentProposal implements IContentProposal {
+		private static final class ChangeSetContentProposal implements IContentProposal {