Methods Summary |
---|
public void | addFile(ResourceFile file)Adds a {@link ResourceFile} to the folder.
if (mFiles == null) {
mFiles = new ArrayList<ResourceFile>();
}
mFiles.add(file);
|
public com.android.ide.eclipse.editors.resources.configurations.FolderConfiguration | getConfiguration()
return mConfiguration;
|
public ResourceFile | getFile(com.android.ide.eclipse.editors.resources.manager.files.IAbstractFile file)Returns the {@link ResourceFile} matching a {@link IAbstractFile} object.
if (mFiles != null) {
for (ResourceFile f : mFiles) {
if (f.getFile().equals(file)) {
return f;
}
}
}
return null;
|
public ResourceFile | getFile(org.eclipse.core.resources.IFile file)Returns the {@link ResourceFile} matching a {@link IFile} object.
if (mFiles != null) {
for (ResourceFile f : mFiles) {
IFile iFile = f.getFile().getIFile();
if (iFile != null && iFile.equals(file)) {
return f;
}
}
}
return null;
|
public ResourceFile | getFile(java.lang.String filename)Returns the {@link ResourceFile} matching a given name.
if (mFiles != null) {
for (ResourceFile f : mFiles) {
if (f.getFile().getName().equals(filename)) {
return f;
}
}
}
return null;
|
public com.android.ide.eclipse.editors.resources.manager.files.IAbstractFolder | getFolder()Returns the {@link IFolder} associated with this object.
return mFolder;
|
public java.util.Collection | getResourceTypes()Returns the list of {@link ResourceType}s generated by the files inside this folder.
ArrayList<ResourceType> list = new ArrayList<ResourceType>();
if (mFiles != null) {
for (ResourceFile file : mFiles) {
ResourceType[] types = file.getResourceTypes();
// loop through those and add them to the main list,
// if they are not already present
if (types != null) {
for (ResourceType resType : types) {
if (list.indexOf(resType) == -1) {
list.add(resType);
}
}
}
}
}
return list;
|
public java.util.Collection | getResources(com.android.ide.eclipse.common.resources.ResourceType type, ProjectResources projectResources)Get the list of {@link ResourceItem} of a specific type generated by all the files
in the folder.
This method must make sure not to create duplicates.
Collection<ProjectResourceItem> list = new ArrayList<ProjectResourceItem>();
if (mFiles != null) {
for (ResourceFile f : mFiles) {
list.addAll(f.getResources(type, projectResources));
}
}
return list;
|
public ResourceFolderType | getType()Returns the {@link ResourceFolderType} of this object.
return mType;
|
public boolean | hasFile(java.lang.String name)Returns whether the folder contains a file with the given name.
return mFolder.hasFile(name);
|
public boolean | hasResources(com.android.ide.eclipse.common.resources.ResourceType type)Returns whether a file in the folder is generating a resource of a specified type.
// Check if the folder type is able to generate resource of the type that was asked.
// this is a first check to avoid going through the files.
ResourceFolderType[] folderTypes = FolderTypeRelationship.getRelatedFolders(type);
boolean valid = false;
for (ResourceFolderType rft : folderTypes) {
if (rft == mType) {
valid = true;
break;
}
}
if (valid) {
if (mFiles != null) {
for (ResourceFile f : mFiles) {
if (f.hasResources(type)) {
return true;
}
}
}
}
return false;
|
public boolean | isFramework()Returns whether the folder is a framework resource folder.
return mIsFramework;
|
public void | removeFile(org.eclipse.core.resources.IFile file)Attempts to remove the {@link ResourceFile} associated with a specified {@link IFile}.
if (mFiles != null) {
int count = mFiles.size();
for (int i = 0 ; i < count ; i++) {
ResourceFile resFile = mFiles.get(i);
if (resFile != null) {
IFile iFile = resFile.getFile().getIFile();
if (iFile != null && iFile.equals(file)) {
mFiles.remove(i);
touch();
}
}
}
}
|