Commit a0629d84 authored by ekrisza's avatar ekrisza
Browse files

code quality improvements

parent e65bef4d
......@@ -16,9 +16,9 @@ import java.util.regex.Pattern;
import org.eclipse.core.runtime.Platform;
import org.eclipse.titan.common.logging.ErrorReporter;
public class Cygwin {
public final class Cygwin {
// singleton for speed
static Boolean installed = null;
private static Boolean installed = null;
private Cygwin() {
// Disable constructor
......@@ -44,9 +44,9 @@ public class Cygwin {
}
// check if error occured:
final Pattern regQueryOutputPattern = Pattern.compile("ERROR.*");
final Matcher regQueryoutputMatcher = regQueryOutputPattern.matcher(regQueryOutput);
if (regQueryoutputMatcher.matches()) {
final Pattern errorPattern = Pattern.compile("ERROR.*");
final Matcher errorMatcher = errorPattern.matcher(regQueryOutput);
if (errorMatcher.matches()) {
return installed.booleanValue();
}
installed = Boolean.TRUE;
......@@ -60,16 +60,13 @@ public class Cygwin {
* @return true if the OS is Win32 and there is no installed cygwin, otherwise returns false
*/
public static boolean isMissingInOSWin32() {
if (Platform.OS_WIN32.equals(Platform.getOS()) && !Cygwin.isInstalled() ) {
return true;
}
return false;
return Platform.OS_WIN32.equals(Platform.getOS()) && !Cygwin.isInstalled();
}
/**
* @return Returns the standard output if no exceptions and return code was 0, otherwise returns null
*/
static String executeProgram(final String command) {
private static String executeProgram(final String command) {
Process proc;
try {
......@@ -81,15 +78,15 @@ public class Cygwin {
final BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream(), Charset.defaultCharset()));
try {
final StringBuilder sb = new StringBuilder();
final StringBuilder stringBuilder = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line);
stringBuilder.append(line);
}
if (proc.waitFor() != 0) {
return null;
}
return sb.toString();
return stringBuilder.toString();
} catch (Exception e) {
ErrorReporter.logExceptionStackTrace("Error while executing " + command, e);
} finally {
......
......@@ -12,7 +12,7 @@ import java.io.IOException;
import org.eclipse.titan.common.logging.ErrorReporter;
public class FileUtils {
public final class FileUtils {
private FileUtils() {
// Hide constructor
......
......@@ -15,7 +15,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.titan.common.logging.ErrorReporter;
public class ResourceUtils {
public final class ResourceUtils {
private ResourceUtils() {
// Hide constructor
......
......@@ -14,7 +14,7 @@ import java.nio.charset.Charset;
* see {@link java.nio.charset.StandardCharsets}
* This class should be deleted, when the project will use Java 1.7.
*/
public class StandardCharsets {
public final class StandardCharsets {
public static final String UTF8_KEY = "UTF-8";
public static final Charset UTF8 = Charset.forName(UTF8_KEY);
......
......@@ -36,7 +36,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.IPreferencesService;
......@@ -207,14 +206,14 @@ public final class Activator extends AbstractUIPlugin {
for (final IResourceDelta delta : eventDelta.getAffectedChildren()) {
final IResource changedResource = delta.getResource();
final ContentChangedFileFinder changeFinder = new ContentChangedFileFinder();
if (changedResource.getType() == IResource.PROJECT && TITANNature.hasTITANNature((IProject) changedResource)) {
try {
if (!Boolean.TRUE.equals(changedResource.getSessionProperty(GeneralConstants.PROJECT_UP_TO_DATE))) {
return;
}
final ContentChangedFileFinder changeFinder = new ContentChangedFileFinder();
delta.accept(changeFinder);
if (changeFinder.getChangeFound()) {
changedResource.setSessionProperty(GeneralConstants.PROJECT_UP_TO_DATE, false);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment