1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 18:56:02 +02:00

2004-09-10 Alain Magloire

Remove annoying warnings and prevent the PathEntryManger
	from firing on working Copies.

	* model/org/eclipse/cdt/internal/core/model/PathEntryManager.java
This commit is contained in:
Alain Magloire 2004-09-10 15:48:15 +00:00
parent bae54f4e47
commit 3f14afc110
43 changed files with 1042 additions and 1037 deletions

View file

@ -1,3 +1,10 @@
2004-09-10 Alain Magloire
Remove annoying warnings and prevent the PathEntryManger
from firing on working Copies.
* model/org/eclipse/cdt/internal/core/model/PathEntryManager.java
2004-09-07 Alain Magloire 2004-09-07 Alain Magloire
Part of the uncoming work to supply formatting in CDT Part of the uncoming work to supply formatting in CDT

View file

@ -16,6 +16,7 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.CProjectNature; import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.cdt.core.filetype.ICFileType; import org.eclipse.cdt.core.filetype.ICFileType;
import org.eclipse.cdt.core.resources.IPathEntryStore; import org.eclipse.cdt.core.resources.IPathEntryStore;
import org.eclipse.cdt.internal.core.model.APathEntry;
import org.eclipse.cdt.internal.core.model.BatchOperation; import org.eclipse.cdt.internal.core.model.BatchOperation;
import org.eclipse.cdt.internal.core.model.CModel; import org.eclipse.cdt.internal.core.model.CModel;
import org.eclipse.cdt.internal.core.model.CModelManager; import org.eclipse.cdt.internal.core.model.CModelManager;
@ -368,7 +369,7 @@ public class CoreModel {
* *
*/ */
public static IOutputEntry newOutputEntry(IPath outputPath) { public static IOutputEntry newOutputEntry(IPath outputPath) {
return newOutputEntry(outputPath, OutputEntry.NO_EXCLUSION_PATTERNS); return newOutputEntry(outputPath, APathEntry.NO_EXCLUSION_PATTERNS);
} }
/** /**
@ -410,7 +411,7 @@ public class CoreModel {
* *
*/ */
public static ISourceEntry newSourceEntry(IPath sourcePath) { public static ISourceEntry newSourceEntry(IPath sourcePath) {
return newSourceEntry(sourcePath, SourceEntry.NO_EXCLUSION_PATTERNS); return newSourceEntry(sourcePath, APathEntry.NO_EXCLUSION_PATTERNS);
} }
/** /**
@ -467,7 +468,7 @@ public class CoreModel {
* @return IIncludeEntry * @return IIncludeEntry
*/ */
public static IIncludeEntry newIncludeEntry(IPath resourcePath, IPath basePath, IPath includePath, boolean isSystemInclude) { public static IIncludeEntry newIncludeEntry(IPath resourcePath, IPath basePath, IPath includePath, boolean isSystemInclude) {
return newIncludeEntry(resourcePath, basePath, includePath, isSystemInclude, IncludeEntry.NO_EXCLUSION_PATTERNS); return newIncludeEntry(resourcePath, basePath, includePath, isSystemInclude, APathEntry.NO_EXCLUSION_PATTERNS);
} }
/** /**
@ -540,7 +541,7 @@ public class CoreModel {
* @return * @return
*/ */
public static IMacroEntry newMacroEntry(IPath resourcePath, String macroName, String macroValue) { public static IMacroEntry newMacroEntry(IPath resourcePath, String macroName, String macroValue) {
return newMacroEntry(resourcePath, macroName, macroValue, MacroEntry.NO_EXCLUSION_PATTERNS); return newMacroEntry(resourcePath, macroName, macroValue, APathEntry.NO_EXCLUSION_PATTERNS);
} }
/** /**
@ -589,7 +590,7 @@ public class CoreModel {
* @return * @return
*/ */
public static IMacroEntry newMacroRefEntry(IPath resourcePath, IPath baseRef, String macroName) { public static IMacroEntry newMacroRefEntry(IPath resourcePath, IPath baseRef, String macroName) {
return new MacroEntry(resourcePath, baseRef, macroName, null, MacroEntry.NO_EXCLUSION_PATTERNS, false); return new MacroEntry(resourcePath, baseRef, macroName, null, APathEntry.NO_EXCLUSION_PATTERNS, false);
} }
/** /**

View file

@ -23,7 +23,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
public class ArchiveContainer extends Openable implements IArchiveContainer { public class ArchiveContainer extends Openable implements IArchiveContainer {
public ArchiveContainer (CProject cProject) { public ArchiveContainer (CProject cProject) {
super (cProject, null, CCorePlugin.getResourceString("CoreModel.ArchiveContainer.Archives"), CElement.C_VCONTAINER); //$NON-NLS-1$ super (cProject, null, CCorePlugin.getResourceString("CoreModel.ArchiveContainer.Archives"), ICElement.C_VCONTAINER); //$NON-NLS-1$
} }
public IArchive[] getArchives() throws CModelException { public IArchive[] getArchives() throws CModelException {

View file

@ -35,7 +35,7 @@ public class BatchOperation extends CModelOperation {
} catch (CoreException ce) { } catch (CoreException ce) {
if (ce instanceof CModelException) { if (ce instanceof CModelException) {
throw (CModelException)ce; throw (CModelException)ce;
} else { }
if (ce.getStatus().getCode() == IResourceStatus.OPERATION_FAILED) { if (ce.getStatus().getCode() == IResourceStatus.OPERATION_FAILED) {
Throwable e= ce.getStatus().getException(); Throwable e= ce.getStatus().getException();
if (e instanceof CModelException) { if (e instanceof CModelException) {
@ -45,7 +45,6 @@ public class BatchOperation extends CModelOperation {
throw new CModelException(ce); throw new CModelException(ce);
} }
} }
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.jdt.internal.core.JavaModelOperation#verify() * @see org.eclipse.jdt.internal.core.JavaModelOperation#verify()

View file

@ -24,7 +24,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
public class BinaryContainer extends Openable implements IBinaryContainer { public class BinaryContainer extends Openable implements IBinaryContainer {
public BinaryContainer (CProject cProject) { public BinaryContainer (CProject cProject) {
super (cProject, null, CCorePlugin.getResourceString("CoreModel.BinaryContainer.Binaries"), CElement.C_VCONTAINER); //$NON-NLS-1$ super (cProject, null, CCorePlugin.getResourceString("CoreModel.BinaryContainer.Binaries"), ICElement.C_VCONTAINER); //$NON-NLS-1$
} }
public IBinary[] getBinaries() throws CModelException { public IBinary[] getBinaries() throws CModelException {

View file

@ -214,9 +214,8 @@ public class Buffer implements IBuffer {
public boolean isReadOnly() { public boolean isReadOnly() {
if (this.file == null) { if (this.file == null) {
return (this.flags & F_IS_READ_ONLY) != 0; return (this.flags & F_IS_READ_ONLY) != 0;
} else {
return this.file.isReadOnly();
} }
return this.file.isReadOnly();
} }
/** /**

View file

@ -56,11 +56,10 @@ public class BufferManager implements IBufferFactory {
IBuffer buffer= (IBuffer) entry._fValue; IBuffer buffer= (IBuffer) entry._fValue;
if (buffer.hasUnsavedChanges()) { if (buffer.hasUnsavedChanges()) {
return false; return false;
} else { }
buffer.close(); buffer.close();
return true; return true;
} }
}
/** /**
* Returns a new instance of the reciever. * Returns a new instance of the reciever.
*/ */

View file

@ -83,13 +83,12 @@ public class CContainerInfo extends OpenableInfo {
if (CoreModel.isValidTranslationUnitName(cproject.getProject(), filename) && if (CoreModel.isValidTranslationUnitName(cproject.getProject(), filename) &&
root.isOnSourceEntry(member)) { root.isOnSourceEntry(member)) {
continue; continue;
} else { }
if (root.isOnSourceEntry(member)) { if (root.isOnSourceEntry(member)) {
if (CModelManager.getDefault().createBinaryFile((IFile)member) != null) { if (CModelManager.getDefault().createBinaryFile((IFile)member) != null) {
continue; continue;
} }
} }
}
break; break;
} }
} }

