Difference between revisions of "Teams Winter 2011/team2/lab2"
(Created page with '=Tutorial= ==Prerequisites== * Download [http://www.eclipse.org/downloads/packages/eclipse-classic-361/heliossr1 Eclipse Classic] ==Creating and Setting the Interface Bundle== *R…') |
|||
Line 9: | Line 9: | ||
*Enter the following information that is seen in the image below | *Enter the following information that is seen in the image below | ||
[[File:PluginT2.png]] | [[File:PluginT2.png]] | ||
− | *Click Next | + | *Click Next->Finish |
− | |||
− | |||
*Now open the src folder, right-click on the pre-created bundle, and create a class called "Weather" and an interface called "WeatherSystem" | *Now open the src folder, right-click on the pre-created bundle, and create a class called "Weather" and an interface called "WeatherSystem" | ||
*Copy and paste the following code to their respective file | *Copy and paste the following code to their respective file |
Revision as of 20:58, 17 February 2011
Tutorial
Prerequisites
- Download Eclipse Classic
Creating and Setting the Interface Bundle
- Run Eclipse
- Select/Enter your preferred workspace in the text box provided and click okay
- After Eclipse has completed loaded, create a plug-in by clicking on "File" on the menu bar then scroll to New->Project->Plug-in
- Enter the following information that is seen in the image below
- Click Next->Finish
- Now open the src folder, right-click on the pre-created bundle, and create a class called "Weather" and an interface called "WeatherSystem"
- Copy and paste the following code to their respective file
Weather
package ecl.team2.lab2.weather; public class Weather { private String city; private float tempInCelcius; private float rainInMM; private float snowInMM; private float windspeedInKM; private char windDirection; public Weather(String pcity, float ptemp, float prain, float psnow, float pwspeed, char pwdirection){ this.setCity(pcity); this.setTempInCelcius(ptemp); this.setRainInMM(prain); this.setSnowInMM(psnow); this.setWindspeedInKM(pwspeed); this.setWindDirection(pwdirection); } public void setWindDirection(char windDirection) { this.windDirection = windDirection; } public char getWindDirection() { return windDirection; } public void setWindspeedInKM(float windspeedInKM) { this.windspeedInKM = windspeedInKM; } public float getWindspeedInKM() { return windspeedInKM; } public void setSnowInMM(float snowInMM) { this.snowInMM = snowInMM; } public float getSnowInMM() { return snowInMM; } public void setRainInMM(float rainInMM) { this.rainInMM = rainInMM; } public float getRainInMM() { return rainInMM; } public void setTempInCelcius(float tempInCelcius) { this.tempInCelcius = tempInCelcius; } public float getTempInCelcius() { return tempInCelcius; } public void setCity(String city) { this.city = city; } public String getCity() { return city; } }
WeatherSystem
package ecl.team2.lab2.weather; public interface WeatherSystem { Weather getWeather(String city) throws Exception; }
- Save and close both files and now open the manifest file
- Click on the runtime tab then click on add in the "export packages" panel.
- click on the ecl.... package and click okay
[[File:Mani2T2.png]