public class JdevProviderContext extends ProviderContext
BaseFileProvider
is an abstract starting point for
an implementation of the JavaFileProvider
interface that relies
on a JavaClassLocator
instance for locating Java class and
source files. This implementation contains no caching.
Modifier and Type | Class and Description |
---|---|
protected class |
JdevProviderContext.NodeObserver
The NodeObserver attaches to nodes for which we have created
SourceFile instances for, and tracks the given node until
the node is closed, or renamed.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.net.URL,JdevProviderContext.NodeObserver> |
_urlToObserverMap
The set of URLs that we are currently tracking.
|
protected static java.lang.Class |
JAVACLASSNODE_CLASS
The JavaClassNode class instance
|
protected static java.lang.Class |
JAVASOURCENODE_CLASS
The JavaSourceNode class instance
|
CLASS_SUFFIX, provider, SOURCE_SUFFIX
CLASS_TYPE, EMPTY_COLLECTION, SOURCE_TYPE, UNKNOWN_TYPE
Constructor and Description |
---|
JdevProviderContext(boolean allowInMemoryIn) |
Modifier and Type | Method and Description |
---|---|
void |
clearTracking()
Utility routine to stop tracking all Nodes.
|
SourceFile |
createSourceFile(java.net.URL sourceURL,
int j2se)
Instead of directly interacting with the filesystem, use the
Ide's Node model.
|
protected int |
getFileType(java.net.URL url)
Use the recognizer to check for source files and class files.
|
SourceFile |
getSourceFile(java.net.URL url,
int j2se)
Gets a new SourceFile object for the (existing) file at the given
URL.
|
protected SourcePreferences |
getSourcePreferences()
Retrieve preferences options from the coding style manager.
|
protected TextBuffer |
getTextBuffer(java.net.URL url)
Fetch the TextBuffer for the given URL.
|
protected void |
startTracking(java.net.URL url)
Utility routine to start tracking the Node represented by the URL.
|
protected void |
stopTracking(java.net.URL url)
Utility routine to stop tracking the Node represented by the URL.
|
boolean |
writeSourceFile(SourceFile file)
Called when SourceTransaction.commit() is called for the given
file.
|
getLightSourceFile, getProvider, getSourceFile, getSourceFileImpl, setProvider
protected static final java.lang.Class JAVACLASSNODE_CLASS
protected static final java.lang.Class JAVASOURCENODE_CLASS
protected java.util.Map<java.net.URL,JdevProviderContext.NodeObserver> _urlToObserverMap
protected final int getFileType(java.net.URL url)
getFileType
in class ProviderContext
protected final SourcePreferences getSourcePreferences()
getSourcePreferences
in class ProviderContext
public SourceFile createSourceFile(java.net.URL sourceURL, int j2se) throws java.io.IOException, java.lang.IllegalArgumentException
createSourceFile
in class ProviderContext
sourceURL
- The source URL to create a new Java file for.java.io.IOException
- if the new file cannot be created.java.lang.IllegalArgumentException
- if the URL is not recognized
as a Java source file.public SourceFile getSourceFile(java.net.URL url, int j2se)
ProviderContext
getSourceFile
in class ProviderContext
url
- The source URL to create a new Java file for.public boolean writeSourceFile(SourceFile file)
ProviderContext
writeSourceFile
in class ProviderContext
protected TextBuffer getTextBuffer(java.net.URL url)
getTextBuffer
in class ProviderContext
protected void startTracking(java.net.URL url)
startTracking
in class ProviderContext
protected void stopTracking(java.net.URL url)
public void clearTracking()
clearTracking
in class ProviderContext