View file

@ -20,6 +20,7 @@ import org.eclipse.cdt.core.model.IOpenable;
import org.eclipse.cdt.core.model.IParent; import org.eclipse.cdt.core.model.IParent;
import org.eclipse.cdt.core.model.ISourceRange; import org.eclipse.cdt.core.model.ISourceRange;
import org.eclipse.cdt.core.model.ISourceReference; import org.eclipse.cdt.core.model.ISourceReference;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
@ -290,12 +291,12 @@ public abstract class CElement extends PlatformObject implements ICElement {
} }
public String toDebugString() { public String toDebugString() {
return getElementName() + " " + getTypeString(getElementType()); //$NON-NLS-1$ return getElementName() + " " + getTypeString(); //$NON-NLS-1$
} }
// util // util
public static String getTypeString(int type) { public String getTypeString() {
switch (type) { switch (getElementType()) {
case C_MODEL: case C_MODEL:
return "CMODEL"; //$NON-NLS-1$ return "CMODEL"; //$NON-NLS-1$
case C_PROJECT: case C_PROJECT:
@ -303,6 +304,9 @@ public abstract class CElement extends PlatformObject implements ICElement {
case C_CCONTAINER: case C_CCONTAINER:
return "CCONTAINER"; //$NON-NLS-1$ return "CCONTAINER"; //$NON-NLS-1$
case C_UNIT: case C_UNIT:
if (this instanceof IWorkingCopy) {
return "WORKING_UNIT"; //$NON-NLS-1$
}
return "TRANSLATION_UNIT"; //$NON-NLS-1$ return "TRANSLATION_UNIT"; //$NON-NLS-1$
case C_FUNCTION: case C_FUNCTION:
return "C_FUNCTION"; //$NON-NLS-1$ return "C_FUNCTION"; //$NON-NLS-1$

View file

@ -270,15 +270,15 @@ private void insertPositions(ICElement[] elements, boolean isNew) {
* none of the internal calls need to use the locally cached contents * none of the internal calls need to use the locally cached contents
* of the old translation unit. * of the old translation unit.
*/ */
private boolean isIdentical(CElement e1, CElement e2) { //private boolean isIdentical(CElement e1, CElement e2) {
if (e1 == null ^ e2 == null) // if (e1 == null ^ e2 == null)
return false; // return false;
//
if (e1 == null) // if (e1 == null)
return true; // return true;
//
return e1.isIdentical(e2); // return e1.isIdentical(e2);
} //}
/** /**
* Answers true if the elements position has not changed. * Answers true if the elements position has not changed.
* Takes into account additions so that elements following * Takes into account additions so that elements following
@ -296,9 +296,8 @@ private boolean isPositionedCorrectly(ICElement element) {
if (oldPrevious == null) { if (oldPrevious == null) {
return newPrevious == null; return newPrevious == null;
} else {
return oldPrevious.equals(newPrevious);
} }
return oldPrevious.equals(newPrevious);
} }
private void putElementInfo(ICElement element, CElementInfo info) { private void putElementInfo(ICElement element, CElementInfo info) {
this.infos.put(element, info); this.infos.put(element, info);

View file

@ -64,7 +64,7 @@ import org.eclipse.core.runtime.Platform;
public class CModelManager implements IResourceChangeListener, ICDescriptorListener, IResolverChangeListener { public class CModelManager implements IResourceChangeListener, ICDescriptorListener, IResolverChangeListener {
public static boolean VERBOSE = false; public static boolean VERBOSE = true;
/** /**
* Unique handle onto the CModel * Unique handle onto the CModel

View file

@ -336,7 +336,7 @@ public abstract class CModelOperation implements IWorkspaceRunnable, IProgressMo
} catch (CoreException ce) { } catch (CoreException ce) {
if (ce instanceof CModelException) { if (ce instanceof CModelException) {
throw (CModelException)ce; throw (CModelException)ce;
} else { }
// translate the core exception to a c model exception // translate the core exception to a c model exception
if (ce.getStatus().getCode() == IResourceStatus.OPERATION_FAILED) { if (ce.getStatus().getCode() == IResourceStatus.OPERATION_FAILED) {
Throwable e = ce.getStatus().getException(); Throwable e = ce.getStatus().getException();
@ -347,7 +347,6 @@ public abstract class CModelOperation implements IWorkspaceRunnable, IProgressMo
throw new CModelException(ce); throw new CModelException(ce);
} }
} }
}
/** /**
* Performs the operation specific behavior. Subclasses must override. * Performs the operation specific behavior. Subclasses must override.
@ -379,9 +378,8 @@ public abstract class CModelOperation implements IWorkspaceRunnable, IProgressMo
public ICModel getCModel() { public ICModel getCModel() {
if (fElementsToProcess == null || fElementsToProcess.length == 0) { if (fElementsToProcess == null || fElementsToProcess.length == 0) {
return getParentElement().getCModel(); return getParentElement().getCModel();
} else {
return fElementsToProcess[0].getCModel();
} }
return fElementsToProcess[0].getCModel();
} }
/** /**

View file

@ -62,9 +62,8 @@ public class CommitWorkingCopyOperation extends CModelOperation {
IWorkspace workspace = resource.getWorkspace(); IWorkspace workspace = resource.getWorkspace();
if (resource.exists()) { if (resource.exists()) {
return workspace.getRuleFactory().modifyRule(resource); return workspace.getRuleFactory().modifyRule(resource);
} else {
return workspace.getRuleFactory().createRule(resource);
} }
return workspace.getRuleFactory().createRule(resource);
} }
/** /**

View file

@ -11,12 +11,13 @@
package org.eclipse.cdt.internal.core.model; package org.eclipse.cdt.internal.core.model;
import org.eclipse.cdt.core.model.IContainerEntry; import org.eclipse.cdt.core.model.IContainerEntry;
import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
public class ContainerEntry extends PathEntry implements IContainerEntry { public class ContainerEntry extends PathEntry implements IContainerEntry {
public ContainerEntry(IPath path, boolean isExported) { public ContainerEntry(IPath path, boolean isExported) {
super(IContainerEntry.CDT_CONTAINER, path, isExported); super(IPathEntry.CDT_CONTAINER, path, isExported);
} }
public boolean equals(Object obj) { public boolean equals(Object obj) {

View file

@ -194,9 +194,9 @@ public class DefaultPathEntryStore implements IPathEntryStore, ICDescriptorListe
if (projSegment != null && projSegment.equals(project.getName())) { // this if (projSegment != null && projSegment.equals(project.getName())) { // this
// project // project
return CoreModel.newSourceEntry(path, exclusionPatterns); return CoreModel.newSourceEntry(path, exclusionPatterns);
} else { // another project
return CoreModel.newProjectEntry(path, isExported);
} }
// another project
return CoreModel.newProjectEntry(path, isExported);
} }
case IPathEntry.CDT_OUTPUT : case IPathEntry.CDT_OUTPUT :
return CoreModel.newOutputEntry(path, exclusionPatterns); return CoreModel.newOutputEntry(path, exclusionPatterns);

View file

@ -8,6 +8,7 @@ package org.eclipse.cdt.internal.core.model;
import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICModelStatusConstants;
/** /**
* This operation deletes a collection of resources and all of their children. * This operation deletes a collection of resources and all of their children.
@ -44,6 +45,6 @@ public class DeleteResourceElementsOperation extends MultiOperation {
*/ */
protected void verify(ICElement element) throws CModelException { protected void verify(ICElement element) throws CModelException {
if (element == null || !element.exists()) if (element == null || !element.exists())
error(CModelStatus.ELEMENT_DOES_NOT_EXIST, element); error(ICModelStatusConstants.ELEMENT_DOES_NOT_EXIST, element);
} }
} }

View file

@ -47,17 +47,9 @@ public class ElementCache extends OverflowingLRUCache {
try { try {
if (element.hasUnsavedChanges()) { if (element.hasUnsavedChanges()) {
return false; return false;
} /*else {
// We must close an entire JarPackageFragmentRoot at once.
if (element instanceof JarPackageFragment) {
JarPackageFragment packageFragment= (JarPackageFragment) element;
JarPackageFragmentRoot root = (JarPackageFragmentRoot) packageFragment.getParent();
root.close();
}*/ else {
element.close();
} }
element.close();
return true; return true;
// }
} catch (CModelException npe) { } catch (CModelException npe) {
return false; return false;
} }

View file

@ -18,7 +18,7 @@ import org.eclipse.cdt.core.model.IEnumeration;
public class Enumeration extends SourceManipulation implements IEnumeration{ public class Enumeration extends SourceManipulation implements IEnumeration{
public Enumeration(ICElement parent, String name) { public Enumeration(ICElement parent, String name) {
super(parent, name, CElement.C_ENUMERATION); super(parent, name, ICElement.C_ENUMERATION);
} }
protected CElementInfo createElementInfo () { protected CElementInfo createElementInfo () {

View file

@ -18,7 +18,7 @@ public class Enumerator extends SourceManipulation implements IEnumerator{
String constantExpression = ""; //$NON-NLS-1$ String constantExpression = ""; //$NON-NLS-1$
public Enumerator(ICElement parent, String name) { public Enumerator(ICElement parent, String name) {
super(parent, name, CElement.C_ENUMERATOR); super(parent, name, ICElement.C_ENUMERATOR);
} }
protected CElementInfo createElementInfo () { protected CElementInfo createElementInfo () {

View file

@ -19,7 +19,7 @@ import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
public class Field extends VariableDeclaration implements IField { public class Field extends VariableDeclaration implements IField {
public Field(ICElement parent, String name) { public Field(ICElement parent, String name) {
super(parent, name, CElement.C_FIELD); super(parent, name, ICElement.C_FIELD);
} }
public boolean isMutable() throws CModelException{ public boolean isMutable() throws CModelException{

View file

@ -11,6 +11,6 @@ import org.eclipse.cdt.core.model.IFunction;
public class Function extends FunctionDeclaration implements IFunction { public class Function extends FunctionDeclaration implements IFunction {
public Function(ICElement parent, String name) { public Function(ICElement parent, String name) {
super(parent, name, CElement.C_FUNCTION); super(parent, name, ICElement.C_FUNCTION);
} }
} }

View file

@ -18,7 +18,7 @@ public class FunctionDeclaration extends SourceManipulation implements IFunction
protected String returnType; protected String returnType;
public FunctionDeclaration(ICElement parent, String name) { public FunctionDeclaration(ICElement parent, String name) {
super(parent, name, CElement.C_FUNCTION_DECLARATION); super(parent, name, ICElement.C_FUNCTION_DECLARATION);
fParameterTypes= fgEmptyList; fParameterTypes= fgEmptyList;
} }
@ -28,9 +28,9 @@ public class FunctionDeclaration extends SourceManipulation implements IFunction
} }
public String getReturnType(){ public String getReturnType(){
if (returnType != null) if (returnType != null) {
return returnType; return returnType;
else }
return ""; //$NON-NLS-1$ return ""; //$NON-NLS-1$
} }

View file

@ -21,7 +21,7 @@ public class FunctionTemplate extends FunctionDeclaration implements ITemplate{
protected String[] templateParameterTypes; protected String[] templateParameterTypes;
public FunctionTemplate(ICElement parent, String name) { public FunctionTemplate(ICElement parent, String name) {
super(parent, name, CElement.C_TEMPLATE_FUNCTION); super(parent, name, ICElement.C_TEMPLATE_FUNCTION);
templateParameterTypes= fgEmptyList; templateParameterTypes= fgEmptyList;
} }

View file

@ -14,7 +14,7 @@ public class Include extends SourceManipulation implements IInclude {
private String fullPath; private String fullPath;
public Include(ICElement parent, String name, boolean isStandard) { public Include(ICElement parent, String name, boolean isStandard) {
super(parent, name, CElement.C_INCLUDE); super(parent, name, ICElement.C_INCLUDE);
standard = isStandard; standard = isStandard;
} }

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.internal.core.model; package org.eclipse.cdt.internal.core.model;
import org.eclipse.cdt.core.model.IIncludeEntry; import org.eclipse.cdt.core.model.IIncludeEntry;
import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
@ -22,7 +23,7 @@ public class IncludeEntry extends APathEntry implements IIncludeEntry {
public IncludeEntry(IPath resourcePath, IPath basePath, IPath baseRef, IPath includePath, boolean isSystemInclude, public IncludeEntry(IPath resourcePath, IPath basePath, IPath baseRef, IPath includePath, boolean isSystemInclude,
IPath[] exclusionPatterns, boolean isExported) { IPath[] exclusionPatterns, boolean isExported) {
super(IIncludeEntry.CDT_INCLUDE, basePath, baseRef, resourcePath, exclusionPatterns, isExported); super(IPathEntry.CDT_INCLUDE, basePath, baseRef, resourcePath, exclusionPatterns, isExported);
this.includePath = (includePath == null) ? Path.EMPTY : includePath; this.includePath = (includePath == null) ? Path.EMPTY : includePath;
this.isSystemInclude = isSystemInclude; this.isSystemInclude = isSystemInclude;
} }

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.internal.core.model; package org.eclipse.cdt.internal.core.model;
import org.eclipse.cdt.core.model.ILibraryEntry; import org.eclipse.cdt.core.model.ILibraryEntry;
import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
@ -35,7 +36,7 @@ public class LibraryEntry extends APathEntry implements ILibraryEntry {
*/ */
public LibraryEntry(IPath resourcePath, IPath basePath, IPath baseRef, IPath libraryPath, IPath sourceAttachmentPath, public LibraryEntry(IPath resourcePath, IPath basePath, IPath baseRef, IPath libraryPath, IPath sourceAttachmentPath,
IPath sourceAttachmentRootPath, IPath sourceAttachmentPrefixMapping, boolean isExported) { IPath sourceAttachmentRootPath, IPath sourceAttachmentPrefixMapping, boolean isExported) {
super(ILibraryEntry.CDT_LIBRARY, basePath, baseRef, resourcePath, APathEntry.NO_EXCLUSION_PATTERNS, isExported); super(IPathEntry.CDT_LIBRARY, basePath, baseRef, resourcePath, APathEntry.NO_EXCLUSION_PATTERNS, isExported);
this.libraryPath = (libraryPath == null) ? Path.EMPTY : libraryPath; this.libraryPath = (libraryPath == null) ? Path.EMPTY : libraryPath;
this.sourceAttachmentPath = sourceAttachmentPath; this.sourceAttachmentPath = sourceAttachmentPath;
this.sourceAttachmentRootPath = sourceAttachmentRootPath; this.sourceAttachmentRootPath = sourceAttachmentRootPath;
@ -144,9 +145,9 @@ public class LibraryEntry extends APathEntry implements ILibraryEntry {
} }
p = loc.append(lib); p = loc.append(lib);
return p; return p;
} else {
p = lib;
} }
p = lib;
if (!p.isAbsolute()) { if (!p.isAbsolute()) {
IPath resPath = getPath(); IPath resPath = getPath();
IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(resPath); IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(resPath);

View file

@ -11,7 +11,7 @@ import org.eclipse.cdt.core.model.IMacro;
public class Macro extends SourceManipulation implements IMacro { public class Macro extends SourceManipulation implements IMacro {
public Macro(ICElement parent, String name) { public Macro(ICElement parent, String name) {
super(parent, name, CElement.C_MACRO); super(parent, name, ICElement.C_MACRO);
} }
public String getIdentifierList() { public String getIdentifierList() {

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.internal.core.model; package org.eclipse.cdt.internal.core.model;
import org.eclipse.cdt.core.model.IMacroEntry; import org.eclipse.cdt.core.model.IMacroEntry;
import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
public class MacroEntry extends APathEntry implements IMacroEntry { public class MacroEntry extends APathEntry implements IMacroEntry {
@ -19,7 +20,7 @@ public class MacroEntry extends APathEntry implements IMacroEntry {
String macroValue; String macroValue;
public MacroEntry (IPath path, IPath baseRef, String macroName, String macroValue, IPath[] exclusionPatterns, boolean isExported) { public MacroEntry (IPath path, IPath baseRef, String macroName, String macroValue, IPath[] exclusionPatterns, boolean isExported) {
super(IMacroEntry.CDT_MACRO, null, baseRef, path, exclusionPatterns, isExported); super(IPathEntry.CDT_MACRO, null, baseRef, path, exclusionPatterns, isExported);
if ( macroName == null) { if ( macroName == null) {
throw new IllegalArgumentException("Macro name cannot be null"); //$NON-NLS-1$ throw new IllegalArgumentException("Macro name cannot be null"); //$NON-NLS-1$
} }

View file

@ -11,6 +11,6 @@ import org.eclipse.cdt.core.model.IMethod;
public class Method extends MethodDeclaration implements IMethod{ public class Method extends MethodDeclaration implements IMethod{
public Method(ICElement parent, String name){ public Method(ICElement parent, String name){
super(parent, name, CElement.C_METHOD); super(parent, name, ICElement.C_METHOD);
} }
} }

View file

@ -23,7 +23,7 @@ public class MethodDeclaration extends FunctionDeclaration implements IMethodDec
boolean isDestructor = false; boolean isDestructor = false;
public MethodDeclaration(ICElement parent, String name){ public MethodDeclaration(ICElement parent, String name){
super(parent, name, CElement.C_METHOD_DECLARATION); super(parent, name, ICElement.C_METHOD_DECLARATION);
} }
public MethodDeclaration(ICElement parent, String name, int type){ public MethodDeclaration(ICElement parent, String name, int type){

View file

@ -21,7 +21,7 @@ public class MethodTemplate extends MethodDeclaration implements ITemplate{
protected String[] templateParameterTypes; protected String[] templateParameterTypes;
public MethodTemplate(ICElement parent, String name) { public MethodTemplate(ICElement parent, String name) {
super(parent, name, CElement.C_TEMPLATE_METHOD); super(parent, name, ICElement.C_TEMPLATE_METHOD);
templateParameterTypes= fgEmptyList; templateParameterTypes= fgEmptyList;
} }

View file

@ -117,9 +117,9 @@ public abstract class MultiOperation extends CModelOperation {
* if there are no renamings specified. * if there are no renamings specified.
*/ */
protected String getNewNameFor(ICElement element) { protected String getNewNameFor(ICElement element) {
if (fRenamings != null) if (fRenamings != null) {
return (String) fRenamings.get(element); return (String) fRenamings.get(element);
else }
return null; return null;
} }

View file

@ -11,7 +11,6 @@ package org.eclipse.cdt.internal.core.model;
* Rational Software - Initial API and implementation * Rational Software - Initial API and implementation
***********************************************************************/ ***********************************************************************/
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.INamespace; import org.eclipse.cdt.core.model.INamespace;
@ -19,7 +18,7 @@ public class Namespace extends SourceManipulation implements INamespace{
String typeName = ""; //$NON-NLS-1$ String typeName = ""; //$NON-NLS-1$
public Namespace(ICElement parent, String name) { public Namespace(ICElement parent, String name) {
super(parent, name, CElement.C_NAMESPACE); super(parent, name, ICElement.C_NAMESPACE);
} }
/* /*

View file

@ -41,6 +41,7 @@ import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.core.model.IPathEntryContainer; import org.eclipse.cdt.core.model.IPathEntryContainer;
import org.eclipse.cdt.core.model.IProjectEntry; import org.eclipse.cdt.core.model.IProjectEntry;
import org.eclipse.cdt.core.model.ISourceEntry; import org.eclipse.cdt.core.model.ISourceEntry;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.core.model.PathEntryContainerInitializer; import org.eclipse.cdt.core.model.PathEntryContainerInitializer;
import org.eclipse.cdt.core.resources.IPathEntryStore; import org.eclipse.cdt.core.resources.IPathEntryStore;
import org.eclipse.cdt.core.resources.IPathEntryStoreListener; import org.eclipse.cdt.core.resources.IPathEntryStoreListener;
@ -1209,15 +1210,21 @@ public class PathEntryManager implements IPathEntryStoreListener, IElementChange
return true; return true;
} }
// project change, traverse children. // project change, traverse children.
} else if (kind == ICElementDelta.ADDED || kind == ICElementDelta.REMOVED) { }
if (element instanceof IWorkingCopy) {
return false;
}
if (kind == ICElementDelta.ADDED || kind == ICElementDelta.REMOVED) {
return true; // add/remove we validate all paths return true; // add/remove we validate all paths
} }
if (type == ICElement.C_MODEL || type == ICElement.C_CCONTAINER || type == ICElement.C_PROJECT) {
ICElementDelta[] affectedChildren = delta.getAffectedChildren(); ICElementDelta[] affectedChildren = delta.getAffectedChildren();
for (int i = 0; i < affectedChildren.length; i++) { for (int i = 0; i < affectedChildren.length; i++) {
if (processDelta(affectedChildren[i]) == true) { if (processDelta(affectedChildren[i]) == true) {
return true; return true;
} }
} }
}
return false; return false;
} }

View file

@ -10,6 +10,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.model; package org.eclipse.cdt.internal.core.model;
import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.core.model.IProjectEntry; import org.eclipse.cdt.core.model.IProjectEntry;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
@ -17,7 +18,7 @@ import org.eclipse.core.runtime.IPath;
public class ProjectEntry extends PathEntry implements IProjectEntry { public class ProjectEntry extends PathEntry implements IProjectEntry {
public ProjectEntry(IPath path, boolean isExported) { public ProjectEntry(IPath path, boolean isExported) {
super(IProjectEntry.CDT_PROJECT, path, isExported); super(IPathEntry.CDT_PROJECT, path, isExported);
} }
public boolean equals(Object obj) { public boolean equals(Object obj) {

View file

@ -10,6 +10,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.model; package org.eclipse.cdt.internal.core.model;
import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.core.model.ISourceEntry; import org.eclipse.cdt.core.model.ISourceEntry;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
@ -21,7 +22,7 @@ public class SourceEntry extends APathEntry implements ISourceEntry {
* @param exclusionPatterns * @param exclusionPatterns
*/ */
public SourceEntry(IPath sourcePath, IPath[] exclusionPatterns) { public SourceEntry(IPath sourcePath, IPath[] exclusionPatterns) {
super(ISourceEntry.CDT_SOURCE, null, null, sourcePath, exclusionPatterns, false); super(IPathEntry.CDT_SOURCE, null, null, sourcePath, exclusionPatterns, false);
} }
public boolean equals (Object obj) { public boolean equals (Object obj) {

View file

@ -18,7 +18,7 @@ public class TypeDef extends SourceManipulation implements ITypeDef{
String typeName= ""; //$NON-NLS-1$ String typeName= ""; //$NON-NLS-1$
public TypeDef(ICElement parent, String name) { public TypeDef(ICElement parent, String name) {
super(parent, name, CElement.C_TYPEDEF); super(parent, name, ICElement.C_TYPEDEF);
} }
/** /**
* Returns the typeName. * Returns the typeName.

View file

@ -19,7 +19,7 @@ public class Using extends SourceManipulation implements IUsing {
boolean directive; boolean directive;
public Using(ICElement parent, String name, boolean isDirective) { public Using(ICElement parent, String name, boolean isDirective) {
super(parent, name, CElement.C_USING); super(parent, name, ICElement.C_USING);
directive = isDirective; directive = isDirective;
} }

View file

@ -11,7 +11,7 @@ import org.eclipse.cdt.core.model.IVariable;
public class Variable extends VariableDeclaration implements IVariable { public class Variable extends VariableDeclaration implements IVariable {
public Variable(ICElement parent, String name) { public Variable(ICElement parent, String name) {
super(parent, name, CElement.C_VARIABLE); super(parent, name, ICElement.C_VARIABLE);
} }
public Variable(ICElement parent, String name, int kind) { public Variable(ICElement parent, String name, int kind) {

View file

@ -12,7 +12,7 @@ import org.eclipse.cdt.core.model.IVariableDeclaration;
public class VariableDeclaration extends SourceManipulation implements IVariableDeclaration { public class VariableDeclaration extends SourceManipulation implements IVariableDeclaration {
public VariableDeclaration(ICElement parent, String name) { public VariableDeclaration(ICElement parent, String name) {
super(parent, name, CElement.C_VARIABLE_DECLARATION); super(parent, name, ICElement.C_VARIABLE_DECLARATION);
} }
public VariableDeclaration(ICElement parent, String name, int type) { public VariableDeclaration(ICElement parent, String name, int type) {

View file

@ -19,7 +19,7 @@ public class VariableTemplate extends Variable implements ITemplate {
protected String[] templateParameterTypes; protected String[] templateParameterTypes;
public VariableTemplate(ICElement parent, String name) { public VariableTemplate(ICElement parent, String name) {
super(parent, name, CElement.C_TEMPLATE_VARIABLE); super(parent, name, ICElement.C_TEMPLATE_VARIABLE);
templateParameterTypes= fgEmptyList; templateParameterTypes= fgEmptyList;
} }

View file

@ -399,9 +399,8 @@ public class LRUCache implements Cloneable {
entry._fSpace = newSpace; entry._fSpace = newSpace;
this.fCurrentSpace = newTotal; this.fCurrentSpace = newTotal;
return value; return value;
} else {
privateRemoveEntry (entry, false);
} }
privateRemoveEntry (entry, false);
} }
if (makeSpace(newSpace)) { if (makeSpace(newSpace)) {
privateAdd (key, value, newSpace); privateAdd (key, value, newSpace);
@ -443,9 +442,8 @@ public class LRUCache implements Cloneable {
if (value instanceof ILRUCacheable) { if (value instanceof ILRUCacheable) {
return ((ILRUCacheable) value).getCacheFootprint(); return ((ILRUCacheable) value).getCacheFootprint();
} else {
return 1;
} }
return 1;
} }
/** /**
* Returns a String that represents the value of this object. This method * Returns a String that represents the value of this object. This method

View file

@ -290,14 +290,13 @@ public abstract class OverflowingLRUCache extends LRUCache {
// thus entry will already be removed if reaching this point. // thus entry will already be removed if reaching this point.
if (fEntryTable.get(entry._fKey) == null){ if (fEntryTable.get(entry._fKey) == null){
return; return;
} else { }
// basic removal // basic removal
fEntryTable.remove(entry._fKey); fEntryTable.remove(entry._fKey);
fCurrentSpace -= entry._fSpace; fCurrentSpace -= entry._fSpace;
privateNotifyDeletionFromCache(entry); privateNotifyDeletionFromCache(entry);
} }
} }
}
LRUCacheEntry previous = entry._fPrevious; LRUCacheEntry previous = entry._fPrevious;
LRUCacheEntry next = entry._fNext; LRUCacheEntry next = entry._fNext;
@ -346,9 +345,8 @@ public abstract class OverflowingLRUCache extends LRUCache {
fCurrentSpace = newTotal; fCurrentSpace = newTotal;
fOverflow = 0; fOverflow = 0;
return value; return value;
} else {
privateRemoveEntry (entry, false, false);
} }
privateRemoveEntry (entry, false, false);
} }
// attempt to make new space // attempt to make new space