// parent path and return an empty list
if (paths.size() == 0)
return new IgnoreList("", new ArrayList<String>());
// get the parent path of the first element
FileSystemItem firstPath = FileSystemItem.createFile(paths.get(0));
String parentPath = firstPath.getParentPathString();
// confirm that all of the elements start with that path and take the
// remainder of their paths for our list
ArrayList<String> ignored = new ArrayList<String>();
for (String path : paths)
{
String thisParent =
FileSystemItem.createFile(path).getParentPathString();
if (!parentPath.equals(thisParent))
{
GlobalDisplay gDisp = RStudioGinjector.INSTANCE.getGlobalDisplay();
gDisp.showMessage(
MessageDialog.ERROR,
"Error: Multiple Directories",
"The selected files are not all within the same directory " +
"(you can only ignore multiple files in one operation if " +
"they are located within the same directory).");
return null;
}
// apply a filter if we have one
if (filter != null)
{
FileSystemItem file = FileSystemItem.createFile(path);
if (!filter.includeFile(file))
continue;
}
// compute the parent relative directory