Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


oracle.jdeveloper.runner
Class Source

java.lang.Object
  extended by oracle.jdeveloper.runner.Source


public final class Source
extends java.lang.Object

The Source class provides methods for displaying source files in the code editor or UI designer.

The Source class is used by the debugger and the profiler to display source files in the code editor.


Method Summary
static void addSourceFinder(SourceFinder finder)
          Registers a SourceFinder
static void addSourceFinderManager(SourceFinderManager manager)
          Registers a SourceFinderManager
static java.net.URL askSourceFinders(Workspace workspace, Project project, java.lang.String pkg, java.lang.String filename)
          Iterate over the configured SourceFinders to see if one of them can locate the source
static java.net.URL findOpenSourceStub(Workspace workspace, Project project, java.lang.String fullClassName)
          Returns the URL for a source stub that has already been opened.
static java.net.URL findSourceFile(Workspace workspace, Project project, java.lang.String pkg, java.lang.String filename)
          Returns the URL for the source file that has the given package and filename.
static java.net.URL findURLForClass(Workspace workspace, Project project, java.lang.String fullClassName)
          Return the URL for the source file of the named class
static java.net.URL findURLForClassSource(Project project, java.lang.String fullClassName)
          Return the URL for the source file of the named class
static java.net.URL findURLForClassSource(Workspace workspace, Project project, java.lang.String fullClassName)
          Return the URL for the source file of the named class
static java.net.URL findURLForClassStub(Project project, java.lang.String fullClassName)
          Return the URL for the source file of the named class
static java.net.URL findURLForClassStub(Workspace workspace, Project project, java.lang.String fullClassName)
          Return the URL for the source stub of the named class
static CodeEditor getCodeEditorFromContext(Context context)
          Returns the CodeEditor for the given Context.
static java.lang.String getFilenameFromNode(Node node)
          Returns the filename for the given node.
static int getLineFromCodeEditor(Context context)
          Returns the line number for the given code editor Context.
static Node getNodeFromCodeEditor(Context context)
          Returns the Node for the given code editor Context.
static Node[] getOpenedFiles()
          Returns the files that are currently open in an editor.
static Node[] getOpenedFiles(Workspace workspace, Project project)
          Returns the files that are currently open in an editor.
static java.lang.String getPackageFromNode(Node node, Project project)
          Returns the package for the given node.
static Node[] getProjectFileList(Project project)
          Returns the files in the given project.
static boolean packageMatches(java.lang.String pkg, Node node, Project project)
          Returns true if the given package matches the package for the given node.
static boolean packageMatches(java.lang.String pkg, java.lang.String nodePkg)
          Returns true if the given package matches the given node package.
static void removeSourceFinder(SourceFinder finder)
          Unregisters a SourceFinder
static void removeSourceFinderManager(SourceFinderManager manager)
          Unregisters a SourceFinderManager
static CodeEditor showNodeInCodeEditor(Workspace workspace, Project project, Node node)
          Displays a node in the code editor.
static Editor showNodeInDefaultEditor(Workspace workspace, Project project, Node node)
          Displays a node in its default editor.
static boolean showSourceFile(Workspace workspace, Project project, Node node, int line, boolean selectLine)
          Displays a source file in the code editor.
static boolean showSourceFile(Workspace workspace, Project project, Node node, int line, boolean selectLine, boolean showInNavHistory)
          Displays a source file in the code editor.
static boolean showSourceFile(Workspace workspace, Project project, java.lang.String pkg, java.lang.String fullClassName, java.lang.String filename, int line, boolean selectLine)
          Displays a source file in the code editor.
static boolean showSourceFile(Workspace workspace, Project project, java.lang.String pkg, java.lang.String fullClassName, java.lang.String filename, int line, boolean selectLine, java.lang.String sourceNotFoundMessage)
          Displays a source file in the code editor.
static boolean showSourceFile(Workspace workspace, Project project, java.lang.String pkg, java.lang.String fullClassName, java.lang.String filename, int line, boolean selectLine, java.lang.String sourceNotFoundMessage, oracle.jdevimpl.debugger.support.DebugVirtualMachine vm)
          Displays a source file in the code editor.
static boolean showSourceFile(Workspace workspace, Project project, java.net.URL url, int line, boolean selectLine)
          Displays a source file in the code editor.
static boolean showSourceFile(Workspace workspace, Project project, java.net.URL url, int line, boolean selectLine, boolean showInNavHistory)
          Displays a source file in the code editor.
static boolean showUIDesigner(Workspace workspace, Project project, Node node)
          Displays a source file in the UI designer.
static boolean showUIDesigner(Workspace workspace, Project project, java.net.URL url)
          Displays a source file in the UI designer.

 

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

 

Method Detail

showSourceFile

public static boolean showSourceFile(Workspace workspace,
                                     Project project,
                                     java.lang.String pkg,
                                     java.lang.String fullClassName,
                                     java.lang.String filename,
                                     int line,
                                     boolean selectLine)
Displays a source file in the code editor.

The source file is found by matching the package, filename. If the source file can not be found, a source stub may be created from the class file.

Parameters:
workspace - the workspace
project - the project
pkg - the package
fullClassName - the full class name
filename - the filename, without any directory information
line - the line number to make visible
selectLine - whether to select the text on the line

showSourceFile

public static boolean showSourceFile(Workspace workspace,
                                     Project project,
                                     java.lang.String pkg,
                                     java.lang.String fullClassName,
                                     java.lang.String filename,
                                     int line,
                                     boolean selectLine,
                                     java.lang.String sourceNotFoundMessage)
Displays a source file in the code editor.

The source file is found by matching the package, filename. If the source file can not be found, a source stub may be created from the class file.

Parameters:
workspace - the workspace
project - the project
pkg - the package
fullClassName - the full class name
filename - the filename, without any directory information
line - the line number to make visible
selectLine - whether to select the text on the line
sourceNotFoundMessage - message to show in SourceNotFoundDialog

showSourceFile

public static boolean showSourceFile(Workspace workspace,
                                     Project project,
                                     java.lang.String pkg,
                                     java.lang.String fullClassName,
                                     java.lang.String filename,
                                     int line,
                                     boolean selectLine,
                                     java.lang.String sourceNotFoundMessage,
                                     oracle.jdevimpl.debugger.support.DebugVirtualMachine vm)
Displays a source file in the code editor.

The source file is found by matching the package, filename. If the source file can not be found, a source stub may be created from the class file.

Parameters:
workspace - the workspace
project - the project
pkg - the package
fullClassName - the full class name
filename - the filename, without any directory information
line - the line number to make visible
selectLine - whether to select the text on the line
sourceNotFoundMessage - message to show in SourceNotFoundDialog
vm - the virtualmachine to look for cached urls.

showSourceFile

public static boolean showSourceFile(Workspace workspace,
                                     Project project,
                                     java.net.URL url,
                                     int line,
                                     boolean selectLine)
Displays a source file in the code editor.
Parameters:
workspace - the workspace
project - the project
url - the URL for the source file.
line - the line number to make visible
selectLine - whether to select the text on the line

showSourceFile

public static boolean showSourceFile(Workspace workspace,
                                     Project project,
                                     java.net.URL url,
                                     int line,
                                     boolean selectLine,
                                     boolean showInNavHistory)
Displays a source file in the code editor.
Parameters:
workspace - the workspace
project - the project
url - the URL for the source file.
line - the line number to make visible
selectLine - whether to select the text on the line
showInNavHistory - whether to remember location in the navigation history

showSourceFile

public static boolean showSourceFile(Workspace workspace,
                                     Project project,
                                     Node node,
                                     int line,
                                     boolean selectLine)
Displays a source file in the code editor.
Parameters:
workspace - the workspace
project - the project
node - the Node for the source file.
line - the line number to make visible
selectLine - whether to select the text on the line

showSourceFile

public static boolean showSourceFile(Workspace workspace,
                                     Project project,
                                     Node node,
                                     int line,
                                     boolean selectLine,
                                     boolean showInNavHistory)
Displays a source file in the code editor.
Parameters:
workspace - the workspace
project - the project
node - the Node for the source file.
line - the line number to make visible
selectLine - whether to select the text on the line
showInNavHistory - after updating editor to show new location, whether we want Nav Point to remain in the history stack

showNodeInCodeEditor

public static CodeEditor showNodeInCodeEditor(Workspace workspace,
                                              Project project,
                                              Node node)
Displays a node in the code editor.
Parameters:
workspace - the workspace
project - the project
node - the Node for the source file.

showNodeInDefaultEditor

public static Editor showNodeInDefaultEditor(Workspace workspace,
                                             Project project,
                                             Node node)
Displays a node in its default editor.
Parameters:
workspace - the workspace
project - the project
node - the Node for the source file.

addSourceFinder

public static void addSourceFinder(SourceFinder finder)
Registers a SourceFinder
Parameters:
finder - - The SourceFinder SourceFinders should be registered in an extension.xml file, such as:

<trigger-hooks xmlns="http://xmlns.oracle.com/ide/extension">
<triggers trigger-id="Register_My_SourceFinder">
<source-hook xmlns="http://xmlns.oracle.com/ide/extension/jdev-runner">
<source-finder class="mypackage.MySourceFinder" />
</source-hook>
</triggers>
</trigger-hooks>


removeSourceFinder

public static void removeSourceFinder(SourceFinder finder)
Unregisters a SourceFinder
Parameters:
finder - - The SourceFinder SourceFinders registered in extension.xml files cannot be removed

addSourceFinderManager

public static void addSourceFinderManager(SourceFinderManager manager)
Registers a SourceFinderManager
Parameters:
manager - - The SourceFinderManager SourceFinderManagers should be registered in an extension.xml file, such as:

<trigger-hooks xmlns="http://xmlns.oracle.com/ide/extension">
<triggers trigger-id="Register_My_SourceFinderManager">
<source-hook xmlns="http://xmlns.oracle.com/ide/extension/jdev-runner">
<source-finder class="mypackage.MySourceFinderManager" />
</source-hook>
</triggers>
</trigger-hooks>


