Difference between revisions of "Teams Winter 2011/team2/lab3"

From CDOT Wiki
Jump to: navigation, search
Line 1: Line 1:
 
=Tutorial=
 
=Tutorial=
In this tutorial,
+
In this tutorial, we are creating an RCP application to inform the user of current weather temperatures in major cities of Canada. We will use our previous lab 2 classes and alter them according to our specification for this lab. For reference material, we are using  [http://www.vogella.de/articles/EclipseRCP/article.html#architecture_overview Eclipse RCP] and [http://www.vogella.de/articles/EclipseJFaceTable/article.html#jfaceviewers Eclipse JFace Table] tutorial.
 
==Prerequisites==
 
==Prerequisites==
 
*Download [http://www.eclipse.org/downloads/packages/eclipse-rcp-and-rap-developers/heliossr2 Eclipse RCP & RAP Developer]
 
*Download [http://www.eclipse.org/downloads/packages/eclipse-rcp-and-rap-developers/heliossr2 Eclipse RCP & RAP Developer]
  
==Create a RCP Application==
+
=Create a RCP Application=
=Run a RCP Application=
+
==Run a RCP Application==
 
*Run Eclipse
 
*Run Eclipse
 
*Select/Enter your preferred workspace in the text box provided and click okay
 
*Select/Enter your preferred workspace in the text box provided and click okay
Line 41: Line 41:
 
*Redo the same step previously to run the application and your window should be larger and have both header and footer bars.
 
*Redo the same step previously to run the application and your window should be larger and have both header and footer bars.
 
[[File:FWindowpop2T2.png]]
 
[[File:FWindowpop2T2.png]]
=Configure Your Run=
+
==Configure Your Run==
 
*To ensure your application has all the resources, files, etc. required to run, we need to modify the "Run Configuration" for our application.
 
*To ensure your application has all the resources, files, etc. required to run, we need to modify the "Run Configuration" for our application.
 
*Right-click the "MANIFEST" file, scroll down to "Run As", and then highlight and click "Run Configurations..."
 
*Right-click the "MANIFEST" file, scroll down to "Run As", and then highlight and click "Run Configurations..."
 
[[File:RunconfT2.png]]
 
[[File:RunconfT2.png]]
 +
*The "Run Configurations" window is now present. From here, click on the Plug-in tab and check the box "Validate plug-ins automatically prior to launching" and click Apply. This will essentially provide you with all the plug-ins needed for your program to work during runtime.
 +
[[File:Runconf2T2.png]]
 +
====

Revision as of 22:53, 11 March 2011

Tutorial

In this tutorial, we are creating an RCP application to inform the user of current weather temperatures in major cities of Canada. We will use our previous lab 2 classes and alter them according to our specification for this lab. For reference material, we are using Eclipse RCP and Eclipse JFace Table tutorial.

Prerequisites

Create a RCP Application

Run a RCP Application

  • Run Eclipse
  • Select/Enter your preferred workspace in the text box provided and click okay

RcpwT2.png

  • After Eclipse has completed loaded, create a plug-in project by clicking on "File" on the menu bar then scroll to New->Project->Other. A wizard should pop-up in which you should progress to click on the "Plugin-in Development" tree, select "Plug-in Project", and click next.

WizwT2.png

  • Enter the following information that is seen in the image below

Wiz2wT2.png Wiz3wT2.png Wiz4wT2.png

  • Since we decided to use a template to create our first project, there are already a few predefined classes that we will alter to suit our requirements for this lab.
  • What you should see in your Eclipse environment is something that looks very similar to the picture below

EclipseStartT2.png

  • In the "MANIFEST" file, click on "Launch an Eclipse Application", this will run the "Hello RCP" template program that has not been edited yet. Running this application as is will result in a window to pop-up.

ManiRun1T2.pngFWindowpopT2.png

  • Lets open "ApplicationWorkbenchWindowAdvisor.java" file so we can alter the window of our application.
  • Replace the following method with the one below
public void preWindowOpen() {
     //Retrieves the main window
     IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
     //Sets the size of the window
     configurer.setInitialSize(new Point(600, 500));
     
     //Header bar becomes available
     configurer.setShowCoolBar(true);
   
     //Footer bar becomes available
     configurer.setShowStatusLine(true);
       
     //Title of the window
     configurer.setTitle("My First RCP Application"); //$NON-NLS-1$
}
  • Redo the same step previously to run the application and your window should be larger and have both header and footer bars.

FWindowpop2T2.png

Configure Your Run

  • To ensure your application has all the resources, files, etc. required to run, we need to modify the "Run Configuration" for our application.
  • Right-click the "MANIFEST" file, scroll down to "Run As", and then highlight and click "Run Configurations..."

RunconfT2.png

  • The "Run Configurations" window is now present. From here, click on the Plug-in tab and check the box "Validate plug-ins automatically prior to launching" and click Apply. This will essentially provide you with all the plug-ins needed for your program to work during runtime.

Runconf2T2.png

==