Welcome To Eclipse. Basic Concepts Workspace – directory where your projects are stored...

13
Welcome To Eclipse

Transcript of Welcome To Eclipse. Basic Concepts Workspace – directory where your projects are stored...

Page 1: Welcome To Eclipse. Basic Concepts Workspace – directory where your projects are stored –Projects grouping of related works –Resources generic term to.

Welcome To Eclipse

Page 2: Welcome To Eclipse. Basic Concepts Workspace – directory where your projects are stored –Projects grouping of related works –Resources generic term to.

Basic Concepts

• Workspace – directory where your projects are stored

– Projects• grouping of related works

– Resources• generic term to represent projects, folders, or files

• Workbench – the IDE rich client – Features

• collection of plug-ins to implement an eclipse product

– Plug-in• provides some eclipse functionality

Page 3: Welcome To Eclipse. Basic Concepts Workspace – directory where your projects are stored –Projects grouping of related works –Resources generic term to.

Workbench

• Perspectives– grouping of views and editors for a

specific purpose

• Views– provide navigation or information

• Editors– provide a view for the sole purpose of

editing key elements

Page 4: Welcome To Eclipse. Basic Concepts Workspace – directory where your projects are stored –Projects grouping of related works –Resources generic term to.

Workbench

PackageExplorer

Views

EditorArea

Views

(typically outline based)

Supporting Views

Page 5: Welcome To Eclipse. Basic Concepts Workspace – directory where your projects are stored –Projects grouping of related works –Resources generic term to.

Java Perspective

• Lets walk thru and show– how to create a java project– how to creating a java class– how to use the auto complete– how to run our java program– how to debug our java program– how to test our java program with JUnit– how to set the preferences and settings

Page 6: Welcome To Eclipse. Basic Concepts Workspace – directory where your projects are stored –Projects grouping of related works –Resources generic term to.

Slides to refresh your memory

Page 7: Welcome To Eclipse. Basic Concepts Workspace – directory where your projects are stored –Projects grouping of related works –Resources generic term to.

Create a Java Project

1. File New Java Project

2. Follow the dialog screens answering the questions(call the project MyFirstProject)

Page 8: Welcome To Eclipse. Basic Concepts Workspace – directory where your projects are stored –Projects grouping of related works –Resources generic term to.

Create a Java Class

1. Right click on the project and select new class from the popup menu

2. Fill in the dialogPackage: edu.cs205aa.student.learning

Class: Factorial

Select for the main method to be created.

Page 9: Welcome To Eclipse. Basic Concepts Workspace – directory where your projects are stored –Projects grouping of related works –Resources generic term to.

Adding the Implementation

• Now we are already to add in the implementation for the new Factorial class

• Update the code

Page 10: Welcome To Eclipse. Basic Concepts Workspace – directory where your projects are stored –Projects grouping of related works –Resources generic term to.

Creating a JUnit test

1. Right click on the class in the project explorer and add a JUnit test

2. Fill in the dialog for the testpackage: edu.cs205aa.student.learning.test

3. add the test code

Page 11: Welcome To Eclipse. Basic Concepts Workspace – directory where your projects are stored –Projects grouping of related works –Resources generic term to.

Run the JUnit Test

• Run the JUnit test by selectingRun as JUnit Test

• The test failed …something is wrongwe need to debug

Page 12: Welcome To Eclipse. Basic Concepts Workspace – directory where your projects are stored –Projects grouping of related works –Resources generic term to.

Debug Java Code

• Add a breakpointby right clicking on the left-hand column and “Toggling Breakpoint”

• Then run the debuggerby Debug As Junit Test

• Then you step thru the code and look at variable values, call stack, …

Page 13: Welcome To Eclipse. Basic Concepts Workspace – directory where your projects are stored –Projects grouping of related works –Resources generic term to.

Finding the problem …

• Debugging the test we can determine the problem is we used an internal variable of int instead of long and we are loosing precision