Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2018-11-20 11:20:42 -0500
committerJonah Graham2018-11-22 16:47:02 -0500
commit170e654b4796bad1453ae85a427b97317d67a69a (patch)
tree6ca9b8a8fedd5fd25f97eb79c408312e256ff981 /core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes
parent35996a5c5ca5c254959ba48241eaada6dbf8628d (diff)
downloadorg.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.tar.gz
org.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.tar.xz
org.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.zip
Bug 540373: Cleanup: Format & Remove trailing whitespace
This was done by selecting all projects in Eclipse then Source -> Clean Up... -> choosing: - Format source code - Remove trailing white spaces on all lines and completing the wizard Change-Id: I63685372c6bcc67719bcf145123bcb72e5b00394
Diffstat (limited to 'core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes')
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddFile.java31
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddFiles.java52
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddLink.java9
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddNature.java13
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/Append.java16
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AppendCreate.java23
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/Copy.java14
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/CreateFolder.java11
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/CreateResourceIdentifier.java8
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/CreateSourceFolder.java39
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/Messages.java3
-rw-r--r--core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/SetEnvironmentVariable.java15
12 files changed, 132 insertions, 102 deletions
diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddFile.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddFile.java
index b0e0202435..fec924713c 100644
--- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddFile.java
+++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddFile.java
@@ -32,17 +32,17 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-
/**
- * Adds File to the project
+ * Adds File to the project
*/
public class AddFile extends ProcessRunner {
-
+
/**
* This method Adds the File to the corresponding Project.
*/
@Override
- public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
+ public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
String projectName = args[0].getSimpleValue();
ProcessArgument file = args[1];
ProcessArgument[] fileMembers = file.getComplexValue();
@@ -55,40 +55,47 @@ public class AddFile extends ProcessRunner {
try {
path = TemplateEngineHelper.getTemplateResourceURLRelativeToTemplate(template, fileSourcePath);
if (path == null) {
- throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddFile.0") + fileSourcePath)); //$NON-NLS-1$
+ throw new ProcessFailureException(
+ getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddFile.0") + fileSourcePath)); //$NON-NLS-1$
}
} catch (IOException e1) {
- throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddFile.1") + fileSourcePath)); //$NON-NLS-1$
+ throw new ProcessFailureException(
+ getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddFile.1") + fileSourcePath)); //$NON-NLS-1$
}
-
+
InputStream contents = null;
if (replaceable) {
String fileContents;
try {
fileContents = ProcessHelper.readFromFile(path);
} catch (IOException e) {
- throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddFile.2") + fileSourcePath)); //$NON-NLS-1$
+ throw new ProcessFailureException(
+ getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddFile.2") + fileSourcePath)); //$NON-NLS-1$
}
- fileContents = ProcessHelper.getValueAfterExpandingMacros(fileContents, ProcessHelper.getReplaceKeys(fileContents), template.getValueStore());
+ fileContents = ProcessHelper.getValueAfterExpandingMacros(fileContents,
+ ProcessHelper.getReplaceKeys(fileContents), template.getValueStore());
contents = new ByteArrayInputStream(fileContents.getBytes());
} else {
try {
contents = path.openStream();
} catch (IOException e) {
- throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddFile.3") + fileSourcePath)); //$NON-NLS-1$
+ throw new ProcessFailureException(
+ getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddFile.3") + fileSourcePath)); //$NON-NLS-1$
}
}
try {
IFile iFile = projectHandle.getFile(fileTargetPath);
if (!iFile.getParent().exists()) {
- ProcessHelper.mkdirs(projectHandle, projectHandle.getFolder(iFile.getParent().getProjectRelativePath()));
+ ProcessHelper.mkdirs(projectHandle,
+ projectHandle.getFolder(iFile.getParent().getProjectRelativePath()));
}
iFile.create(contents, true, null);
iFile.refreshLocal(IResource.DEPTH_ONE, null);
projectHandle.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
- throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddFile.4") + e.getMessage()), e); //$NON-NLS-1$
+ throw new ProcessFailureException(
+ getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddFile.4") + e.getMessage()), e); //$NON-NLS-1$
}
}
}
diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddFiles.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddFiles.java
index d3057cc79b..7895b1b473 100644
--- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddFiles.java
+++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddFiles.java
@@ -37,17 +37,18 @@ import org.eclipse.core.runtime.IStatus;
* Adds Files to the Project
*/
public class AddFiles extends ProcessRunner {
-
+
/**
* This method Adds the list of Files to the corresponding Project.
*/
@Override
- public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
+ public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
IProject projectHandle = null;
ProcessArgument[][] files = null;
String startPattern = null;
String endPattern = null;
-
+
for (ProcessArgument arg : args) {
String argName = arg.getName();
if (argName.equals("projectName")) { //$NON-NLS-1$
@@ -60,29 +61,32 @@ public class AddFiles extends ProcessRunner {
endPattern = arg.getSimpleValue();
}
}
-
+
if (projectHandle == null)
- throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddFiles.8"))); //$NON-NLS-1$
-
+ throw new ProcessFailureException(
+ getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddFiles.8"))); //$NON-NLS-1$
+
if (files == null)
- throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddFiles.9"))); //$NON-NLS-1$
-
- for(int i=0; i<files.length; i++) {
+ throw new ProcessFailureException(
+ getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddFiles.9"))); //$NON-NLS-1$
+
+ for (int i = 0; i < files.length; i++) {
ProcessArgument[] file = files[i];
String fileSourcePath = file[0].getSimpleValue();
String fileTargetPath = file[1].getSimpleValue();
boolean replaceable = file[2].getSimpleValue().equals("true"); //$NON-NLS-1$
-
+
URL path;
try {
path = TemplateEngineHelper.getTemplateResourceURLRelativeToTemplate(template, fileSourcePath);
if (path == null) {
- throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddFiles.1") + fileSourcePath)); //$NON-NLS-1$
+ throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR,
+ Messages.getString("AddFiles.1") + fileSourcePath)); //$NON-NLS-1$
}
} catch (IOException e1) {
throw new ProcessFailureException(Messages.getString("AddFiles.2") + fileSourcePath); //$NON-NLS-1$
}
-
+
InputStream contents = null;
if (replaceable) {
String fileContents;
@@ -92,26 +96,30 @@ public class AddFiles extends ProcessRunner {
throw new ProcessFailureException(Messages.getString("AddFiles.3") + fileSourcePath); //$NON-NLS-1$
}
if (startPattern != null && endPattern != null)
- fileContents = ProcessHelper.getValueAfterExpandingMacros(fileContents, ProcessHelper.getReplaceKeys(fileContents, startPattern, endPattern), template.getValueStore(),
- startPattern, endPattern);
+ fileContents = ProcessHelper.getValueAfterExpandingMacros(fileContents,
+ ProcessHelper.getReplaceKeys(fileContents, startPattern, endPattern),
+ template.getValueStore(), startPattern, endPattern);
else
- fileContents = ProcessHelper.getValueAfterExpandingMacros(fileContents, ProcessHelper.getReplaceKeys(fileContents), template.getValueStore());
-
+ fileContents = ProcessHelper.getValueAfterExpandingMacros(fileContents,
+ ProcessHelper.getReplaceKeys(fileContents), template.getValueStore());
+
contents = new ByteArrayInputStream(fileContents.getBytes());
} else {
try {
contents = path.openStream();
} catch (IOException e) {
- throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddFiles.4") + fileSourcePath)); //$NON-NLS-1$
+ throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR,
+ Messages.getString("AddFiles.4") + fileSourcePath)); //$NON-NLS-1$
}
}
-
+
try {
IFile iFile = projectHandle.getFile(fileTargetPath);
if (!iFile.getParent().exists()) {
- ProcessHelper.mkdirs(projectHandle, projectHandle.getFolder(iFile.getParent().getProjectRelativePath()));
+ ProcessHelper.mkdirs(projectHandle,
+ projectHandle.getFolder(iFile.getParent().getProjectRelativePath()));
}
-
+
if (iFile.exists()) {
// honor the replaceable flag and replace the file contents if the file already exists.
if (replaceable) {
@@ -119,10 +127,10 @@ public class AddFiles extends ProcessRunner {
} else {
throw new ProcessFailureException(Messages.getString("AddFiles.5")); //$NON-NLS-1$
}
-
+
} else {
iFile.create(contents, true, null);
- iFile.refreshLocal(IResource.DEPTH_ONE, null);
+ iFile.refreshLocal(IResource.DEPTH_ONE, null);
}
} catch (CoreException e) {
throw new ProcessFailureException(Messages.getString("AddFiles.6") + e.getMessage(), e); //$NON-NLS-1$
diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddLink.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddLink.java
index 6658dc8b38..c478128967 100644
--- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddLink.java
+++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddLink.java
@@ -28,7 +28,6 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
-
/**
* Adds a Link to the Project.
*/
@@ -38,13 +37,14 @@ public class AddLink extends ProcessRunner {
* This method Adds a Link to the Project.
*/
@Override
- public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
+ public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
String projectName = args[0].getSimpleValue();
String fileSourcePath = args[1].getSimpleValue();
String targetPath = args[2].getSimpleValue();
File sourceFile = new java.io.File(fileSourcePath);
-
+
IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
try {
@@ -52,7 +52,8 @@ public class AddLink extends ProcessRunner {
if (!file.getParent().exists()) {
ProcessHelper.mkdirs(projectHandle, projectHandle.getFolder(file.getParent().getProjectRelativePath()));
}
- file.createLink(Path.fromOSString(sourceFile.getAbsolutePath()), IResource.ALLOW_MISSING_LOCAL | IResource.BACKGROUND_REFRESH, null);
+ file.createLink(Path.fromOSString(sourceFile.getAbsolutePath()),
+ IResource.ALLOW_MISSING_LOCAL | IResource.BACKGROUND_REFRESH, null);
file.refreshLocal(IResource.DEPTH_ONE, null);
projectHandle.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddNature.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddNature.java
index 74e192e557..6358626548 100644
--- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddNature.java
+++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AddNature.java
@@ -32,7 +32,8 @@ import org.eclipse.core.runtime.IStatus;
public class AddNature extends ProcessRunner {
@Override
- public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
+ public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
IProject project = null;
String natureId = null;
@@ -43,13 +44,15 @@ public class AddNature extends ProcessRunner {
else if (argName.equals("natureId")) //$NON-NLS-1$
natureId = arg.getSimpleValue();
}
-
+
if (project == null)
- throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddNature.noProject"))); //$NON-NLS-1$
+ throw new ProcessFailureException(
+ getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddNature.noProject"))); //$NON-NLS-1$
if (natureId == null)
- throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddNature.noNature"))); //$NON-NLS-1$
-
+ throw new ProcessFailureException(
+ getProcessMessage(processId, IStatus.ERROR, Messages.getString("AddNature.noNature"))); //$NON-NLS-1$
+
try {
CProjectNature.addNature(project, natureId, monitor);
} catch (CoreException e) {
diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/Append.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/Append.java
index 2748ee3e7b..b220385cf6 100644
--- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/Append.java
+++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/Append.java
@@ -26,26 +26,27 @@ import org.eclipse.cdt.core.templateengine.process.ProcessRunner;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-
/**
- * Append the contents to the file.
+ * Append the contents to the file.
*/
public class Append extends ProcessRunner {
-
+
/**
* This method Appends the contents to a file.
*/
@Override
- public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
+ public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
ProcessArgument[][] files = args[0].getComplexArrayValue();
- for(int i=0; i<files.length; i++) {
+ for (int i = 0; i < files.length; i++) {
ProcessArgument[] file = files[i];
String sourcePath = file[0].getSimpleValue();
URL sourceURL;
try {
sourceURL = TemplateEngineHelper.getTemplateResourceURLRelativeToTemplate(template, sourcePath);
if (sourceURL == null) {
- throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR, Messages.getString("Append.0") + sourcePath)); //$NON-NLS-1$
+ throw new ProcessFailureException(
+ getProcessMessage(processId, IStatus.ERROR, Messages.getString("Append.0") + sourcePath)); //$NON-NLS-1$
}
} catch (IOException e1) {
throw new ProcessFailureException(Messages.getString("Append.1") + sourcePath); //$NON-NLS-1$
@@ -59,7 +60,8 @@ public class Append extends ProcessRunner {
throw new ProcessFailureException(Messages.getString("Append.3") + sourcePath); //$NON-NLS-1$
}
if (replaceable) {
- fileContents = ProcessHelper.getValueAfterExpandingMacros(fileContents, ProcessHelper.getReplaceKeys(fileContents), template.getValueStore());
+ fileContents = ProcessHelper.getValueAfterExpandingMacros(fileContents,
+ ProcessHelper.getReplaceKeys(fileContents), template.getValueStore());
}
try {
ProcessHelper.appendFile(fileContents, targetFile);
diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AppendCreate.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AppendCreate.java
index 0b551a505a..7e7fb95752 100644
--- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AppendCreate.java
+++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/AppendCreate.java
@@ -32,27 +32,28 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-
/*
* Appends a file to an existing file if present. If not, create the file
*/
public class AppendCreate extends ProcessRunner {
@Override
- public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
+ public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
String projectName = args[0].getSimpleValue();
IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
ProcessArgument[][] files = args[1].getComplexArrayValue();
- for(int i=0; i<files.length; i++) {
+ for (int i = 0; i < files.length; i++) {
ProcessArgument[] file = files[i];
String sourcePath = file[0].getSimpleValue();
String targetPath = file[1].getSimpleValue();
boolean replaceable = file[2].getSimpleValue().equals("true"); //$NON-NLS-1$
-
+
URL sourceURL;
try {
sourceURL = TemplateEngineHelper.getTemplateResourceURLRelativeToTemplate(template, sourcePath);
if (sourceURL == null) {
- throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR, Messages.getString("AppendCreate.1") + sourcePath)); //$NON-NLS-1$
+ throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR,
+ Messages.getString("AppendCreate.1") + sourcePath)); //$NON-NLS-1$
}
} catch (IOException e1) {
throw new ProcessFailureException(Messages.getString("AppendCreate.2") + sourcePath); //$NON-NLS-1$
@@ -64,27 +65,29 @@ public class AppendCreate extends ProcessRunner {
throw new ProcessFailureException(Messages.getString("AppendCreate.3") + sourcePath); //$NON-NLS-1$
}
if (replaceable) {
- fileContents = ProcessHelper.getValueAfterExpandingMacros(fileContents, ProcessHelper.getReplaceKeys(fileContents), template.getValueStore());
+ fileContents = ProcessHelper.getValueAfterExpandingMacros(fileContents,
+ ProcessHelper.getReplaceKeys(fileContents), template.getValueStore());
}
try {
// Check whether the file exists
IFile iFile = projectHandle.getFile(targetPath);
if (!iFile.getParent().exists()) {
- ProcessHelper.mkdirs(projectHandle, projectHandle.getFolder(iFile.getParent().getProjectRelativePath()));
- }
+ ProcessHelper.mkdirs(projectHandle,
+ projectHandle.getFolder(iFile.getParent().getProjectRelativePath()));
+ }
InputStream contents = new ByteArrayInputStream(fileContents.getBytes());
if (!iFile.exists()) {
// Create the file
iFile.create(contents, true, null);
iFile.refreshLocal(IResource.DEPTH_ONE, null);
-
+
} else {
// Append the file keeping the history
iFile.appendContents(contents, true, true, null);
}
// Update the project
projectHandle.refreshLocal(IResource.DEPTH_INFINITE, null);
-
+
} catch (CoreException e) {
throw new ProcessFailureException(Messages.getString("AppendCreate.4"), e); //$NON-NLS-1$
}
diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/Copy.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/Copy.java
index e351a6316c..ffa36d5a3f 100644
--- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/Copy.java
+++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/Copy.java
@@ -27,26 +27,27 @@ import org.eclipse.cdt.core.templateengine.process.ProcessRunner;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-
/**
* Copies a File to the Project.
*/
public class Copy extends ProcessRunner {
-
+
/**
* This method Copies a File to the Project.
*/
@Override
- public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
+ public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
ProcessArgument[][] files = args[0].getComplexArrayValue();
- for(int i=0; i<files.length; i++) {
+ for (int i = 0; i < files.length; i++) {
ProcessArgument[] file = files[i];
String sourcePath = file[0].getSimpleValue();
URL sourceURL;
try {
sourceURL = TemplateEngineHelper.getTemplateResourceURLRelativeToTemplate(template, sourcePath);
if (sourceURL == null) {
- throw new ProcessFailureException(getProcessMessage(processId, IStatus.ERROR, Messages.getString("Copy.0") + sourcePath)); //$NON-NLS-1$
+ throw new ProcessFailureException(
+ getProcessMessage(processId, IStatus.ERROR, Messages.getString("Copy.0") + sourcePath)); //$NON-NLS-1$
}
} catch (IOException e1) {
throw new ProcessFailureException(Messages.getString("Copy.1") + sourcePath); //$NON-NLS-1$
@@ -60,7 +61,8 @@ public class Copy extends ProcessRunner {
} catch (IOException e1) {
throw new ProcessFailureException(Messages.getString("Copy.3") + sourcePath); //$NON-NLS-1$
}
- fileContents = ProcessHelper.getValueAfterExpandingMacros(fileContents, ProcessHelper.getReplaceKeys(fileContents), template.getValueStore());
+ fileContents = ProcessHelper.getValueAfterExpandingMacros(fileContents,
+ ProcessHelper.getReplaceKeys(fileContents), template.getValueStore());
if (!targetFile.getParentFile().exists()) {
targetFile.getParentFile().mkdirs();
}
diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/CreateFolder.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/CreateFolder.java
index 2c1dff8006..e88127ea31 100644
--- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/CreateFolder.java
+++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/CreateFolder.java
@@ -25,7 +25,6 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
-
/**
* Creates regular folder in the project.
* @since 5.1
@@ -36,7 +35,8 @@ public class CreateFolder extends ProcessRunner {
* @see org.eclipse.cdt.core.templateengine.process.ProcessRunner#process(org.eclipse.cdt.core.templateengine.TemplateCore, org.eclipse.cdt.core.templateengine.process.ProcessArgument[], java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
- public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
+ public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
createFolder(args[0].getSimpleValue(), args[1].getSimpleValue(), monitor);
}
@@ -48,10 +48,11 @@ public class CreateFolder extends ProcessRunner {
* @param monitor - progress monitor.
* @throws ProcessFailureException if there is a problem with creating new folder.
*/
- public static void createFolder(String projectName, String targetPath, IProgressMonitor monitor) throws ProcessFailureException {
+ public static void createFolder(String projectName, String targetPath, IProgressMonitor monitor)
+ throws ProcessFailureException {
//If the targetPath is an empty string, there will be no folder to create.
// Also this is not an error. So just return gracefully.
- if (targetPath == null || targetPath.length()==0) {
+ if (targetPath == null || targetPath.length() == 0) {
return;
}
@@ -64,7 +65,7 @@ public class CreateFolder extends ProcessRunner {
IPath path = new Path(targetPath);
try {
- for (int i=1;i<=path.segmentCount();i++) {
+ for (int i = 1; i <= path.segmentCount(); i++) {
IFolder subfolder = projectHandle.getFolder(path.uptoSegment(i));
if (!subfolder.exists()) {
subfolder.create(true, true, monitor);
diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/CreateResourceIdentifier.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/CreateResourceIdentifier.java
index 5d8e8711e4..9610fb333d 100644
--- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/CreateResourceIdentifier.java
+++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/CreateResourceIdentifier.java
@@ -19,7 +19,6 @@ import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
import org.eclipse.cdt.core.templateengine.process.ProcessRunner;
import org.eclipse.core.runtime.IProgressMonitor;
-
/**
* Creates a template macro value that can be used as a pseudo-unique resource identifier.
* It is based on the name of the application and is in the form of four capital letters.
@@ -28,16 +27,17 @@ import org.eclipse.core.runtime.IProgressMonitor;
public class CreateResourceIdentifier extends ProcessRunner {
@Override
- public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
+ public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
String valueName = args[0].getSimpleValue();
String appName = args[1].getSimpleValue();
-
+
String value = ""; //$NON-NLS-1$
if (appName.length() >= 4) {
value = appName.substring(0, 4).toUpperCase();
} else {
value = appName.toUpperCase();
- for (int i=0; i<4-appName.length(); i++) {
+ for (int i = 0; i < 4 - appName.length(); i++) {
value = value + "X"; //$NON-NLS-1$
}
}
diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/CreateSourceFolder.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/CreateSourceFolder.java
index 069baf1014..57ec5da5cb 100644
--- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/CreateSourceFolder.java
+++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/CreateSourceFolder.java
@@ -40,26 +40,27 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
-
/**
* Creates a include Folder to the project.
*/
public class CreateSourceFolder extends ProcessRunner {
-
+
@Override
- public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
+ public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
createSourceFolder(args[0].getSimpleValue(), args[1].getSimpleValue(), monitor);
}
- protected void createSourceFolder(String projectName, String targetPath, IProgressMonitor monitor) throws ProcessFailureException {
+ protected void createSourceFolder(String projectName, String targetPath, IProgressMonitor monitor)
+ throws ProcessFailureException {
//If the targetPath is an empty string, there will be no source folder to create.
// Also this is not an error. So just return gracefully.
- if (targetPath == null || targetPath.length()==0) {
+ if (targetPath == null || targetPath.length() == 0) {
return;
}
-
+
IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
-
+
if (!projectHandle.exists()) {
throw new ProcessFailureException(Messages.getString("CreateSourceFolder.0") + projectName); //$NON-NLS-1$
}
@@ -72,11 +73,11 @@ public class CreateSourceFolder extends ProcessRunner {
try {
ICProject cProject = CoreModel.getDefault().create(projectHandle);
if (cProject != null) {
- if(CCorePlugin.getDefault().isNewStyleProject(cProject.getProject())){
+ if (CCorePlugin.getDefault().isNewStyleProject(cProject.getProject())) {
//create source folder for new style project
createNewStyleProjectFolder(monitor, projectHandle, folder);
} else {
- //create source folder for all other projects
+ //create source folder for all other projects
createFolder(targetPath, monitor, projPath, cProject);
}
}
@@ -94,17 +95,18 @@ public class CreateSourceFolder extends ProcessRunner {
* @throws CoreException
* @throws WriteAccessException
*/
- private void createNewStyleProjectFolder(IProgressMonitor monitor, IProject projectHandle, IFolder folder) throws CoreException, WriteAccessException {
- ICSourceEntry newEntry = new CSourceEntry(folder, null, 0);
+ private void createNewStyleProjectFolder(IProgressMonitor monitor, IProject projectHandle, IFolder folder)
+ throws CoreException, WriteAccessException {
+ ICSourceEntry newEntry = new CSourceEntry(folder, null, 0);
ICProjectDescription description = CCorePlugin.getDefault().getProjectDescription(projectHandle);
ICConfigurationDescription configs[] = description.getConfigurations();
- for(int i=0; i < configs.length; i++){
+ for (int i = 0; i < configs.length; i++) {
ICConfigurationDescription config = configs[i];
ICSourceEntry[] entries = config.getSourceEntries();
Set<ICSourceEntry> set = new HashSet<ICSourceEntry>();
- for (int j=0; j < entries.length; j++) {
- if(new Path(entries[j].getValue()).segmentCount() == 1)
+ for (int j = 0; j < entries.length; j++) {
+ if (new Path(entries[j].getValue()).segmentCount() == 1)
continue;
set.add(entries[j]);
}
@@ -122,11 +124,12 @@ public class CreateSourceFolder extends ProcessRunner {
* @param cProject
* @throws CModelException
*/
- private void createFolder(String targetPath, IProgressMonitor monitor, IPath projPath, ICProject cProject) throws CModelException {
+ private void createFolder(String targetPath, IProgressMonitor monitor, IPath projPath, ICProject cProject)
+ throws CModelException {
IPathEntry[] entries = cProject.getRawPathEntries();
List<IPathEntry> newEntries = new ArrayList<IPathEntry>(entries.length + 1);
- int projectEntryIndex= -1;
+ int projectEntryIndex = -1;
IPath path = projPath.append(targetPath);
for (int i = 0; i < entries.length; i++) {
@@ -137,7 +140,7 @@ public class CreateSourceFolder extends ProcessRunner {
}
if (projPath.equals(curr.getPath())) {
projectEntryIndex = i;
- }
+ }
newEntries.add(curr);
}
@@ -151,5 +154,5 @@ public class CreateSourceFolder extends ProcessRunner {
cProject.setRawPathEntries(newEntries.toArray(new IPathEntry[newEntries.size()]), monitor);
}
-
+
}
diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/Messages.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/Messages.java
index 0657f69f2b..89ed75a59a 100644
--- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/Messages.java
+++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/Messages.java
@@ -17,8 +17,7 @@ import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class Messages {
- private static final ResourceBundle RESOURCE_BUNDLE =
- ResourceBundle.getBundle(Messages.class.getName());
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(Messages.class.getName());
private Messages() {
}
diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/SetEnvironmentVariable.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/SetEnvironmentVariable.java
index 5df333444e..3339989227 100644
--- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/SetEnvironmentVariable.java
+++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/process/processes/SetEnvironmentVariable.java
@@ -59,7 +59,8 @@ public class SetEnvironmentVariable extends ProcessRunner {
private static final String VARIABLES_VALUE_VARNAME = "value"; //$NON-NLS-1$
@Override
- public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
+ public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor)
+ throws ProcessFailureException {
IProject project = null;
Map<String, String> envVars = new LinkedHashMap<String, String>();
@@ -68,17 +69,17 @@ public class SetEnvironmentVariable extends ProcessRunner {
String argName = arg.getName();
if (PROJECTNAME_VARNAME.equals(argName))
project = ResourcesPlugin.getWorkspace().getRoot().getProject(arg.getSimpleValue());
- else if(VARIABLES_VARNAME.equals(argName)) {
+ else if (VARIABLES_VARNAME.equals(argName)) {
- for(ProcessArgument[] envVarArgs : arg.getComplexArrayValue()) {
+ for (ProcessArgument[] envVarArgs : arg.getComplexArrayValue()) {
String name = null;
String value = null;
- for(ProcessArgument varArg : envVarArgs) {
+ for (ProcessArgument varArg : envVarArgs) {
String varArgName = varArg.getName();
if (VARIABLES_NAME_VARNAME.equals(varArgName))
name = varArg.getSimpleValue();
- else if(VARIABLES_VALUE_VARNAME.equals(varArgName))
+ else if (VARIABLES_VALUE_VARNAME.equals(varArgName))
value = varArg.getSimpleValue();
}
@@ -100,7 +101,7 @@ public class SetEnvironmentVariable extends ProcessRunner {
ICConfigurationDescription[] configDescs = des.getConfigurations();
IContributedEnvironment ice = CCorePlugin.getDefault().getBuildEnvironmentManager().getContributedEnvironment();
- for(Map.Entry<String, String> envVar : envVars.entrySet()) {
+ for (Map.Entry<String, String> envVar : envVars.entrySet()) {
String name = envVar.getKey();
String value = envVar.getValue();
@@ -110,7 +111,7 @@ public class SetEnvironmentVariable extends ProcessRunner {
try {
mngr.setProjectDescription(project, des);
- } catch(CoreException e) {
+ } catch (CoreException e) {
CCorePlugin.log(e);
}
}

Back to the top