Permalink
Browse files

Merge pull request #42 from GordonSmith/SourceTidy

Source Tidy

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
  • Loading branch information...
richardkchapman committed Apr 25, 2012
2 parents 6cf06c1 + a1bfac5 commit e964639a195cdaefd8b44580968a30650c207508
Showing 452 changed files with 106,764 additions and 104,496 deletions.
@@ -25,7 +25,7 @@
// The shared instance
private static Activator plugin;
-
+
/**
* The constructor
*/
@@ -71,11 +71,11 @@ public static Activator getDefault() {
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
-
- public static Image getImage(String imagePath) {
- ImageDescriptor imageDescriptor = getImageDescriptor(imagePath);
- Image image = imageDescriptor.createImage();
- return image;
- }
-
+
+ public static Image getImage(String imagePath) {
+ ImageDescriptor imageDescriptor = getImageDescriptor(imagePath);
+ Image image = imageDescriptor.createImage();
+ return image;
+ }
+
}
@@ -31,17 +31,17 @@
public class ECLBuilder extends IncrementalProjectBuilder {
class ECLDeltaVisitor implements IResourceDeltaVisitor {
private IProgressMonitor monitor;
-
+
ECLDeltaVisitor(IProgressMonitor monitor) {
this.monitor = monitor;
}
-
+
@Override
public boolean visit(IResourceDelta delta) throws CoreException {
if (monitor.isCanceled()) {
return false;
}
-
+
IResource resource = delta.getResource();
switch (delta.getKind()) {
case IResourceDelta.ADDED:
@@ -102,9 +102,10 @@ public boolean visit(IResource resource) {
void checkItem(IResource resource, IProgressMonitor monitor) {
if (resource instanceof IFile && resource.getName().endsWith(".ecl")) {
IFile file = (IFile) resource;
- if (checkedFiles.contains(file))
+ if (checkedFiles.contains(file)) {
return;
-
+ }
+
checkedFiles.add(file);
monitor.subTask(file.getName());
ClientTools ct = Data.get().GetClientTools(file);
@@ -44,9 +44,9 @@
IProject project;
IProject[] referencedProjects;
-
+
String version = null;
-
+
ConfigurationPreferenceStore launchConfiguration;
IPath binPath;
File eclccFile;
@@ -65,7 +65,7 @@
boolean monitorDependees = false;
boolean supressSubsequentErrors = false;
boolean enableMetaProcessing = true;
-
+
boolean executeRemotely = false;
String serverIP;
String serverCluster;
@@ -81,11 +81,11 @@
boolean hasError; //TODO Has Error notification is all wrong.
String QUOTE = "";
-
+
class BasicHandler implements IProcessOutput {
protected StringBuilder sbOut;
protected StringBuilder sbErr;
-
+
BasicHandler() {
sbOut = new StringBuilder();
sbErr = new StringBuilder();
@@ -145,13 +145,13 @@ public void ProcessErr(BufferedReader errReader) {
public ECLArchiveHandler() {
super();
}
-
+
Set<IFile> getAncestors(IFile file) {
ECLArchiveParser parser = new ECLArchiveParser(file, sbOut.toString());
assert(parser != null);
return parser.ancestors;
}
-
+
@Override
public void ProcessOut(BufferedReader reader) {
super.ProcessOut(reader);
@@ -189,8 +189,9 @@ public void ProcessOut(BufferedReader reader) {
eclccConsoleWriter.print("Out: ");
eclccConsoleWriter.println(stdIn);
int lastSpace = stdIn.lastIndexOf(' ');
- if (lastSpace != -1)
+ if (lastSpace != -1) {
wuid = stdIn.substring(lastSpace + 1, stdIn.length());
+ }
}
} catch (IOException e) {
e.printStackTrace();
@@ -204,7 +205,7 @@ public ECLCompiler(ConfigurationPreferenceStore launchConfiguration) {
binPath = new Path(launchConfiguration.getAttribute(ClientTools.P_TOOLSPATH, ClientTools.P_TOOLSPATH_DEFAULT));
eclccFile = binPath.append("eclcc").toFile();
eclplusFile = binPath.append("eclplus").toFile();
-
+
argsCommon = launchConfiguration.getAttribute(ClientTools.P_ARGSCOMMON, ClientTools.P_ARGSCOMMON_DEFAULT);
argsSyntaxCheck = launchConfiguration.getAttribute(ClientTools.P_ARGSSYNTAX, ClientTools.P_ARGSSYNTAX_DEFAULT);
argsCompile = launchConfiguration.getAttribute(ClientTools.P_ARGSCOMPILE, ClientTools.P_ARGSCOMPILE_DEFAULT);
@@ -229,35 +230,35 @@ public ECLCompiler(ConfigurationPreferenceStore launchConfiguration) {
eclccConsoleWriter = eclccConsole.newMessageStream();
//eclccConsoleWriter.setActivateOnWrite(true);
}
-
+
public ECLCompiler(ConfigurationPreferenceStore launchConfiguration, IProject project) {
this(launchConfiguration);
-
+
this.project = project;
try {
referencedProjects = project.getReferencedProjects();
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
projectPath = project.getLocation();
workingPath = project.getWorkingLocation(Activator.PLUGIN_ID);
rootFolder = project.getWorkspace().getRoot().getFullPath();
}
-
+
boolean HasCompiler() {
return !getVersion().isEmpty();
}
-
+
void GetIncludeArgs(CmdArgs cmdArgs) {
cmdArgs.Append("I", projectPath.toOSString());
for (int i = 0; i < referencedProjects.length; ++i) {
cmdArgs.Append("I", referencedProjects[i].getLocation().toOSString());
}
}
-
+
public String getVersion() {
if (version == null) {
version = new String();
@@ -271,26 +272,28 @@ public String getVersion() {
}
return version;
}
-
+
public String getBuildVersion() {
String version = getVersion();
String[] versions = version.split(" ");
- if (versions.length >= 2)
+ if (versions.length >= 2) {
return versions[1];
+ }
return "";
}
-
+
public String getLanguageVersion() {
String version = getVersion();
String[] versions = version.split(" ");
- if (versions.length >= 1)
+ if (versions.length >= 1) {
return versions[0];
+ }
return "";
}
-
+
public void checkSyntax(IFile file) {
Eclipse.deleteMarkers(file);
-
+
if (!HasCompiler()) {
Eclipse.addMarker(file, IMarker.SEVERITY_ERROR, badConfigurationCode, badConfiguration, 0, 0, true);
eclccConsoleWriter.println(noCompiler);
@@ -300,8 +303,9 @@ public void checkSyntax(IFile file) {
CmdArgs cmdArgs = new CmdArgs(eclccFile.getPath(), argsCommon, argsSyntaxCheck);
GetIncludeArgs(cmdArgs);
- if (monitorDependees)
+ if (monitorDependees) {
cmdArgs.Append("E");
+ }
ECLArchiveHandler handler = new ECLArchiveHandler();
CmdProcess process = new CmdProcess(workingPath, binPath, handler, eclccConsoleWriter);
process.exec(cmdArgs, file, false);
@@ -312,7 +316,7 @@ public void checkSyntax(IFile file) {
public String getArchive(IFile file) {
Eclipse.deleteMarkers(file);
-
+
if (!HasCompiler()) {
Eclipse.addMarker(file, IMarker.SEVERITY_ERROR, badConfigurationCode, badConfiguration, 0, 0, true);
eclccConsoleWriter.println(noCompiler);
@@ -326,8 +330,9 @@ public String getArchive(IFile file) {
IPath manifestPath = file.getLocation().removeLastSegments(1);
manifestPath = manifestPath.append("files");
manifestPath = manifestPath.append("manifest.xml");
- if (manifestPath.toFile().exists())
+ if (manifestPath.toFile().exists()) {
cmdArgs.Append("manifest=", manifestPath.toOSString());
+ }
}
hasError = false;
@@ -338,9 +343,10 @@ public String getArchive(IFile file) {
}
public String getMeta(IFile file) {
- if (!enableMetaProcessing)
+ if (!enableMetaProcessing) {
return "";
-
+ }
+
if (!HasCompiler()) {
eclccConsoleWriter.println(noCompiler);
return "";
@@ -382,10 +388,11 @@ public IFolder getLibraryFolder() {
IFolder retVal = project.getFolder("ECL Library (" + getLanguageVersion() + ")");
if (!retVal.exists()) {
try {
- if (OS.isWindowsPlatform())
+ if (OS.isWindowsPlatform()) {
retVal.createLink(binPath.append("ecllibrary"), IResource.HIDDEN, null);
- else
+ } else {
retVal.createLink(binPath.append("../share/ecllibrary"), IResource.HIDDEN, null);
+ }
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -43,7 +43,7 @@ public void run(IAction action) {
} else if (element instanceof IAdaptable) {
project = (IProject) ((IAdaptable) element).getAdapter(IProject.class);
}
-
+
if (project != null) {
setNature(project);
}
@@ -28,44 +28,47 @@
class FileBucket {
IProject project;
public Set<IFile> files;
-
+
FileBucket(IProject project) {
this.project = project;
- this.files = new HashSet<IFile>();
+ files = new HashSet<IFile>();
}
-
+
void load(String files) {
- if (files == null)
+ if (files == null) {
return;
-
+ }
+
String[] partialPaths = files.split(";");
for(int i = 0; i < partialPaths.length; ++i) {
IResource resource = project.findMember(partialPaths[i]);
if (resource instanceof IFile && resource.getName().endsWith(".ecl")) {
IFile file = (IFile) resource;
- if (file != null)
+ if (file != null) {
this.files.add(file);
+ }
}
}
}
-
+
String save() {
StringBuilder retVal = new StringBuilder();
for(Iterator<IFile> itr = files.iterator(); itr.hasNext();) {
IFile file = itr.next();
- if (retVal.length() > 0)
+ if (retVal.length() > 0) {
retVal.append(";");
+ }
retVal.append(file.getProjectRelativePath().toOSString());
}
return retVal.toString();
}
}
-
+
protected IFile file;
protected FileBucket ancestors;
protected FileBucket descendants;
private boolean closeCalled = false;
-
+
RelationshipHelper(IFile file) {
assert(file.exists());
this.file = file;
@@ -82,7 +85,7 @@ String save() {
e.printStackTrace();
}
}
-
+
@Override
protected void finalize() throws Throwable {
assert(closeCalled == true);
@@ -102,11 +105,11 @@ void close() {
e.printStackTrace();
}
}
-
+
boolean addDescendantNoPropigate(IFile decendant) {
return descendants.files.add(decendant);
}
-
+
boolean removeDescendantNoPropigate(IFile decendant) {
return descendants.files.remove(decendant);
}
@@ -123,7 +126,7 @@ void clearAncestors() {
}
}
}
-
+
void setAncestors(Set<IFile> ancestors2) {
clearAncestors();
Iterator<IFile> itr = ancestors2.iterator();
@@ -23,7 +23,7 @@
HashMap<String, String> attributes;
public ECLBase() {
- this.attributes = new HashMap<String, String>();
+ attributes = new HashMap<String, String>();
}
public ECLBase(Attributes attributes) {
@@ -75,8 +75,9 @@ public int getEndOffset() {
public int getLength() {
int retVal = getEndOffset() - getOffset();
- if (retVal >= 0)
+ if (retVal >= 0) {
return retVal;
+ }
return 0;
}
}
Oops, something went wrong.

0 comments on commit e964639

Please sign in to comment.