com.intellij.openapi.compiler
Interface CompileContext

All Superinterfaces:
UserDataHolder
All Known Implementing Classes:
DummyCompileContext

public interface CompileContext
extends UserDataHolder

An interface allowing access and modification of the data associated with the current compile session.


Method Summary
 void addMessage(CompilerMessageCategory category, java.lang.String message, java.lang.String url, int lineNum, int columnNum)
          Allows to add a message to be shown in Compiler message view.
 VirtualFile[] getAllOutputDirectories()
          Returns the list of all output directories.
 CompileScope getCompileScope()
          Returns the current compile scope.
 int getMessageCount(CompilerMessageCategory category)
          Returns the count of messages of the specified category added during the current compile session.
 CompilerMessage[] getMessages(CompilerMessageCategory category)
          Returns all messages of the specified category added during the current compile session.
 Module getModuleByFile(VirtualFile file)
          Returns the module to which the specified file belongs.
 VirtualFile getModuleOutputDirectory(Module module)
          Returns the output directory for the specified module.
 VirtualFile getModuleOutputDirectoryForTests(Module module)
          Returns the test output directory for the specified module.
 ProgressIndicator getProgressIndicator()
          Returns the progress indicator of the compilation process.
 CompileScope getProjectCompileScope()
          Returns the compile scope which would be used if the entire project was rebuilt.
 VirtualFile[] getSourceRoots(Module module)
          Returns the source roots for the specified module.
 boolean isMake()
          Checks if the compilation is incremental, i.e. triggered by one of "Make" actions.
 void requestRebuildNextTime(java.lang.String message)
          A compiler may call this method in order to request complete project rebuild.
 
Methods inherited from interface com.intellij.openapi.util.UserDataHolder
getUserData, putUserData
 

Method Detail

addMessage

void addMessage(CompilerMessageCategory category,
                java.lang.String message,
                @Nullable
                java.lang.String url,
                int lineNum,
                int columnNum)
Allows to add a message to be shown in Compiler message view. If correct url, line and column numbers are supplied, the navigation to the specified file is available from the view.

Parameters:
category - the category of a message (information, error, warning).
message - the text of the message.
url - a url to the file to which the message applies, null if not available.
lineNum - a line number, -1 if not available.
columnNum - a columnt number, -1 if not available.

getMessages

CompilerMessage[] getMessages(CompilerMessageCategory category)
Returns all messages of the specified category added during the current compile session.

Parameters:
category - the category for which messages are requested.
Returns:
all compiler messages of the specified category

getMessageCount

int getMessageCount(CompilerMessageCategory category)
Returns the count of messages of the specified category added during the current compile session.

Parameters:
category - the category for which messages are requested.
Returns:
the number of messages of the specified category

getProgressIndicator

ProgressIndicator getProgressIndicator()
Returns the progress indicator of the compilation process.

Returns:
the progress indicator instance.

getCompileScope

CompileScope getCompileScope()
Returns the current compile scope.

Returns:
current compile scope

getProjectCompileScope

CompileScope getProjectCompileScope()
Returns the compile scope which would be used if the entire project was rebuilt. getCompileScope() may return the scope, that is more narrow than ProjectCompileScope.

Returns:
project-wide compile scope.

requestRebuildNextTime

void requestRebuildNextTime(java.lang.String message)
A compiler may call this method in order to request complete project rebuild. This may be necessary, for example, when compiler caches are corrupted.


getModuleByFile

Module getModuleByFile(VirtualFile file)
Returns the module to which the specified file belongs. This method is aware of the file->module mapping for generated files.

Parameters:
file - the file to check.
Returns:
the module to which the file belongs

getSourceRoots

VirtualFile[] getSourceRoots(Module module)
Returns the source roots for the specified module.

Returns:
module's source roots as well as source roots for generated sources that are attributed to the module

getAllOutputDirectories

VirtualFile[] getAllOutputDirectories()
Returns the list of all output directories.

Returns:
a list of all configured output directories from all modules (including output directories for tests)

getModuleOutputDirectory

@Nullable
VirtualFile getModuleOutputDirectory(Module module)
Returns the output directory for the specified module.

Parameters:
module - the module to check.
Returns:
the output directory for the module specified, null if corresponding VirtualFile is not valid or directory not specified

getModuleOutputDirectoryForTests

@Nullable
VirtualFile getModuleOutputDirectoryForTests(Module module)
Returns the test output directory for the specified module.

Parameters:
module - the module to check.
Returns:
the tests output directory the module specified, null if corresponding VirtualFile is not valid. If in Paths settings output directory for tests is not configured explicitly, but the output path is present, the output path will be returned.

isMake

boolean isMake()
Checks if the compilation is incremental, i.e. triggered by one of "Make" actions.

Returns:
true if compilation is incremental.