Teams Winter 2011/team2/lab2
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
- Click 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]