Extension SDK

oracle.jdeveloper.runner
Class Source

java.lang.Object
  extended byoracle.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, profiler, and codecoach to display source files in the code editor.


Method Summary
static void addSourceFinder(SourceFinder finder)
          Registers a SourceFinder
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 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, JProject project)
          Returns the package for the given node.
static Node[] getProjectFileList(JProject jProject)
          Returns the files in the given project.
static Node[] getProjectFileList(Project project)
          Returns the files in the given project.
static boolean packageMatches(java.lang.String pkg, Node node, JProject 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 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.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.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

addSourceFinder

public static void addSourceFinder(SourceFinder finder)
Registers a SourceFinder


removeSourceFinder

public static void removeSourceFinder(SourceFinder finder)
Unregisters a SourceFinder


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

findURLForClass

public static java.net.URL findURLForClass(Workspace workspace,
                                           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.


getProjectFileList

public static Node[] getProjectFileList(JProject jProject)
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,
                                                  JProject 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,
                                     JProject 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 null.


Extension SDK

 

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