removeSourceFinderManager

public static void removeSourceFinderManager(SourceFinderManager manager)
Unregisters a SourceFinderManager
Parameters:
manager - - The SourceFinderManager SourceFinderManagers registered in extension.xml files cannot be removed

showUIDesigner

public static boolean showUIDesigner(Workspace workspace,
                                     Project project,
                                     java.net.URL url)
Displays a source file in the UI designer.
Parameters:
workspace - the workspace
project - the project
url - the URL for the source file.

showUIDesigner

public static boolean showUIDesigner(Workspace workspace,
                                     Project project,
                                     Node node)
Displays a source file in the UI designer.
Parameters:
workspace - the workspace
project - the project
node - the Node for the source file.

findSourceFile

public static java.net.URL findSourceFile(Workspace workspace,
                                          Project project,
                                          java.lang.String pkg,
                                          java.lang.String filename)
Returns the URL for the source file that has the given package and filename.
Parameters:
workspace - the workspace
project - the project
pkg - the package
filename - the filename
Returns:
the URL

askSourceFinders

public static java.net.URL askSourceFinders(Workspace workspace,
                                            Project project,
                                            java.lang.String pkg,
                                            java.lang.String filename)
Iterate over the configured SourceFinders to see if one of them can locate the source
Parameters:
workspace - the workspace
project - the project
pkg - the package name
filename - the file name
Returns:
the first match found, or null if no match

findURLForClass

public static java.net.URL findURLForClass(Workspace workspace,
                                           Project project,
                                           java.lang.String fullClassName)
Return the URL for the source file of the named class
Parameters:
workspace - the workspace
project - the project
fullClassName - the full class name
Returns:
URL for the source file

findURLForClassSource

public static java.net.URL findURLForClassSource(Workspace workspace,
                                                 Project project,
                                                 java.lang.String fullClassName)
Return the URL for the source file of the named class
Parameters:
workspace - the workspace
project - the project
fullClassName - the full class name
Returns:
URL for the source file

findURLForClassSource

public static java.net.URL findURLForClassSource(Project project,
                                                 java.lang.String fullClassName)
Return the URL for the source file of the named class
Parameters:
project - the project
fullClassName - the full class name
Returns:
URL for the source file

findURLForClassStub

public static java.net.URL findURLForClassStub(Workspace workspace,
                                               Project project,
                                               java.lang.String fullClassName)
Return the URL for the source stub of the named class
Parameters:
workspace - the workspace
project - the project
fullClassName - the full class name
Returns:
URL for the source file

findURLForClassStub

public static java.net.URL findURLForClassStub(Project project,
                                               java.lang.String fullClassName)
Return the URL for the source file of the named class
Parameters:
project - the project
fullClassName - the full class name
Returns:
URL for the source file

findOpenSourceStub

public static java.net.URL findOpenSourceStub(Workspace workspace,
                                              Project project,
                                              java.lang.String fullClassName)
Returns the URL for a source stub that has already been opened.
Parameters:
workspace - the workspace
project - the project
fullClassName - the full class name

getProjectFileList

public static Node[] getProjectFileList(Project project)
Returns the files in the given project.

getOpenedFiles

public static Node[] getOpenedFiles()
Returns the files that are currently open in an editor.

getOpenedFiles

public static Node[] getOpenedFiles(Workspace workspace,
                                    Project project)
Returns the files that are currently open in an editor.
Parameters:
workspace - the workspace
project - the project

getFilenameFromNode

public static java.lang.String getFilenameFromNode(Node node)
Returns the filename for the given node.
Parameters:
node - the node
Returns:
the filename for the given node

getPackageFromNode

public static java.lang.String getPackageFromNode(Node node,
                                                  Project project)
Returns the package for the given node.

Note that the package returned here may begin with a '*', meaning that the exact package is not known.

Parameters:
node - the node
project - the project
Returns:
the package for the given node

packageMatches

public static boolean packageMatches(java.lang.String pkg,
                                     Node node,
                                     Project project)
Returns true if the given package matches the package for the given node.

Note that this method handles the situation where the exact package for the given node is not known (for JSPs).

Parameters:
pkg - the package
node - the node
project - the project
Returns:
true if the given package matches the package for the given node.

packageMatches

public static boolean packageMatches(java.lang.String pkg,
                                     java.lang.String nodePkg)
Returns true if the given package matches the given node package.

Note that this method handles the situation where the given node package is not exact (for JSPs).

Parameters:
pkg - the package
nodePkg - the node package
Returns:
true if the given package matches the given node package.

getCodeEditorFromContext

public static CodeEditor getCodeEditorFromContext(Context context)
Returns the CodeEditor for the given Context.

If the given context is not a code editor context, this method returns null.


getNodeFromCodeEditor

public static Node getNodeFromCodeEditor(Context context)
Returns the Node for the given code editor Context.

If the given context is not a code editor context, this method returns null.


getLineFromCodeEditor

public static int getLineFromCodeEditor(Context context)
Returns the line number for the given code editor Context.

If the given context is not a code editor context, this method returns 0.


Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


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