Commit 4d72aac5 authored by Greg Watson's avatar Greg Watson
Browse files

Updates to scripting tutorial


Signed-off-by: Greg Watson's avatarGreg Watson <g.watson@computer.org>
parent fa1fc940
......@@ -4,38 +4,13 @@ In addition to interacting with tools via the ICE user interface, ICE also
provides a scripting framework based on the Eclipse Advanced Scripting
Environment (EASE).
\section{Installation and Configuration}
\section{PyDev Installation (optional)}
Although EASE is pre-installed in the ICE application, there are a few
additional components that need to be installed in order to provide a Python
scripting engine.
\subsection{EASE Jython Installation}
The first step is to install the EASE Jython engine. This can be done via the
official EASE
repository\footnote{\texttt{https://dl.bintray.com/pontesegger/ease-jython}}
using the Eclipse Update Manager, but is more simply achieved using the Install EASE Components menu.
To installed the Jython engine, select \texttt{Help $\rightarrow$ Install
EASE Components} from the ICE menu bar. Check the box next to the EASE Jython
Integration entry as shown in figure \ref{fig:jython} and click Finish. Follow
the prompts to install the component, and restart Eclipse when asked.
\begin{figure}[!hb]
\centering
\includegraphics[width=7cm]{images/ease-marketplace}
\caption{Installing the Jython Engine}
\label{fig:jython}
\end{figure}
\subsection{PyDev Installation (optional)}
It is possible to edit Python scripts in Eclipse using the default text editor,
Although it is possible to edit Python scripts in Eclipse using the default text editor,
however it is much more productive to use the PyDev Eclipse development
environment. In addition to the usual syntax coloring and other advanced editing
features you'd expect in Eclipse, PyDev also provides the ability to run and
debug Python programs from within the Eclipse environment.
environment if you are planning to do a lot of script development. In addition to the
usual syntax coloring and other advanced editing features you'd expect in Eclipse,
PyDev also provides the ability to run and debug Python programs from within the Eclipse environment.
PyDev can be easily installed from using the Eclipse Marketplace client as
follows. From the ICE menu bar, select \texttt{Help $\rightarrow$ Eclipse
......@@ -54,7 +29,7 @@ PyDev and opened in the Python editor by default.
\label{fig:pydev}
\end{figure}
\subsection{EASE Configuration}
\section{EASE Configuration}
There are a number of configuration settings that can be used to customize the
behavior of EASE. These configuration settings are accessed via the \texttt{Scripting}
......@@ -82,7 +57,7 @@ you could just as easily create a new one. To configure the projects, select the
\ref{fig:prefs1}. You can then use the \texttt{Add Workspace\ldots} button to
select one or more projects from the workspace.
By default, EASE is configured to use the javascript (Rhino) engine.
By default, EASE is configured to use the JavaScript (Rhino) engine.
Since this tutorial assumes that the preferred environment is Python, we recommend changing
this default. To set the script engine default, select the
\texttt{Shell} preference item. Next, select \texttt{Python (Jython)} from
......@@ -221,7 +196,7 @@ to the script:
{\small
\begin{verbatim}
# popup : enableFor(org.eclipse.core.resources.IResource)
# image : platform:/plugin/org.eclipse.ui.ide/icons/full/elcl16/configs.gif
# image : platform:/plugin/org.eclipse.ui.ide/icons/full/elcl16/configs.png
\end{verbatim}
}
......@@ -234,13 +209,15 @@ to the script:
\section{Interacting with ICE}
In order to interact with Java classes from the Python script, we
In order to interact with Java classes in ICE from the Python script, we
need to include the \texttt{Platform} module. In order to load a module, we use
the \texttt{loadModule()} function in Python. The argument to this function is a
string representation of the module path, which in this case will be
\texttt{/System/Platform}.
Enter the following command as the first line of the script file:
In the \texttt{Modules Explorer} view, open the \texttt{System} folder, then drag
the \texttt{Platform} item onto first line of the script file. This should insert
the following line into your script:
\lstset{basicstyle=\ttfamily\small, breaklines}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment