Just want to have a quick try with IT Mill Toolkit? This section presents a
QuickStart into running and debugging IT Mill Toolkit demos under Eclipse. The
QuickStart includes a web server, so you do not need to install a full-weight
web container such as Apache Tomcat.
How to Run the Demo Applications in Eclipse?
Once the project is imported, as described above, you can run the Content
Browser, including the demo applications, as follows. Either:
-
From the main menu, select
→ .
-
From the list on the left, select → .
-
Click Run.
Notice that after the application is launched once, it appears to the
Favourites list. You can then either:
Running the application in Web Mode will open a browser window with the
Content Browser. The default system web browser is opened; make sure that
the browser is compatible with IT Mill Toolkit. The
Console view in the lower pane of Eclipse will
display text printed to standard output by the application. Clicking on
the red Terminate button will stop the server.
Notice that executing the web application locally may provide a security
warning from your firewall software. This is caused by the Web Service
which is started to run the Content Browser. You have to ignore the
warnings or temporarily accept connections to port 8888 on your firewall
software. Also, if the web service fails to start, make sure that no other
service is using the port 8888.
Launching the Hosted Mode Browser
The Hosted Mode Browser of Google Web Toolkit is a special web browser
that runs the client-side GWT Java code as Java runtime instead of
JavaScript, thereby allowing you to debug the client-side components
in an IDE such as Eclipse.
Note
Hosted Mode Browser of Google Web Toolkit 1.4.62 does not
work with Linux/Mozilla (Issue #1636 in IT Mill Toolkit version
5.2.0). As a workaround, you have to use a hand-made loader page as
explained in http://dev.itmill.com/ticket/1636.
To run the demo applications in the Hosted Mode Browser of Google Web
Toolkit, follow the following steps:
-
If not already started, start the demo application in Web Mode as
described above. This launches the web server, which is used also
when using the hosted mode.
-
From the main menu, select
→ .
-
From the list select → .
-
Click Debug.
Starting demo applications under the Hosted
Mode Browser can take considerable time! This is especially
true for the Reservation and Color Picker applications, which require
compilation of custom widget sets. During this time, the Hosted Mode
Browser is unresponsive and does not update its window. Compiling widgets
can take 5-30 seconds, depending on the hardware.
As with the Web Mode launcher, after you have run the launch once, you
can select → → , or click the dropdown marker on right
of the Debug button in the toolbar and select
.
To use the Hosted Mode Browser in your own projects, you need to
create a launch configuration in Eclipse. See the section called “Hosted Mode Browser” for more detailed information
about the Hosted Mode Browser and how to create the launch
configuration.
To stop the launched Jetty web container that serves the Content
Browser web application, select the Console tab
and click on the Terminate button.
To clean up all terminated launches from the
Console window, click on the Remove
All Terminated Launches button.
How to Debug the Demo Applications in Eclipse?
You can inspect and experiment with the imported project as you like. When
you develop an application, you may want to debug it. Running a web
application in debug mode is easy in Eclipse. We show next how to debug
the demo applications by inserting a breakpoint in the Calc example.
-
Make sure to stop any previous Run command as
instructed above at the end of the section called “How to Run the Demo Applications in Eclipse?”.
-
Select from menu
→
and the Debug configuration window will open.
-
Select → and click
Debug. The server will start and the web
browser will open.
-
Open the Calc application by selecting on the start page
→ .
-
Open the source code for the Calc program. It is located in
WebContent/WEB-INF/src/com.itmill.toolkit.demo.Calc. Doubleclick
the class to open the source code in the editor.
-
Insert a breakpoint in the init() (line
57) by clicking on the gray bar on the left of the editor window
to open the context menu, and select
.
-
Switch to the browser window and click on the
Calc link to open it.
-
Eclipse encouters the breakpoint and asks to switch to the Debug
perspective. Click Yes. The debug window
will show the current line where the execution stopped as follows:
Using QuickStart as a Project Skeleton
If you like, you can also use the imported Toolkit as a skeleton for your
project. Just remove any unnecessary files or files related to the demo
applications from the project. You may also want to rename the IT Mill
Toolkit installation directory with a name more proper for your project.
If you want to go the long way, which is probably preferred for a real
large project, you should follow the instructions in the section called “Your First Project with IT Mill Toolkit”.