Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java')
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java192
1 files changed, 96 insertions, 96 deletions
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java
index 2ed9f6c61..a3ca6a1fd 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java
@@ -27,116 +27,116 @@ import org.eclipse.core.variables.IDynamicVariableResolver;
public class BuildFilesResolver implements IDynamicVariableResolver
{
- private static final char ARG_REMOVED = 'r';
- private static final char ARG_CHANGED = 'c';
- private static final char ARG_ADDED = 'a';
- private static final char ARG_DIRS = 'd';
- private static final char ARG_FILES = 'f';
+ private static final char ARG_REMOVED = 'r';
+ private static final char ARG_CHANGED = 'c';
+ private static final char ARG_ADDED = 'a';
+ private static final char ARG_DIRS = 'd';
+ private static final char ARG_FILES = 'f';
- // Use a space as a separator as this is a more natural fit for sending a
- // list of files to a unix command
- private static final String FILE_LIST_SEPARATOR = " "; //$NON-NLS-1$
+ // Use a space as a separator as this is a more natural fit for sending a
+ // list of files to a unix command
+ private static final String FILE_LIST_SEPARATOR = " "; //$NON-NLS-1$
@Override
public String resolveValue(IDynamicVariable variable, String argument) throws CoreException
- {
- String result = null;
+ {
+ String result = null;
- IResourceDelta buildDelta = ExternalToolBuilder.getBuildDelta();
- if (buildDelta != null)
- {
- final StringBuffer fileList = new StringBuffer();
+ IResourceDelta buildDelta = ExternalToolBuilder.getBuildDelta();
+ if (buildDelta != null)
+ {
+ final StringBuffer fileList = new StringBuffer();
final Set<String> changedResources = new LinkedHashSet<>();
- // Use the argument to determine which deltas to visit - if none,
- // then defaults to all
- int deltas = 0;
- boolean dirs = false, files = false;
- if (argument != null)
- {
- // Check delta kinds
- if (argument.indexOf(ARG_ADDED) > -1)
- {
- deltas |= IResourceDelta.ADDED;
- }
- if (argument.indexOf(ARG_CHANGED) > -1)
- {
- deltas |= IResourceDelta.CHANGED;
- }
- if (argument.indexOf(ARG_REMOVED) > -1)
- {
- deltas |= IResourceDelta.REMOVED;
- }
+ // Use the argument to determine which deltas to visit - if none,
+ // then defaults to all
+ int deltas = 0;
+ boolean dirs = false, files = false;
+ if (argument != null)
+ {
+ // Check delta kinds
+ if (argument.indexOf(ARG_ADDED) > -1)
+ {
+ deltas |= IResourceDelta.ADDED;
+ }
+ if (argument.indexOf(ARG_CHANGED) > -1)
+ {
+ deltas |= IResourceDelta.CHANGED;
+ }
+ if (argument.indexOf(ARG_REMOVED) > -1)
+ {
+ deltas |= IResourceDelta.REMOVED;
+ }
- // Check wether to include files and/or directories
- if (argument.indexOf(ARG_DIRS) > -1)
- {
- dirs = true;
- }
- if (argument.indexOf(ARG_FILES) > -1)
- {
- files = true;
- }
+ // Check wether to include files and/or directories
+ if (argument.indexOf(ARG_DIRS) > -1)
+ {
+ dirs = true;
+ }
+ if (argument.indexOf(ARG_FILES) > -1)
+ {
+ files = true;
+ }
- }
- if (deltas == 0)
- {
- deltas = IResourceDelta.ADDED | IResourceDelta.CHANGED | IResourceDelta.REMOVED;
- }
- if (!dirs && !files)
- {
- dirs = true;
- files = true;
- }
- final int trackDeltas = deltas;
- final boolean trackDirs = dirs;
- final boolean trackFiles = files;
+ }
+ if (deltas == 0)
+ {
+ deltas = IResourceDelta.ADDED | IResourceDelta.CHANGED | IResourceDelta.REMOVED;
+ }
+ if (!dirs && !files)
+ {
+ dirs = true;
+ files = true;
+ }
+ final int trackDeltas = deltas;
+ final boolean trackDirs = dirs;
+ final boolean trackFiles = files;
- buildDelta.accept(new IResourceDeltaVisitor()
- {
- @Override
+ buildDelta.accept(new IResourceDeltaVisitor()
+ {
+ @Override
public boolean visit(IResourceDelta delta) throws CoreException
- {
- IResource resource = delta.getResource();
+ {
+ IResource resource = delta.getResource();
- // Only track files with the right kind of delta
- boolean isTracked = (delta.getKind() & trackDeltas) > 0;
- if (isTracked)
- {
- // Only track dirs if desired
- isTracked = trackDirs && resource.getType() != IResource.FILE;
- // Only track files if desired
- isTracked |= trackFiles && resource.getType() == IResource.FILE;
- }
+ // Only track files with the right kind of delta
+ boolean isTracked = (delta.getKind() & trackDeltas) > 0;
+ if (isTracked)
+ {
+ // Only track dirs if desired
+ isTracked = trackDirs && resource.getType() != IResource.FILE;
+ // Only track files if desired
+ isTracked |= trackFiles && resource.getType() == IResource.FILE;
+ }
- // If tracking a change, then add it to the change set for inclusion in the variable's output
- if (isTracked)
- {
- String osPath = resource.getLocation().toOSString();
- if (changedResources.add(osPath))
- {
- if (fileList.length() > 0)
- {
- fileList.append(FILE_LIST_SEPARATOR);
- }
+ // If tracking a change, then add it to the change set for inclusion in the variable's output
+ if (isTracked)
+ {
+ String osPath = resource.getLocation().toOSString();
+ if (changedResources.add(osPath))
+ {
+ if (fileList.length() > 0)
+ {
+ fileList.append(FILE_LIST_SEPARATOR);
+ }
- // Since space is our separator, we need to add quotes
- // around each file to handle filenames with embedded
- // spaces. We also need to escape out embedded quotes in
- // the filename so they don't conflict with these
- // special quotes.
- //
- osPath = osPath.replaceAll("\"", "\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$
- fileList.append("\"" + osPath + "\""); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- return true;
- }
- }, deltas);
- result = fileList.toString();
- }
+ // Since space is our separator, we need to add quotes
+ // around each file to handle filenames with embedded
+ // spaces. We also need to escape out embedded quotes in
+ // the filename so they don't conflict with these
+ // special quotes.
+ //
+ osPath = osPath.replaceAll("\"", "\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$
+ fileList.append("\"" + osPath + "\""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ return true;
+ }
+ }, deltas);
+ result = fileList.toString();
+ }
- return result;
- }
+ return result;
+ }
} \ No newline at end of file

Back to the top