mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
Fix late coupling of CodeReaderCache.
Allow for cdtparser.jar to build w/out dependencies on cdtcore.jar.
This commit is contained in:
parent
c9fa81c5e6
commit
56f19f3711
4 changed files with 14 additions and 15 deletions
|
@ -6,12 +6,13 @@
|
|||
*
|
||||
* Contributors: Rational Software - Initial API and implementation
|
||||
******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser;
|
||||
package org.eclipse.cdt.internal.core.dom.parser;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.cdt.core.parser.CodeReader;
|
||||
import org.eclipse.cdt.core.parser.ICodeReaderCache;
|
||||
import org.eclipse.cdt.internal.core.parser.InternalParserUtil;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
|
||||
|
||||
/**
|
||||
* This is an empty implementation of the ICodeReaderCache interface. It is used to implement a
|
||||
|
@ -42,7 +43,7 @@ public class EmptyCodeReaderCache implements ICodeReaderCache {
|
|||
* @return
|
||||
*/
|
||||
public CodeReader createReader( String finalPath, Iterator workingCopies ) {
|
||||
return ParserUtil.createReader(finalPath, workingCopies);
|
||||
return InternalParserUtil.createFileReader(finalPath);
|
||||
}
|
||||
|
||||
/**
|
|
@ -12,9 +12,8 @@ package org.eclipse.cdt.internal.core.parser.scanner2;
|
|||
|
||||
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
||||
import org.eclipse.cdt.core.parser.CodeReader;
|
||||
import org.eclipse.cdt.core.parser.CodeReaderCache;
|
||||
import org.eclipse.cdt.core.parser.EmptyCodeReaderCache;
|
||||
import org.eclipse.cdt.core.parser.ICodeReaderCache;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.EmptyCodeReaderCache;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
import org.eclipse.cdt.internal.core.parser.InternalParserUtil;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
|
||||
import org.eclipse.cdt.internal.core.util.ILRUCacheable;
|
||||
import org.eclipse.cdt.internal.core.util.LRUCache;
|
||||
|
@ -51,7 +50,7 @@ public class CodeReaderCache implements ICodeReaderCache {
|
|||
private CodeReaderLRUCache cache = null; // the actual cache
|
||||
|
||||
private class UpdateCodeReaderCacheListener implements IResourceChangeListener {
|
||||
ICodeReaderCache cache = null;
|
||||
ICodeReaderCache c = null;
|
||||
|
||||
/**
|
||||
* Create the UpdateCodeReaderCacheListener used to dispatch events to remove CodeReaders
|
||||
|
@ -59,12 +58,12 @@ public class CodeReaderCache implements ICodeReaderCache {
|
|||
* @param cache
|
||||
*/
|
||||
public UpdateCodeReaderCacheListener(ICodeReaderCache cache) {
|
||||
this.cache = cache;
|
||||
this.c = cache;
|
||||
}
|
||||
|
||||
private class RemoveCacheJob extends Job {
|
||||
private static final String REMOVE_CACHE = "Remove Cache"; //$NON-NLS-1$
|
||||
ICodeReaderCache cache = null;
|
||||
ICodeReaderCache cache1 = null;
|
||||
IResourceChangeEvent event = null;
|
||||
|
||||
/**
|
||||
|
@ -75,7 +74,7 @@ public class CodeReaderCache implements ICodeReaderCache {
|
|||
*/
|
||||
public RemoveCacheJob(ICodeReaderCache cache, IResourceChangeEvent event) {
|
||||
super(REMOVE_CACHE);
|
||||
this.cache = cache;
|
||||
this.cache1 = cache;
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
|
@ -96,8 +95,8 @@ public class CodeReaderCache implements ICodeReaderCache {
|
|||
}
|
||||
}
|
||||
|
||||
if (key != null && cache != null)
|
||||
cache.remove(key);
|
||||
if (key != null && cache1 != null)
|
||||
cache1.remove(key);
|
||||
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
@ -108,8 +107,8 @@ public class CodeReaderCache implements ICodeReaderCache {
|
|||
* Identifies when a resource was chaned and schedules a new RemoveCacheJob.
|
||||
*/
|
||||
public void resourceChanged(IResourceChangeEvent event) {
|
||||
if (cache instanceof CodeReaderCache)
|
||||
new RemoveCacheJob(cache, event).schedule();
|
||||
if (c instanceof CodeReaderCache)
|
||||
new RemoveCacheJob(c, event).schedule();
|
||||
}
|
||||
}
|
||||
|
|
@ -17,8 +17,8 @@ import org.eclipse.cdt.core.browser.IWorkingCopyProvider;
|
|||
import org.eclipse.cdt.core.dom.CDOM;
|
||||
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
||||
import org.eclipse.cdt.core.parser.CodeReader;
|
||||
import org.eclipse.cdt.core.parser.EmptyCodeReaderCache;
|
||||
import org.eclipse.cdt.core.parser.ICodeReaderCache;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.EmptyCodeReaderCache;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.EmptyIterator;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue