Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.5.0)

E13403-06


oracle.jdeveloper.compiler
Class JCompiler

java.lang.Object
  extended by oracle.ide.compiler.Compiler
      extended by oracle.jdeveloper.compiler.JCompiler

All Implemented Interfaces:
Addin, ShutdownHook

public final class JCompiler
extends Compiler
implements Addin, ShutdownHook

The JCompiler manages compiling.


Field Summary
static java.lang.String BUILD_PROJECT_AND_DEPENDENCIES_CMD
           
static int BUILD_PROJECT_AND_DEPENDENCIES_CMD_ID
           
static java.lang.String BUILD_PROJECT_CMD
           
static int BUILD_PROJECT_CMD_ID
           
static java.lang.String BUILD_SELECTED_CMD
           
static int BUILD_SELECTED_CMD_ID
           
static java.lang.String BUILD_WORKINGSET_CMD
           
static int BUILD_WORKINGSET_CMD_ID
           
static java.lang.String BUILD_WORKSPACE_CMD
           
static int BUILD_WORKSPACE_CMD_ID
           
static java.lang.String CANCEL_BUILD_CMD
           
static int CANCEL_BUILD_CMD_ID
           
static java.lang.String CLEAN_PROJECT_CMD
           
static int CLEAN_PROJECT_CMD_ID
           
static java.lang.String CLEAN_WORKSPACE_CMD
           
static int CLEAN_WORKSPACE_CMD_ID
           
static java.lang.String CLEANALL_CMD
           
static int CLEANALL_CMD_ID
           
static java.lang.String DISABLE_FILE_NOT_IN_PROJECT_WARNING
           
static java.lang.String MAKE_FOLDER_CMD
           
static int MAKE_FOLDER_CMD_ID
           
static java.lang.String MAKE_PROJECT_AND_DEPENDENCIES_CMD
           
static int MAKE_PROJECT_AND_DEPENDENCIES_CMD_ID
           
static java.lang.String MAKE_PROJECT_CMD
           
static int MAKE_PROJECT_CMD_ID
           
static java.lang.String MAKE_SELECTED_CMD
           
static int MAKE_SELECTED_CMD_ID
           
static java.lang.String MAKE_WORKINGSET_CMD
           
static int MAKE_WORKINGSET_CMD_ID
           
static java.lang.String MAKE_WORKSPACE_CMD
           
static int MAKE_WORKSPACE_CMD_ID
           

 

Fields inherited from class oracle.ide.compiler.Compiler
COMPILER_GENERATE_CLASSES_DESPITE_ERRORS

 

Method Summary
 boolean addBuildSystemListener(BuildSystemListener bsl)
          addBuildSystemListener method adds a build system listener instance implementation to the build system, see BuildSystemListener for more information.
 boolean addCopyListener(CopyListener cl)
          addCopyListener method adds a copy listener instance implementation to the build system, see CopyListener for more information.
 boolean canShutdown()
          This method is called by the IDE to confirm that the ide can shutdown
 boolean clean(Context context, boolean throwOnFailedDelete, java.io.OutputStream outStream, java.io.OutputStream errStream)
          Clean the context (may be workspace or project).
 boolean compile(CompileArguments compileArguments)
          Compile one or more targets using the arguments defined in the CompileArguments object.
 boolean compile(Context context, boolean rebuild, boolean wait)
          Deprecated. Use compile(CompileArguments) instead
 boolean compile(Context context, boolean rebuild, boolean wait, boolean save)
          Deprecated. Use compile(CompileArguments) instead
 boolean compile(Context context, boolean rebuild, boolean wait, java.io.OutputStream outStream, java.io.OutputStream errStream)
          Deprecated. Use compile(CompileArguments) instead
 void compile(Context context, boolean rebuild, PostBuilder postBuild, boolean save)
          Deprecated. 
 int compileInThread(java.lang.Thread thread, Project prj, java.util.ArrayList files, boolean rebuild)
          compileInThread -- will compile the specified list of classes within the context of an already running compiler thread.
 boolean forceRebuildOnProject(Project prj)
           
 LogPage getErrorLog()
           
static JCompiler getInstance()
          The Debugger folder is a singleton class.
static java.util.logging.Logger getLogger()
           
 LogPage getOutputLog()
          get{Output|Error}Log gets the default compiler output/error log.
 void initialize()
          This method is called by the IDE to request that the feature be initialize
 boolean internalJavaCompile(Context context, java.util.ArrayList messages)
          internalJavaCompile is an internal use only API used to perform a non-ui java-only compilation.
 boolean isBusy(Context context)
          Will return true if the build system is already busy building and not currently available.
 boolean lock(Context context, boolean wait)
          lock/unlock the context (may be project, workspace, file, ...) and return true if the operation was successful.
 void logOutMsg(java.lang.String msg)
          logOutMsg log a message on the default compiler output log
 void registerNavigable(Navigable navigable)
          Registers a Navigable as a child of the Compiler Navigable in the Project Settings Dialog.
 void registerTranslator(Translator translator)
          Entry point to register compiler translators
 boolean removeBuildSystemListener(BuildSystemListener bsl)
          removeBuildSystemListener method removes a build system listener instance implementation from the build system, see BuildSystemListener for more information.
 boolean removeCopyListener(CopyListener cl)
          removeCopyListener method removes a copy listener instance implementation from the build system, see CopyListener for more information.
 void shutdown()
          This method is called by the IDE to request that the feature release any resources held before the ide shuts down..
 void stopBuild(Context context)
          Will attempt to stop the build if one is happening right now.
 boolean unlock(Context context)
           
 void unregisterTranslator(Translator translator)
          Entry point to remove compiler translators

 

Methods inherited from class oracle.ide.compiler.Compiler
getCompiler, setCompiler

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

DISABLE_FILE_NOT_IN_PROJECT_WARNING

public static final java.lang.String DISABLE_FILE_NOT_IN_PROJECT_WARNING
See Also:
Constant Field Values

MAKE_SELECTED_CMD_ID

public static final int MAKE_SELECTED_CMD_ID

MAKE_SELECTED_CMD

public static final java.lang.String MAKE_SELECTED_CMD
See Also:
Constant Field Values

BUILD_SELECTED_CMD_ID

public static final int BUILD_SELECTED_CMD_ID

BUILD_SELECTED_CMD

public static final java.lang.String BUILD_SELECTED_CMD
See Also:
Constant Field Values

MAKE_WORKINGSET_CMD_ID

public static final int MAKE_WORKINGSET_CMD_ID

MAKE_WORKINGSET_CMD

public static final java.lang.String MAKE_WORKINGSET_CMD
See Also:
Constant Field Values

BUILD_WORKINGSET_CMD_ID

public static final int BUILD_WORKINGSET_CMD_ID

BUILD_WORKINGSET_CMD

public static final java.lang.String BUILD_WORKINGSET_CMD
See Also:
Constant Field Values

MAKE_PROJECT_CMD_ID

public static final int MAKE_PROJECT_CMD_ID

MAKE_PROJECT_CMD

public static final java.lang.String MAKE_PROJECT_CMD
See Also:
Constant Field Values

MAKE_PROJECT_AND_DEPENDENCIES_CMD_ID

public static final int MAKE_PROJECT_AND_DEPENDENCIES_CMD_ID

MAKE_PROJECT_AND_DEPENDENCIES_CMD

public static final java.lang.String MAKE_PROJECT_AND_DEPENDENCIES_CMD
See Also:
Constant Field Values

BUILD_PROJECT_CMD_ID

public static final int BUILD_PROJECT_CMD_ID

BUILD_PROJECT_CMD

public static final java.lang.String BUILD_PROJECT_CMD
See Also:
Constant Field Values

BUILD_PROJECT_AND_DEPENDENCIES_CMD_ID

public static final int BUILD_PROJECT_AND_DEPENDENCIES_CMD_ID

BUILD_PROJECT_AND_DEPENDENCIES_CMD

public static final java.lang.String BUILD_PROJECT_AND_DEPENDENCIES_CMD
See Also:
Constant Field Values

MAKE_WORKSPACE_CMD_ID

public static final int MAKE_WORKSPACE_CMD_ID

MAKE_WORKSPACE_CMD

public static final java.lang.String MAKE_WORKSPACE_CMD
See Also:
Constant Field Values

BUILD_WORKSPACE_CMD_ID

public static final int BUILD_WORKSPACE_CMD_ID

BUILD_WORKSPACE_CMD

public static final java.lang.String BUILD_WORKSPACE_CMD
See Also:
Constant Field Values

MAKE_FOLDER_CMD_ID

public static final int MAKE_FOLDER_CMD_ID

MAKE_FOLDER_CMD

public static final java.lang.String MAKE_FOLDER_CMD
See Also:
Constant Field Values

CANCEL_BUILD_CMD_ID

public static final int CANCEL_BUILD_CMD_ID

CANCEL_BUILD_CMD

public static final java.lang.String CANCEL_BUILD_CMD
See Also:
Constant Field Values

CLEANALL_CMD_ID

public static final int CLEANALL_CMD_ID

CLEANALL_CMD

public static final java.lang.String CLEANALL_CMD
See Also:
Constant Field Values

CLEAN_PROJECT_CMD_ID

public static final int CLEAN_PROJECT_CMD_ID

CLEAN_PROJECT_CMD

public static final java.lang.String CLEAN_PROJECT_CMD
See Also:
Constant Field Values

CLEAN_WORKSPACE_CMD_ID

public static final int CLEAN_WORKSPACE_CMD_ID

CLEAN_WORKSPACE_CMD

public static final java.lang.String CLEAN_WORKSPACE_CMD
See Also:
Constant Field Values

Method Detail

getInstance

public static JCompiler getInstance()
The Debugger folder is a singleton class. This method gets this folder's single instance.
Returns:
the Debugger folder single instance.

forceRebuildOnProject

public boolean forceRebuildOnProject(Project prj)

initialize

public void initialize()
This method is called by the IDE to request that the feature be initialize
Specified by:
initialize in interface Addin
See Also:
AddinManager

shutdown

public void shutdown()
This method is called by the IDE to request that the feature release any resources held before the ide shuts down..
Specified by:
shutdown in interface ShutdownHook

canShutdown

public boolean canShutdown()
This method is called by the IDE to confirm that the ide can shutdown
Specified by:
canShutdown in interface ShutdownHook
Returns:
true if shutdown can proceed, false to abort shutdown.

isBusy

public boolean isBusy(Context context)
Will return true if the build system is already busy building and not currently available.
Specified by:
isBusy in class Compiler
Parameters:
context - -- workspace, project or file
Returns:
true if the compiler is busy with a compilation, false otherwise.

stopBuild

public void stopBuild(Context context)
Will attempt to stop the build if one is happening right now.

compile

public boolean compile(CompileArguments compileArguments)
Compile one or more targets using the arguments defined in the CompileArguments object.
Specified by:
compile in class Compiler
Parameters:
compileArguments - The arguments that define the compilation
Returns:
If CompileArguments.waitForTermination() returns true, this method will return true if the compilation succeeded without errors, false otherwise; if CompileArguments.waitForTermination() returns false, this method will return true if the compilation was successfully started, false otherwise

compile

@Deprecated
public boolean compile(Context context,
                                  boolean rebuild,
                                  boolean wait)
Deprecated. Use compile(CompileArguments) instead
compile -- compile the context (may be project, workspace, file, ...) and return true if they are no errors else false. If wait is false, the method will not wait for the compile to terminate and the return value is undefined. This method has NO save parameter and will NEVER save files before the compile
Specified by:
compile in class Compiler
Parameters:
context - -- workspace, project or file to compile
rebuild - -- if true, unconditionally rebuild sources
wait - -- if true, wait for compile to terminate
Returns:
true if successful (no translator errors), else false

compile

@Deprecated
public boolean compile(Context context,
                                  boolean rebuild,
                                  boolean wait,
                                  boolean save)
Deprecated. Use compile(CompileArguments) instead
compile -- compile the context (may be project, workspace, file, ...) and return true if they are no errors else false. If wait is false, the method will not wait for the compile to terminate and the return value is undefined. This method listens to the save parameter.
Specified by:
compile in class Compiler
Parameters:
context - -- workspace, project or file to compile
rebuild - -- if true, unconditionally rebuild sources
wait - -- if true, wait for compile to terminate
save - -- if true, will save files before compiling if the IDE setting is enabled; if false, will never save files, regardless of the IDE setting.
Returns:
true if successful (no translator errors), else false

compile

@Deprecated
public void compile(Context context,
                               boolean rebuild,
                               PostBuilder postBuild,
                               boolean save)
Deprecated. 
Description copied from class: Compiler
compile -- compile the context (may be project, workspace, file, ...) on a background thread and call the specified worker object once compilation is completed with build successful or not as the postBuild method input parameter.
Specified by:
compile in class Compiler
Parameters:
context - -- workspace, project or file to compile
rebuild - -- if true, unconditionally rebuild sources
postBuild - --method postBuild will be called once the build is completed
save - -- if true, will save files before compiling if the IDE setting is enabled; if false, will never save files, regardless of the IDE setting. The compile method without the save parameter will never save files.

compile

@Deprecated
public boolean compile(Context context,
                                  boolean rebuild,
                                  boolean wait,
                                  java.io.OutputStream outStream,
                                  java.io.OutputStream errStream)
Deprecated. Use compile(CompileArguments) instead
compile -- compile the context (may be project, workspace, file, ...) and return true if they are no errors else false. If wait is false, the method will not wait for the compile to terminate and the return value is undefined. Output log information (verbose stuff) is logged to on specified outStream and build system errors/warnings are logged on the specified errStream.
Specified by:
compile in class Compiler
Parameters:
context - -- workspace, project or file to compile
rebuild - -- if true, unconditionally rebuild sources
wait - -- if true, wait for compile to terminate
outStream - -- stream where to log all verbose build system messages
errStream - -- stream where to log all translators errors/warnings
Returns:
true if successful (no translator errors), else false

clean

public boolean clean(Context context,
                     boolean throwOnFailedDelete,
                     java.io.OutputStream outStream,
                     java.io.OutputStream errStream)
              throws java.io.IOException
Clean the context (may be workspace or project). Cleaning is done in an auto-safe manner, meaning the cleaning will not require any user interaction, and if anything element is unclear or ambiguous, such as trying to clean the directory 'classes', and there is no directory 'classes' but there IS a file called 'classes', the cleaning of that element is skipped. This method will not return till the cleaning is done.
Specified by:
clean in class Compiler
Parameters:
context - -- workspace or project to clean
throwOnFailedDelete - -- if true, throw an IOException if delete on any file or directory fails
outStream - -- stream where to log any verbose system message; if null, stdout will be used
errStream - -- stream where to log any error/warning; if null, stderr will be used
Returns:
true if the context was cleaned, false otherwise
Throws:
java.io.IOException - if throwOnDeleteFailure is true and delete on any file or directory fails. Use getMessage to get the path of the file or directory

internalJavaCompile

public boolean internalJavaCompile(Context context,
                                   java.util.ArrayList messages)
                            throws java.lang.Exception
internalJavaCompile is an internal use only API used to perform a non-ui java-only compilation. It will only compile what is specified in the selection of the context. This api doesn't create a new compilation thread, the compilation is performed in the calling thread.
Parameters:
context - -- java file(s) to compile as specified in the selection, the java source nodes don't need to be saved on disk and this API will not saved them if they aren't, regarless of the tools preference saveBeforeCompile.
messages - -- output parameter containing the list of one or more messages produced by the compilation. Each messages are a String and the format is: "'full_path_name'('lineno','colno'):'error number':'error msg'" example: "c:\source\Class1.java(5,2):314:unreachable code"
Returns:
true if there is no error, else false
Throws:
java.lang.IllegalArgumentException - if one or more element in the selections are not java files. Also thrown when messages &| context are null.
java.lang.ClassNotFoundException - if there is no java compiler Translator registered in the build system (ex: can't find Ojc).
java.lang.IllegalStateException - if the build system is not available (ex: there is already a compilation session going on).
java.lang.Exception

compileInThread

public int compileInThread(java.lang.Thread thread,
                           Project prj,
                           java.util.ArrayList files,
                           boolean rebuild)
compileInThread -- will compile the specified list of classes within the context of an already running compiler thread. This API was provided to allow a Translator to compile a list of one or more files on the fly.
Parameters:
thread - -- a compiler thread object
prj - -- the project context to use to build
files - -- one of more files to build (must be subclass of Storage)
rebuild - -- if true, rebuild file(s) else make file(s)
Returns:
0 success > 0 number of errors -1 thread is not a Compiler compatible thread object -2 no files to build -3 one or more file in the files is not a subclass of Storage

addCopyListener

public boolean addCopyListener(CopyListener cl)
addCopyListener method adds a copy listener instance implementation to the build system, see CopyListener for more information.
Specified by:
addCopyListener in class Compiler
Parameters:
cl - -- copy listener to add
Returns:
true if properly added, false if the specified cl is already been added before

removeCopyListener

public boolean removeCopyListener(CopyListener cl)
removeCopyListener method removes a copy listener instance implementation from the build system, see CopyListener for more information.
Specified by:
removeCopyListener in class Compiler
Parameters:
cl - -- copy listener to remove
Returns:
true if properly removed, false if the specified cl is not found

addBuildSystemListener

public boolean addBuildSystemListener(BuildSystemListener bsl)
addBuildSystemListener method adds a build system listener instance implementation to the build system, see BuildSystemListener for more information.
Specified by:
addBuildSystemListener in class Compiler
Parameters:
bsl - build system listener to add
Returns:
true if properly added, false if the specified bsl is already been added before

removeBuildSystemListener

public boolean removeBuildSystemListener(BuildSystemListener bsl)
removeBuildSystemListener method removes a build system listener instance implementation from the build system, see BuildSystemListener for more information.
Specified by:
removeBuildSystemListener in class Compiler
Parameters:
bsl - build system listener to remove
Returns:
true if properly removed, false if the specified bsl is not found

lock

public boolean lock(Context context,
                    boolean wait)
Description copied from class: Compiler
lock/unlock the context (may be project, workspace, file, ...) and return true if the operation was successful. If wait is false, the method will not wait for the context to be locked and return false if the context can't be lock else if wait is true, the context compilation will complete before returning true
Specified by:
lock in class Compiler
Parameters:
context - -- workspace, project or file to lock/unlock
wait - -- if true, wait for compilation to terminate
Returns:
true if successful else false

unlock

public boolean unlock(Context context)
Specified by:
unlock in class Compiler

getOutputLog

public LogPage getOutputLog()
Description copied from class: Compiler
get{Output|Error}Log gets the default compiler output/error log.
Specified by:
getOutputLog in class Compiler
Returns:
the default LogPage

logOutMsg

public void logOutMsg(java.lang.String msg)
Description copied from class: Compiler
logOutMsg log a message on the default compiler output log
Specified by:
logOutMsg in class Compiler
Parameters:
msg - -- msg to print on the log

getLogger

public static java.util.logging.Logger getLogger()

getErrorLog

public LogPage getErrorLog()
Specified by:
getErrorLog in class Compiler

registerTranslator

public void registerTranslator(Translator translator)
Entry point to register compiler translators

unregisterTranslator

public void unregisterTranslator(Translator translator)
Entry point to remove compiler translators

registerNavigable

public void registerNavigable(Navigable navigable)
Registers a Navigable as a child of the Compiler Navigable in the Project Settings Dialog.
Parameters:
navigable - The child Navigable to add.

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.5.0)

E13403-06


Copyright © 1997, 2011, Oracle. All rights reserved.