public class ProviderContext extends java.lang.Object implements ProviderConstants
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
CLASS_SUFFIX
The default suffix of a Java class file.
|
protected BaseFileProvider |
provider
Provider cookie used for new SourceFiles.
|
protected static java.lang.String |
SOURCE_SUFFIX
The default suffix of a Java source file.
|
CLASS_TYPE, EMPTY_COLLECTION, SOURCE_TYPE, UNKNOWN_TYPE
Constructor and Description |
---|
ProviderContext() |
Modifier and Type | Method and Description |
---|---|
void |
clearTracking()
Stops all tracking.
|
SourceFile |
createSourceFile(java.net.URL url,
int j2se)
Creates a new file at the given URL (*.java) and creates a
SourceFile object for it.
|
protected int |
getFileType(java.net.URL url) |
JavaFile |
getLightSourceFile(java.net.URL url,
int j2se)
Gets a new "light" SourceFile for the (existing) file at the given URL,
packaged as a JavaFile.
|
BaseFileProvider |
getProvider()
Get the provider.
|
protected SourceFile |
getSourceFile(TextBuffer textBuffer,
int j2se)
Creates a new SourceFile for the given TextBuffer.
|
SourceFile |
getSourceFile(java.net.URL url,
int j2se)
Gets a new SourceFile object for the (existing) file at the given
URL.
|
protected SourceFile |
getSourceFileImpl(java.net.URL url,
int j2se) |
protected SourcePreferences |
getSourcePreferences()
Gets the user-defined preferences.
|
protected TextBuffer |
getTextBuffer(java.net.URL url)
Reads the contents of the given URL into a new TextBuffer.
|
void |
setProvider(BaseFileProvider providerIn)
Sets the provider cookie that will be used for new SourceFile
instances and will also be notified when URLs have been
changed.
|
protected void |
startTracking(java.net.URL url)
Starts tracking changes made to the given URL.
|
boolean |
writeSourceFile(SourceFile file)
Called when SourceTransaction.commit() is called for the given
file.
|
protected static final java.lang.String CLASS_SUFFIX
protected static final java.lang.String SOURCE_SUFFIX
protected BaseFileProvider provider
public void setProvider(BaseFileProvider providerIn)
public BaseFileProvider getProvider()
protected int getFileType(java.net.URL url)
protected SourcePreferences getSourcePreferences()
public SourceFile createSourceFile(java.net.URL url, int j2se) throws java.io.IOException, java.lang.IllegalArgumentException
url
- 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) throws java.lang.IllegalArgumentException
url
- The source URL to create a new Java file for.java.lang.IllegalArgumentException
- if the URL is not recognized
as a Java source file.protected SourceFile getSourceFileImpl(java.net.URL url, int j2se) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public JavaFile getLightSourceFile(java.net.URL url, int j2se) throws java.lang.IllegalArgumentException
url
- The source URL for which to create a "light" SourceFilejava.lang.IllegalArgumentException
- if the URL is not recognized
as a Java source file.public boolean writeSourceFile(SourceFile file)
protected final SourceFile getSourceFile(TextBuffer textBuffer, int j2se)
protected TextBuffer getTextBuffer(java.net.URL url) throws java.io.FileNotFoundException
java.io.FileNotFoundException
protected void startTracking(java.net.URL url)
BaseFileProvider.notifyOfChange(URL)
. public void clearTracking()