Welcome, Reviewer!
Reviewer's Guide: Oracle Application Server 10g Standard Edition One
Home Instant Information Sharing Complete Web Site Easy Development Simplified Management
Site Map
Key Features
Demonstrations
Changing the Home Page
Collateral
PHP Extension
Python Extension
White Paper
Technical FAQs
Oracle HTTP Server
OracleAS Web Cache
Oracle and PHP
Oracle PHP Troubleshooting
Python Extension Usage Information
 

The Python extension provides support for the Python language in the Oracle JDeveloper 10g IDE.

Contents

Overview of this Tool

The Python addin integrates several features to the Oracle JDeveloper IDE to support the Python language. It provides configurable syntax highlighting for .py files, integration with the Jython interpreter for interpreting Python files from inside the IDE, a Python Console which can be used to interactively interpret Python commands, and a gallery item that can be used to create new Python files.

Python scripts that run inside the IDE have access to the whole classpath of the IDE. You can programmatically manipulate the IDE via Python scripts or via the Python Console.

Back to Top

Creating New Python Scripts

You can create new Python scripts from inside the IDE by choosing New... from the File menu. In the New Object Gallery, a Python category is available with a Python Script item.

Back to Top

Python Syntax Highlighting

If you open file with the .py extension or add it to a project, it will have a special icon indicating that it's a Python file. In addition, if Show Categories is selected in the IDE navigator, Python files will be grouped in their own category under a project.

Any Python file opened in JDeveloper's editor will be syntax highlighted. You can customize the colors used for syntax highlighting by clicking Preferences... in the Tools menu. On the Editor / Syntax Colors page, you will see a category called Python:

Back to Top

Interpreting Python Scripts

Before interpreting Python scripts in the IDE, you must install Jython. See the installation instructions for more details.

You can interpret any Python script by selecting the .py file in the navigator and clicking the Interpret with Jython menu item in the Run menu. Output from the interpreter will appear in the Python log window. If the Python log window is not visible, select Log Window from the View menu.

The first time you start up the IDE with the Python addin, Jython will create a cache based on all the classes on the classpath. Since the IDE's classpath is large, this takes some time. While Jython is building its cache, you will be unable to interpret .py files or use the Python console. However, you can continue to use the IDE as normal until it has finished. When Jython has finished building its cache, a message will appear in the Python log window. On subsequent startups of the IDE, Jython will only take a long time to initialize if new classes have been added to the IDE's classpath.

Back to Top

Using the Python Console

The Python Console is an interactive command prompt that allows you to type Python commands and see the output immediately. If you can't see the Python Console when the IDE starts up, you can make it visible by selecting the Python Console menu item from the View menu.

You can customize the colors and fonts used in the Python Console by selecting Preferences... in the Tools menu and accessing the Python Console page:

The Python console has a few special key mappings:

Up Arrow Go to the previous command in the command history
Down Arrow Go to the next command in the command history
Ctrl C Clear the current command

Back to Top

Interacting with JDeveloper in Python Scripts

Python commands that are run within the Python Console or interpreted inside the IDE have access to the entire classpath of the JVM JDeveloper runs inside. You can write scripts or enter commands that influence the IDE. For instance, the following two Python commands alter the titlebar of the main JDeveloper window:

from oracle.ide import Ide
Ide.getMainWindow().setTitle( "Python is Cool" )

Consult the Oracle JDeveloper addin API documentation for full details on the API that can be used to influence Oracle JDeveloper.

Back to Top

Copyright © 2005, Oracle. All rights reserved.
http://www.oracle.com/