public abstract class CompletionContext extends java.lang.Object implements ICompletionContext
Modifier and Type | Class and Description |
---|---|
static class |
CompletionContext.Bracket |
ICompletionContext.Type
Constructor and Description |
---|
CompletionContext(IScriptEngine scriptEngine,
ScriptType scriptType)
Context constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
calculateContext(java.lang.Object resource,
java.lang.String code,
int offset,
int selectionRange)
Calculate a context over a given code fragment.
|
java.lang.String |
getCaller()
Get the caller method for string literals.
|
java.lang.String |
getFilter() |
java.util.Map<java.lang.Object,java.lang.String> |
getIncludedResources()
Get a list of included resource.
|
java.util.Collection<ModuleDefinition> |
getLoadedModules()
Get a list of loaded modules.
|
int |
getOffset() |
java.lang.String |
getOriginalCode() |
java.lang.String |
getPackage()
Returns the package for PACKAGE types.
|
int |
getParameterOffset()
Get the index of the parameter for string literals.
|
java.lang.String |
getProcessedCode() |
java.lang.Class<? extends java.lang.Object> |
getReferredClazz() |
java.lang.Object |
getResource()
Get the base resource of the context.
|
IScriptEngine |
getScriptEngine()
Get the running script engine.
|
ScriptType |
getScriptType() |
int |
getSelectionRange() |
ICompletionContext.Type |
getType() |
java.lang.String |
replaceStringLiterals(java.lang.String code)
Remove all string literal content and keep empty literals.
|
public CompletionContext(IScriptEngine scriptEngine, ScriptType scriptType)
scriptEngine
- script engine to evaluatescriptType
- script type to evaluatepublic ICompletionContext.Type getType()
getType
in interface ICompletionContext
public java.lang.Class<? extends java.lang.Object> getReferredClazz()
getReferredClazz
in interface ICompletionContext
public void calculateContext(java.lang.Object resource, java.lang.String code, int offset, int selectionRange)
resource
- base resource (eg. edited file)code
- code fragment to evaluateoffset
- the offset within the provided document (usually code.length())selectionRange
- amount of selected characterspublic java.lang.String replaceStringLiterals(java.lang.String code)
code
- code fragment to parsepublic java.lang.String getOriginalCode()
getOriginalCode
in interface ICompletionContext
public java.lang.String getProcessedCode()
getProcessedCode
in interface ICompletionContext
public java.lang.Object getResource()
ICompletionContext
getResource
in interface ICompletionContext
null
public IScriptEngine getScriptEngine()
ICompletionContext
getScriptEngine
in interface ICompletionContext
null
public ScriptType getScriptType()
getScriptType
in interface ICompletionContext
public java.util.Collection<ModuleDefinition> getLoadedModules()
ICompletionContext
getLoadedModules
in interface ICompletionContext
public java.util.Map<java.lang.Object,java.lang.String> getIncludedResources()
ICompletionContext
getIncludedResources
in interface ICompletionContext
public java.lang.String getFilter()
getFilter
in interface ICompletionContext
public int getOffset()
getOffset
in interface ICompletionContext
public int getSelectionRange()
getSelectionRange
in interface ICompletionContext
public java.lang.String getPackage()
ICompletionContext
getPackage
in interface ICompletionContext
public java.lang.String getCaller()
ICompletionContext
null
.getCaller
in interface ICompletionContext
public int getParameterOffset()
ICompletionContext
getParameterOffset
in interface ICompletionContext