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

E13403-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)
           
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)
           
static java.net.URL findURLForClassSource(Project project, java.lang.String fullClassName)
           
static java.net.URL findURLForClassSource(Workspace workspace, Project project, java.lang.String fullClassName)
           
static java.net.URL findURLForClassStub(Project project, java.lang.String fullClassName)
           
static java.net.URL findURLForClassStub(Workspace workspace, Project project, java.lang.String fullClassName)
           
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, 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 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,
                                     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

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


removeSourceFinder

public static void removeSourceFinder(SourceFinder finder)
Unregisters a SourceFinder


addSourceFinderManager

public static void addSourceFinderManager(SourceFinderManager manager)
Registers a SourceFinderManager


removeSourceFinderManager

public static void removeSourceFinderManager(SourceFinderManager manager)
Unregisters a SourceFinderManager


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)

findURLForClass

public static java.net.URL findURLForClass(Workspace workspace,
                                           Project project,
                                           java.lang.String fullClassName)

findURLForClassSource

public static java.net.URL findURLForClassSource(Workspace workspace,
                                                 Project project,
                                                 java.lang.String fullClassName)

findURLForClassSource

public static java.net.URL findURLForClassSource(Project project,
                                                 java.lang.String fullClassName)

findURLForClassStub

public static java.net.URL findURLForClassStub(Workspace workspace,
                                               Project project,
                                               java.lang.String fullClassName)

findURLForClassStub

public static java.net.URL findURLForClassStub(Project project,
                                               java.lang.String fullClassName)

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.


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

E13403-04

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