Set Up Eclipse 3

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Set up Eclipse 3.

5 to run gxt applications


This document is a D2D (Developer 2 Developer) listing the required steps to enable GWT plug-in inside your Eclipse IDE; it is crucial to follow the exact steps that follow. This document will guide you through creating your first application with GWT framework, this document also describe the basic information to setup Ext GWT sample applications provided with the distribution, it is mandatory to have an in-depth insight of Ext-GWT sample source code, that it represents a good starting point of any newly developed application, by following the business owners best practices.

Set up eclipse 3.5 SR2 (Galileo)


Download Eclipse If you dont have Eclipse 3.5 (Galileo) at you environment, you can get it from eclipse website or from the following local shared file, copy it to your file system, and extract it. Installing Eclipse plug-ins There is two ways to install eclipse plug-ins to run GWT application, we can use: 1. Update site: on your eclipse IDE, select help install New software a. Paste the following URL into the (Work with) update site text box and hit enter. http://dl.google.com/eclipse/plugin/3.5 b. A list of available updates is listed, select them all and complete the wizard.

c. After completing the update restart your eclipse, in order to enable the newly installed plugins.

2. Offline zipped file: In some cases Eclipse cannot access the update site, due to some corporate restriction or firewalls, Google allows us to download the plug-ins manually and install them to Eclipse, This step requires from you to download both the plug-in and its compatible GWT distribution from Google web site a. Download eclipse plug-in here b. The compressed file contains two directories, features and plugins, copy each of them to the corresponding folder name under the Eclipse installation directory c. It is time to download GWT SDK distribution Here. d. Un-zip GWT SDK to any directory of your choice.

At this level we have a GWT Enabled version of eclipse, if you use the offline version of installation then we have a single step left, which is setting the path to the downloaded GWT SDK, this can be done by going to, Windowpreferences, then expand Google from the tree nodes, and select Web Toolkit, here we can add the SDK by clicking add button and browsing to the directory we have extract the GWT SDK to.

Creating your first GWT application


Google provide a brilliant starter documentation you can start learning using it, to create your first application with GWT

1. Select a. filenew Web Application project or b. you can also create a GWT application by clicking the icon in Eclipse as follows

2. New web application wizard open, fill in the required field and un-check the (use Google App Engine), see below figure

3. Click finish, a new project gets created into your workspace with the specified name (not another one), see below the package hierarchy.

4. Inside the new created application we have an XML file located on the root of the packages, with the name of the project, it defines any dependency to other modules, and also it may contain application entry point. 5. The project gets created with a greeting sample, so you can run it and preview result. 6. The package consists of the following a. Client: all the code that will be translated into JS code, a list of java permitted classes is listed here. in order to call another class from another client module we have to import it on the module XML files b. Server: anything you want to write is permitted here, and you can use objects from client. c. Shared: classes that can be used in both packages 7. The above packages are required in order for the compiler to resolve dependencies and linking produced files.

Set up and run Ext-GWT samples


Navigate here to access Ext website, from here we will download the ExtGWT required libraries as well as the sample source code for Ext-GWT. First go to download page and download Ext GWT 2.1.1 SDK compatible with GWT 2.0 Including full source code, build, HTML javadoc documentation and samples. Follow these steps to get Ext-GWT sample into your eclipse:

1. Extract the Ext-GWT 2. Create a new GWT project into eclipse (gxt-app). 3. Copy the gxt.jar library into gxt-app\war\WEB-INF\ and add it to class path 4. Open sample folder and copy source code from the following folders into your gxt-app source code (examples, explorer, mail, resources, webdesktop). 5. Extract the examples.war file and copy these file (code, data, gxt, pages, samples, shared) into gxt-app\war\ folder, also copy the html files (host files) inside the war. 6. Finally copy the web.xml inside the WEB-INF to your gxt-app\war\WEBINF\ 7. You will notice that this servlet (feedservice) does not have a code into your workspace. 8. Your work space will look like the following figure

9. In order to launch the sample application select Run configuration in order to create new run configuration for our application

10.In the wizard right click on Web application, and select New

11.Fill in the required field and apply configuration

12.Notice that we use the (com.google.gwt.dev.DevMode) package as the main class, this class is used only when we are on the development mode to facilitate debugging of the source. 13.Notice that GWT plugins install an embedded web server (jetty ) in order to run gxt application, you can see server configuration beside the Main tab. 14.The arguments tab also is important to pass parameters to the server, we will return again to talk about some needed configuration. 15.After creating a run configuration select Run and from it select your created configuration (gxtConf ), a list of available module is listed in a development mode tab, you can then select any module to run.

16.To select desktop sample module right click the record and select copy to copy the URl, and use it into your preferred browser to open it.

17.The first time you run the application in development mode the browser will ask you to download a plug-in, you have to download this plug-in in order to view the application, note that this plug-in is not needed in the deployment mode, and see below the desktop sample page.

Define data source (jetty)


Creating and lugging data source into jetty server is not a straight forward operation, to do so, we have first to write custom launcher class, then create a jetty environment configuration file, and finally add an argument to the server to take into account the custom launcher while starting application. Follows detailed steps to create and define your jetty data source. 1. Create custom jetty launcher class, name it for example (MyCustomJettyLauncher), the implementation of this class is attached to this document. 2. Add the following argument in the configuration arguments tab -server com.progressoft.ecc.MyCustomJettyLauncher 3. Configure and place (jetty-env.xml ) inside war\WEB-INF\ 4. Place the following jars (jetty-naming.jar, jetty-plus.jar) inside WEB-INF folder.

Attachments

jetty-naming-6.1.22.jar jetty-plus-6.1.22.jar jetty-env.xml MyCustomJettyLauncher.java

You might also like