1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-31 21:05:37 +02:00

remove ICFile and ICResource.

This commit is contained in:
Alain Magloire 2003-04-01 16:55:15 +00:00
parent 48d23480f7
commit 523ed3b82d
7 changed files with 15 additions and 128 deletions

View file

@ -1,13 +0,0 @@
package org.eclipse.cdt.core.model;
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
/**
* A C File Resource.
*/
public interface ICFile extends ICElement {
}

View file

@ -1,10 +0,0 @@
/*
* (c) Copyright QNX Software System Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.core.model;
public interface ICResource extends IParent, ICElement, IOpenable {
}

View file

@ -1,8 +1,6 @@
/*
* Created on Mar 30, 2003
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.cdt.internal.core.model;
@ -19,10 +17,6 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
/**
* @author alain
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class BinaryElement extends CElement implements IBinaryElement, ISourceManipulation, ISourceReference {

View file

@ -9,10 +9,6 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IFunction;
/**
* @author alain
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class BinaryFunction extends BinaryElement implements IFunction {

View file

@ -1,78 +0,0 @@
package org.eclipse.cdt.internal.core.model;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICFile;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
public class CFile extends CElement implements ICFile {
IFile file;
IPath location;
public CFile(ICElement parent, IFile file){
//this (parent, file, ICElement.C_FILE);
this(parent, file, 0);
}
public CFile(ICElement parent, IFile file, int type) {
this(parent, file, file.getLocation(), file.getName(), type);
}
public CFile(ICElement parent, IFile file, String name, int type) {
this(parent, file, file.getLocation(), name, type);
}
public CFile(ICElement parent, IPath location, int type) {
this(parent, ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(location),
location, location.lastSegment(), type);
}
public CFile(ICElement parent, IFile res, IPath location, String name, int type) {
super(parent, name, type);
this.location = location;
file = res;
}
public IPath getLocation () {
return location;
}
public void setLocation(IPath location) {
this.location = location;
}
public IFile getFile () {
return file;
}
protected CFileInfo getCFileInfo() {
return (CFileInfo)getElementInfo();
}
protected CElementInfo createElementInfo () {
return new CFileInfo(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ICElement#getResource()
*/
public IResource getResource() {
return file;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ICElement#getUnderlyingResource()
*/
public IResource getUnderlyingResource() throws CModelException {
return file;
}
}

View file

@ -11,10 +11,6 @@ import org.eclipse.cdt.core.IBinaryParser;
import org.eclipse.core.runtime.IPath;
/**
* @author alain
*
* To change this generated comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class NullBinaryParser implements IBinaryParser {

View file

@ -7,14 +7,14 @@ package org.eclipse.cdt.internal.core.model;
import java.io.IOException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.model.ISourceRange;
import org.eclipse.cdt.core.model.ICModelStatusConstants;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICModelStatusConstants;
import org.eclipse.cdt.core.model.ISourceRange;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
/**
* Element info for ISourceReference elements.
@ -46,10 +46,12 @@ class SourceManipulationInfo extends CElementInfo {
ITranslationUnit tu = getTranslationUnit();
if (tu != null) {
try {
IFile file = ((CFile)tu).getFile();
StringBuffer buffer = Util.getContent(file);
return buffer.substring(getElement().getStartPos(),
getElement().getStartPos() + getElement().getLength());
IResource res = tu.getResource();
if (res != null && res instanceof IFile) {
StringBuffer buffer = Util.getContent((IFile)res);
return buffer.substring(getElement().getStartPos(),
getElement().getStartPos() + getElement().getLength());
}
} catch (IOException e) {
throw new CModelException(e, ICModelStatusConstants.IO_EXCEPTION);
}