mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Remove IResource/IFile/IContainer adapters.
BinaryContainerAdapter BinaryFileAdapter Container
This commit is contained in:
parent
8cf320d440
commit
61bb9b156d
3 changed files with 0 additions and 622 deletions
|
@ -1,99 +0,0 @@
|
|||
package org.eclipse.cdt.internal.core.model;
|
||||
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
public abstract class Container extends Resource implements IContainer {
|
||||
|
||||
/**
|
||||
* @see IContainer#findMember(String)
|
||||
*/
|
||||
public IResource findMember(String name) {
|
||||
return findMember(name, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IContainer#findMember(String, boolean)
|
||||
*/
|
||||
public IResource findMember(String name, boolean phantom) {
|
||||
return findMember(new Path(name), phantom);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IContainer#findMember(IPath)
|
||||
*/
|
||||
public IResource findMember(IPath path) {
|
||||
return findMember(path, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IContainer#findMember(IPath)
|
||||
*/
|
||||
public IResource findMember(IPath path, boolean phantom) {
|
||||
path = getFullPath().append(path);
|
||||
try {
|
||||
IResource[] resources = members(phantom);
|
||||
for (int i = 0; i < resources.length; i++) {
|
||||
if (resources[i].getFullPath().equals(path)) {
|
||||
return resources[i];
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IContainer#getFile(String)
|
||||
*/
|
||||
public IFile getFile(String name) {
|
||||
return getFile(new Path(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IContainer#getFolder(String)
|
||||
*/
|
||||
public IFolder getFolder(String name) {
|
||||
return getFolder(new Path(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IContainer#members
|
||||
*/
|
||||
public IResource[] members() throws CoreException {
|
||||
return members(IResource.NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IContainer#members(boolean)
|
||||
*/
|
||||
public IResource[] members(boolean phantom) throws CoreException {
|
||||
return members(phantom ? INCLUDE_PHANTOMS : IResource.NONE);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see IContainer#members(int)
|
||||
*/
|
||||
public abstract IResource[] members(int memberFlags) throws CoreException;
|
||||
|
||||
/**
|
||||
* @see IContainer#exits(IPath)
|
||||
*/
|
||||
public abstract boolean exists(IPath path);
|
||||
|
||||
/**
|
||||
* @see IContainer#getFile(IPath)
|
||||
*/
|
||||
public abstract IFile getFile(IPath path);
|
||||
|
||||
/**
|
||||
* @see IContainer#getFolder(IPath)
|
||||
*/
|
||||
public abstract IFolder getFolder(IPath path);
|
||||
|
||||
}
|
|
@ -1,282 +0,0 @@
|
|||
package org.eclipse.cdt.internal.core.model.parser;
|
||||
|
||||
/*
|
||||
* (c) Copyright IBM Corp. 2000, 2001.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.cdt.core.IBinaryParser.IBinaryArchive;
|
||||
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
|
||||
import org.eclipse.cdt.internal.core.model.Container;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class BinaryContainerAdapter extends Container implements IFolder {
|
||||
|
||||
IBinaryArchive archive;
|
||||
long timestamp;
|
||||
ArrayList children;
|
||||
ArrayList phantomResources;
|
||||
|
||||
public BinaryContainerAdapter (IBinaryArchive ar) {
|
||||
archive = ar;
|
||||
phantomResources = new ArrayList(0);
|
||||
children = new ArrayList(5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#refreshLocal(int, IProgressMonitor)
|
||||
*/
|
||||
public void refreshLocal(int depth, IProgressMonitor monitor) throws CoreException {
|
||||
IFile file = archive.getFile();
|
||||
if (file != null) {
|
||||
file.refreshLocal(depth, monitor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#getFullPath()
|
||||
*/
|
||||
public IPath getFullPath() {
|
||||
IFile file = archive.getFile();
|
||||
if (file != null) {
|
||||
return file.getFullPath();
|
||||
}
|
||||
return new Path("");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#getParent()
|
||||
*/
|
||||
public IContainer getParent() {
|
||||
IFile file = archive.getFile();
|
||||
if (file != null) {
|
||||
return file.getParent();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#getType()
|
||||
*/
|
||||
public int getType() {
|
||||
return IResource.FOLDER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#getModificationStamp()
|
||||
*/
|
||||
public long getModificationStamp() {
|
||||
IFile file = archive.getFile();
|
||||
if (file != null) {
|
||||
return file.getModificationStamp();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFolder#delete(boolean, boolean, IProgressMonitor)
|
||||
*/
|
||||
public void delete(boolean force, boolean keepHistory,
|
||||
IProgressMonitor monitor) throws CoreException {
|
||||
delete((keepHistory ? KEEP_HISTORY : IResource.NONE) | (force ? FORCE : IResource.NONE), monitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#delete(int, IProgressMonitor)
|
||||
*/
|
||||
public void delete(int updateFlags, IProgressMonitor monitor) throws CoreException {
|
||||
IFile file = archive.getFile();
|
||||
if (file != null) {
|
||||
file.delete(updateFlags, monitor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#touch(IProgressMonitor)
|
||||
*/
|
||||
public void touch(IProgressMonitor monitor) throws CoreException {
|
||||
IFile file = archive.getFile();
|
||||
if (file != null) {
|
||||
file.touch(monitor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFolder#create(boolean, boolean, IProgressMonitor)
|
||||
*/
|
||||
public void create(boolean force, boolean local, IProgressMonitor monitor)
|
||||
throws CoreException {
|
||||
create((force ? FORCE : IResource.NONE), local, monitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFolder#create(int, boolean, IProgressMonitor)
|
||||
*/
|
||||
public void create(int updateFlags, boolean local,
|
||||
IProgressMonitor monitor) throws CoreException {
|
||||
// FIXME: Not implemented.
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFolder#getFile(String)
|
||||
*/
|
||||
public IFile getFile(IPath path) {
|
||||
IFile f = (IFile)findMember(path);
|
||||
if (f == null) {
|
||||
// Pass it to parent to create a fake/phantom if the object
|
||||
// is not in the archive.
|
||||
IContainer container = getParent();
|
||||
if (container != null) {
|
||||
f = container.getFile(path);
|
||||
// Add it to the list of phantoms
|
||||
if (! phantomResources.contains(f)) {
|
||||
phantomResources.add(f);
|
||||
phantomResources.trimToSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFolder#move(IPath, boolean, boolean, IProgressMonitor)
|
||||
*/
|
||||
public void move(IPath destination, boolean force, boolean keepHistory,
|
||||
IProgressMonitor monitor) throws CoreException {
|
||||
move(destination, (keepHistory ? KEEP_HISTORY : IResource.NONE) | (force ? FORCE : IResource.NONE), monitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IContainer#exists(IPath)
|
||||
*/
|
||||
public boolean exists(IPath path) {
|
||||
// Check if it is the archive.
|
||||
if (getFullPath().equals(path)) {
|
||||
IFile file = archive.getFile();
|
||||
if (file != null) {
|
||||
return file.exists();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return findMember(path) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IContainer#getFolder(IPath)
|
||||
*/
|
||||
public IFolder getFolder(IPath path) {
|
||||
// Only Files in the archive pass this to the parent
|
||||
// to create a phatom resource
|
||||
IFolder f = null;
|
||||
IContainer container = getParent();
|
||||
if (container != null) {
|
||||
f = container.getFolder(path);
|
||||
if (!phantomResources.contains(f)) {
|
||||
phantomResources.add(f);
|
||||
phantomResources.trimToSize();
|
||||
}
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IContainer#members(int)
|
||||
*/
|
||||
public IResource[] members(int memberFlags) throws CoreException {
|
||||
final boolean includePhantoms = (memberFlags & IContainer.INCLUDE_PHANTOMS) != 0;
|
||||
final boolean includeTeamPrivateMember =
|
||||
(memberFlags & IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS) != 0;
|
||||
|
||||
ArrayList aList = new ArrayList();
|
||||
|
||||
if (hasChanged()) {
|
||||
children.clear();
|
||||
IBinaryObject[] objects = archive.getObjects();
|
||||
for (int i = 0; i < objects.length; i++) {
|
||||
children.add(new BinaryFileAdapter(this, objects[i]));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < children.size(); i++) {
|
||||
IResource child = (IResource)children.get(i);
|
||||
if (includeTeamPrivateMember && child.isTeamPrivateMember() || !child.isTeamPrivateMember()) {
|
||||
aList.add(child);
|
||||
}
|
||||
}
|
||||
|
||||
if (includePhantoms) {
|
||||
aList.addAll(phantomResources);
|
||||
}
|
||||
return (IResource[])aList.toArray(new IResource[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IContainer#findDeletedMembersWithHistory(int, IProgressMonitor)
|
||||
*/
|
||||
public IFile[] findDeletedMembersWithHistory(int depth, IProgressMonitor monitor)
|
||||
throws CoreException {
|
||||
return new IFile[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#getPersistentProperty(QualifiedName)
|
||||
*/
|
||||
public String getPersistentProperty(QualifiedName key) throws CoreException {
|
||||
IFile file = archive.getFile();
|
||||
if (file != null) {
|
||||
return file.getPersistentProperty(key);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#setPersistentProperty(QualifiedName, String)
|
||||
*/
|
||||
public void setPersistentProperty(QualifiedName key, String value) throws CoreException {
|
||||
IFile file = archive.getFile();
|
||||
if (file != null) {
|
||||
file.setPersistentProperty(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#exists()
|
||||
*/
|
||||
public boolean exists() {
|
||||
IFile file = archive.getFile();
|
||||
if (file != null) {
|
||||
return file.exists();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean hasChanged() {
|
||||
boolean changed;
|
||||
long modif = getModificationStamp();
|
||||
changed = modif != timestamp;
|
||||
timestamp = modif;
|
||||
return changed;
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFolder#createLink(org.eclipse.core.runtime.IPath, int, org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
public void createLink(
|
||||
IPath localLocation,
|
||||
int updateFlags,
|
||||
IProgressMonitor monitor)
|
||||
throws CoreException {
|
||||
}
|
||||
|
||||
}
|
|
@ -1,241 +0,0 @@
|
|||
package org.eclipse.cdt.internal.core.model.parser;
|
||||
|
||||
/*
|
||||
* (c) Copyright IBM Corp. 2000, 2001.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
|
||||
import org.eclipse.cdt.internal.core.model.Resource;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFileState;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class BinaryFileAdapter extends Resource implements IFile {
|
||||
|
||||
IBinaryObject object;
|
||||
IContainer parent;
|
||||
|
||||
public BinaryFileAdapter(IContainer p, IBinaryObject o) {
|
||||
object = o;
|
||||
parent = p;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFile#appendContents(InputStream, boolean, boolean, IProgressMonitor)
|
||||
*/
|
||||
public void appendContents(InputStream source, boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException {
|
||||
appendContents(source, (keepHistory ? KEEP_HISTORY : IResource.NONE) | (force ? FORCE : IResource.NONE), monitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFile#appendContents(InputStream, int, IProgressMonitor)
|
||||
*/
|
||||
public void appendContents(InputStream source, int updateFlags, IProgressMonitor monitor)
|
||||
throws CoreException {
|
||||
// FIXME: Not implemented.
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFile#create(InputStream, boolean, IProgressMonitor)
|
||||
*/
|
||||
public void create(InputStream source, boolean force,
|
||||
IProgressMonitor monitor) throws CoreException {
|
||||
create(source, (force ? FORCE : IResource.NONE), monitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFile#create(InputStream, int, IProgressMonitor)
|
||||
*/
|
||||
public void create(InputStream source, int updateFlags,
|
||||
IProgressMonitor monitor) throws CoreException {
|
||||
// FIXME: Not implemented.
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IStorage#getContents()
|
||||
*/
|
||||
public InputStream getContents() throws CoreException {
|
||||
return getContents(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFile#getContents(boolean)
|
||||
*/
|
||||
public InputStream getContents(boolean force) throws CoreException {
|
||||
return object.getContents();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFile#getEncoding()
|
||||
*/
|
||||
public int getEncoding() throws CoreException {
|
||||
return ENCODING_UNKNOWN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFile#getHistory(IProgressMonitor)
|
||||
*/
|
||||
public IFileState[] getHistory(IProgressMonitor monitor)
|
||||
throws CoreException {
|
||||
return new IFileState[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFile#move(IPath, boolean, boolean, IProgressMonitor)
|
||||
*/
|
||||
public void move(IPath destination, boolean force, boolean keepHistory, IProgressMonitor monitor)
|
||||
throws CoreException {
|
||||
move(destination, (keepHistory ? KEEP_HISTORY : IResource.NONE)
|
||||
| (force ? FORCE : IResource.NONE), monitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFile#setContents(InputStream, boolean, boolean, IProgressMonitor)
|
||||
*/
|
||||
public void setContents(InputStream source, boolean force, boolean keepHistory,
|
||||
IProgressMonitor monitor) throws CoreException {
|
||||
setContents(source, (keepHistory ? KEEP_HISTORY : IResource.NONE)
|
||||
| (force ? FORCE : IResource.NONE), monitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFile#setContents(IFileState, boolean, boolean, IProgressMonitor)
|
||||
*/
|
||||
public void setContents(IFileState source, boolean force, boolean keepHistory,
|
||||
IProgressMonitor monitor) throws CoreException {
|
||||
setContents(source, (keepHistory ? KEEP_HISTORY : IResource.NONE)
|
||||
| (force ? FORCE : IResource.NONE), monitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFile#setContents(InputStream, int, IProgressMonitor)
|
||||
*/
|
||||
public void setContents(InputStream source, int updateFlags, IProgressMonitor monitor)
|
||||
throws CoreException {
|
||||
// FIXME: Not implemented.
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFile#setContents(IFileState, int, IProgressMonitor)
|
||||
*/
|
||||
public void setContents(IFileState source, int updateFlags, IProgressMonitor monitor)
|
||||
throws CoreException {
|
||||
// FIXME: Not implemented.
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFile#delete(boolean, boolean, IProgressMonitor)
|
||||
*/
|
||||
public void delete(boolean force, boolean keepHistory, IProgressMonitor monitor)
|
||||
throws CoreException {
|
||||
delete((keepHistory ? KEEP_HISTORY : IResource.NONE)
|
||||
| (force ? FORCE : IResource.NONE), monitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#delete(int, IProgressMonitor)
|
||||
*/
|
||||
public void delete(int updateFlags, IProgressMonitor monitor) throws CoreException {
|
||||
// FIXME: Not implemented.
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#getFullPath()
|
||||
*/
|
||||
public IPath getFullPath() {
|
||||
IFile file = object.getFile();
|
||||
if (file != null) {
|
||||
return file.getFullPath().append(object.getName());
|
||||
}
|
||||
return new Path(object.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#getModificationStamp()
|
||||
*/
|
||||
public long getModificationStamp() {
|
||||
IFile file = object.getFile();
|
||||
if (file != null) {
|
||||
return file.getModificationStamp();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#getParent()
|
||||
*/
|
||||
public IContainer getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#getType()
|
||||
*/
|
||||
public int getType() {
|
||||
return IResource.FILE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#refreshLocal(int, IProgressMonitor)
|
||||
*/
|
||||
public void refreshLocal(int depth, IProgressMonitor monitor) throws CoreException {
|
||||
IFile file = object.getFile();
|
||||
if (file != null) {
|
||||
file.refreshLocal(depth, monitor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#touch(IProgressMonitor)
|
||||
*/
|
||||
public void touch(IProgressMonitor monitor) throws CoreException {
|
||||
IFile file = object.getFile();
|
||||
if (file != null) {
|
||||
file.touch(monitor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#getPersistentProperty(QualifiedName)
|
||||
*/
|
||||
public String getPersistentProperty(QualifiedName key)
|
||||
throws CoreException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#setPersistentProperty(QualifiedName, String)
|
||||
*/
|
||||
public void setPersistentProperty(QualifiedName key, String value)
|
||||
throws CoreException {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResource#exists()
|
||||
*/
|
||||
public boolean exists() {
|
||||
return parent.exists(new Path(getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IFile#createLink(org.eclipse.core.runtime.IPath, int, org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
public void createLink(
|
||||
IPath localLocation,
|
||||
int updateFlags,
|
||||
IProgressMonitor monitor)
|
||||
throws CoreException {
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue