IntroductionWelcome| 00:00 | (music playing)
| | 00:04 | Hello! My name is Charles Kelly.
| | 00:06 | Eclipse is a platform for
building and using digital tools.
| | 00:10 | I'll begin by showing you how to
download separate versions of Eclipse
| | 00:13 | that support Java, PHP, C and C++ and JavaScript.
| | 00:20 | The course proceeds by showing you how
to create and run a Hello World program
| | 00:23 | that is written in Java.
| | 00:26 | Eclipse is organized into
perspectives, editors and views.
| | 00:29 | The course shows you how you can change
in the default organization to suit
| | 00:33 | your preferences and improve your productivity.
| | 00:36 | Next, we create and debug a simple
cryptography example that uses
| | 00:41 | only addition and subtraction to
demonstrate features of the Java-Editor.
| | 00:46 | The final chapter explains how to
extend Eclipse by using Update Sites
| | 00:50 | to install new software into Eclipse.
| | 00:53 | I hope that you enjoy this course.
Let's begin.
| | Collapse this transcript |
| Using the exercise files| 00:00 | The Exercise Files for this course are
freely available to all members of lynda.com.
| | 00:05 | The files contain Java source code.
| | 00:07 | I'll use Eclipse to import this code
into a general project,
| | 00:11 | which I explain in the course, then copy
and paste the code into a Java project,
| | 00:16 | which I also explain in the course.
| | 00:17 | I'm using this code to illustrate features
of Eclipse, not to create a final project.
| | 00:23 | It's not necessary that you use this code
or any other code to complete the course.
| | 00:28 | Let's get started.
| | Collapse this transcript |
|
|
1. Getting Started with EclipseDownloading and installing Eclipse for Windows| 00:00 | Eclipse is an open-source project
and it is relatively easy to install.
| | 00:04 | Eclipse does not impose restrictions upon how
or where you install it on your computer.
| | 00:09 | The first step is to use a Web browser
and navigate to the Eclipse Foundation's
| | 00:13 | home page, which is located at eclipse.org.
| | 00:16 | After navigating to the download page, press
the prominently displayed Download button
| | 00:21 | and your browser will be
directed to the download page,
| | 00:25 | which displays many versions of Eclipse.
| | 00:27 | I recommend that you select Eclipse Classic.
The current version is 4.2.1.
| | 00:33 | Select the version which is displayed
at the time you navigate to this page.
| | 00:38 | The next step is to select the
operating system for your computer.
| | 00:42 | In our case, we'll select the
Windows 64 Bit operating system.
| | 00:47 | You'll be directed to the Download page,
which contains many mirrors.
| | 00:51 | I recommend that you select the
first mirror which is displayed,
| | 00:55 | save the file to your computer.
| | 00:56 | After you've downloaded Eclipse, you'll need
to extract it into a folder on your computer.
| | 01:02 | Select Eclipse, then select Extract All
and then select a location.
| | 01:08 | We've created a folder on our computer.
| | 01:11 | The name of this folder is Eclipse01,
choose the folder, give it
| | 01:17 | any name that you like and extract
Eclipse into that folder.
| | 01:20 | After you've extracted Eclipse,
navigate to the folder that you've chosen,
| | 01:24 | in our case Eclipse01.
| | 01:27 | If you choose, you may install
multiple copies of Eclipse on your computer.
| | 01:31 | If you do choose installed multiple
copies, I recommend that you establish
| | 01:34 | a separate workspace folder for each
copy of Eclipse that you install.
| | 01:38 | For example, create a new
folder and name it workspace.
| | 01:44 | Once you've installed Eclipse
navigate to the Eclipse folder,
| | 01:48 | you can open Eclipse by
double-clicking on this icon.
| | 01:51 | Also as an option if you like, you can
create a shortcut; right-click to open
| | 01:57 | a context menu and choose Create
Shortcut, rename the shortcut.
| | 02:02 | After you've created the shortcut, drag it
to your desktop; you can now open Eclipse
| | 02:07 | by double-clicking on the shortcut icon.
| | 02:11 | Windows will display a security warning,
uncheck this box and select Run,
| | 02:17 | you'll see the splash screen for
the JUNO version of Eclipse.
| | 02:20 | It will take a moment to open.
| | 02:23 | At this point, Eclipse is
prompting you to select a workspace.
| | 02:27 | What you'll do is browse to the
workspace that you have just created.
| | 02:32 | I recommend that you check this box
and use this location as your
| | 02:35 | default location for projects.
| | 02:37 | You'll have the option once you're
in Eclipse to change this selection.
| | 02:41 | In the next movie, we'll explain
how to navigate through the various
| | 02:46 | features of Eclipse.
| | Collapse this transcript |
| Downloading and installing Eclipse for Mac| 00:00 | Eclipse is an open-source project
and it is relatively easy to install.
| | 00:04 | Eclipse does not impose restrictions upon
how or where you install it on your computer.
| | 00:10 | Go to the Eclipse Download page, which
is located at eclipse.org/downloads.
| | 00:17 | Navigate to Eclipse Classic 4.2.1 and select
the operating system that you want to use.
| | 00:23 | Click on the Download button.
| | 00:26 | After the download is completed,
create a folder where you'd like
| | 00:29 | to store Eclipse on your computer.
| | 00:31 | I recommend that you open this folder and
within the folder, create a workspace folder.
| | 00:36 | Now, extract the contents of the zip
file into the folder that you created.
| | 00:45 | Go into the Eclipse folder and
double-click on the Eclipse icon.
| | 00:49 | Now browse to the workspace folder that
you just created and associate it
| | 00:54 | with this version of Eclipse.
| | 00:57 | You can double-click on the Welcome
tab and now you're ready to use Eclipse.
| | Collapse this transcript |
| Installing Eclipse for PHP development| 00:00 | Eclipse is an open-source project
and it is relatively easy to install.
| | 00:04 | Eclipse does not impose restrictions upon
how or where you install it on your computer.
| | 00:09 | PHP is one of the languages
supported by Eclipse.
| | 00:12 | You have two options for
working with PHP and Eclipse.
| | 00:15 | You can download PHP development tools
that are supported by Aptana or by Zend.
| | 00:20 | I recommend that you use the Aptana Studio
version of Eclipse when working with PHP.
| | 00:24 | The URL for downloading the Aptana
Studio version for Eclipse is www.aptana.com.
| | 00:33 | For more information about this
environment see Up and Running
| | 00:37 | with Aptana Studio 3 with Joe Marini
here in the lynda.com Online Training Library.
| | 00:43 | If you would like to use the Zend version
of the PHP tools, you can access these
| | 00:47 | from the Eclipse Download page.
| | 00:49 | Once you're on this page,
select the link Download All-In-One package.
| | 00:54 | You'll see the Zend Company download page,
select the operating system
| | 00:58 | from your computer and download the zip file.
| | 01:01 | After the download is complete,
extract the contents of the zip file
| | 01:06 | into any folder that you choose.
| | 01:08 | I recommend that any time you install
a version of Eclipse, that you create
| | 01:12 | a workspace folder that is associated
with that particular version of Eclipse.
| | 01:16 | Go into the eclipse-php folder;
double-click on the icon for eclipse-php,
| | 01:22 | you'll be prompted to associate
a workspace with this version.
| | 01:26 | Configuring PHP in the associated server
is beyond the scope of this course.
| | 01:31 | For more setup information,
see Installing Apache, MySQL and PHP
| | 01:37 | with David Gassner in the
lynda.com Online Training Library.
| | Collapse this transcript |
| Installing Eclipse for C/C++ development| 00:00 | Eclipse is an open-source project
and it's relatively easy to install.
| | 00:04 | Eclipse does not impose restrictions upon
how or where you install it on your computer.
| | 00:10 | The first step is to use a Web browser,
and navigate to the Eclipse Foundation's
| | 00:14 | download page, this is located
at www.eclipse.org/downloads.
| | 00:21 | Navigate to Eclipse IDE for C and C++
Developers, select an operating system,
| | 00:29 | you'll be navigated to a download-mirror,
select the download-mirror
| | 00:33 | and begin your download.
| | 00:34 | After your download is complete, extract
the contents of the zip file into a folder.
| | 00:40 | After the extraction is complete,
go to the folder where you extracted Eclipse.
| | 00:45 | I recommend that any time you install
any version of Eclipse that you also
| | 00:49 | install a workspace folder in that location.
| | 00:53 | The workspace will hold the projects
that you create within Eclipse.
| | 00:57 | Open the eclipse folder,
you'll see an Eclipse icon,
| | 01:01 | double-click on the Eclipse icon
and open the program.
| | 01:04 | If you choose, you can create a
shortcut to the program at this point.
| | 01:07 | Here's where you associate the
workspace folder that you've just created
| | 01:11 | with a particular version of Eclipse.
| | 01:13 | Click this box. Click OK.
| | 01:16 | You can ignore this warning
and you can ignore this one,
| | 01:21 | double-click on Welcome and you'll see
the C/C++ perspective for Eclipse.
| | 01:26 | Configuring the C compiler for your
platform is beyond the scope of this course.
| | 01:31 | For more information, be sure to check
out C and C++ Essential Training
| | 01:36 | with Bill Weinman here in the
lynda.com Online Training Library.
| | 01:40 | That course provides a deep dive into
C and C++ using the Eclipse environment.
| | 01:45 | For the rest of this course,
I'll be using Java to demonstrate
| | 01:49 | the various features of Eclipse.
| | Collapse this transcript |
| Installing Eclipse for JavaScript development| 00:00 | Eclipse is an open-source project
and it is relatively easy to install.
| | 00:04 | Eclipse does not impose restrictions upon
how or where you install it on your computer.
| | 00:10 | JavaScript is one of the
languages supported by Eclipse.
| | 00:13 | You have two options for working with
JavaScript, you can download JavaScript
| | 00:17 | development tools that are supported by
Aptana or the Web development tools
| | 00:21 | from the Eclipse Foundation.
| | 00:23 | I recommend that you use the Aptana Studio
version of Eclipse when working with JavaScript.
| | 00:28 | If you want to use the Eclipse
Foundation version of JavaScript,
| | 00:32 | go to the download page and select
Eclipse IDE for Java EE Developers,
| | 00:38 | select your operating system
and begin your download.
| | 00:41 | After the download is complete, extract
the zip file into any folder that you choose.
| | 00:46 | I recommend that whenever you
install a version of Eclipse,
| | 00:50 | you create a workspace folder that's associated
with that particular version of Eclipse.
| | 00:55 | Go to the eclipse folder, open it,
find the eclipse icon, double-click,
| | 01:00 | run the program, browse to the workspace
folder that you just created, check this box
| | 01:04 | and say OK, double click on the
Welcome tab and you're ready to start
| | 01:10 | writing JavaScript code.
| | 01:12 | Configuring a web server is
beyond the scope of this course.
| | 01:15 | For more information on setting this up,
see Installing Apache, MySQL and PHP
| | 01:21 | with David Gassner here in the
lynda.com Online Training Library.
| | 01:26 | If you need more information about
JavaScript, see JavaScript Essential Training
| | 01:30 | with Simon Allardice also here in
the lynda.com Online Training Library.
| | Collapse this transcript |
| Working with the default perspective| 00:00 | If you've downloaded Eclipse Classic 4.2,
you'll see the following Welcome screen.
| | 00:05 | You can close this anytime you want,
and you can reopen it.
| | 00:09 | It's often worthwhile if you are a new
Eclipse user to browse through
| | 00:13 | some of these sequences and topics
that are available for you here.
| | 00:17 | Right now, we'll close this view.
| | 00:19 | The first thing that you'll see
is called a Perspective.
| | 00:22 | This particular default Perspective
contains an Editor, a Package Explorer,
| | 00:28 | in the lower view you'll see
Problems, Javadoc, and Declarations.
| | 00:33 | On the right hand side,
you'll find an Outline view.
| | 00:36 | I like to create extra space
for the Editor window.
| | 00:39 | What we'll do is minimize the Outline view
and this will create extra space for the Editor.
| | 00:46 | The arrangement of the Editor and
the views is called a Perspective.
| | 00:49 | You can create your own Perspective
if you choose or reuse a Perspective
| | 00:54 | that has been created by the Eclipse team.
| | 00:57 | To open up a Perspective, use the
menu sequence Window>Open Perspective
| | 01:02 | and navigate to a particular Perspective.
| | 01:05 | For illustration, let's open the Debug Perspective.
We'll use this later in the course.
| | 01:10 | Once you've opened a Perspective,
you'll see that it's displayed
| | 01:14 | in the toolbar for perspectives.
| | 01:16 | If you wish to close a Perspective,
you can right-click
| | 01:19 | on a particular Perspective;
| | 01:21 | this will open a context menu,
and select Close.
| | 01:24 | We come back to our original
default Perspective.
| | 01:27 | Once you have a Perspective, you'll
notice that it's organized into folders.
| | 01:32 | Each folder contains a group of views.
| | 01:35 | You can add views to these folders.
| | 01:37 | In order to add a view, what you'll do
is you navigate to the Windows menu,
| | 01:41 | select Show View.
| | 01:43 | Now I want to display a Properties view,
and I happen to know
| | 01:48 | that it's located in the General folder.
| | 01:50 | So what you can do is after you select
Show View, select Other,
| | 01:55 | open the General folder and navigate to the
Properties view, double-click on the Properties view
| | 02:01 | and it will be displayed in the folder.
| | 02:03 | You can use the same sequence to add
any view to any folder that you choose.
| | 02:09 | Also an interesting property of Eclipse
is that you can move views into
| | 02:13 | different positions on the screen.
| | 02:15 | For example, we can take our Properties view
and move it here to this folder,
| | 02:19 | just as easily we can move it back again.
| | 02:22 | Now the Properties view
does not contain information.
| | 02:26 | Later, when we create a Java project,
the Properties view will display the
| | 02:30 | information about the project and
the components within the project.
| | Collapse this transcript |
| Exploring the toolbar| 00:00 | The Java Perspective, like most perspectives,
contains a main menu and a toolbar.
| | 00:05 | Most features within Java Perspective
can be accessed from a menu, a toolbar icon,
| | 00:10 | or a context-sensitive pop-up menu.
| | 00:13 | The Source, Refactor, and Navigate menu
items are specific to Java programming
| | 00:18 | and we'll cover them in a future movie.
| | 00:21 | The File menu contains Save and
Save As, Import and Export items.
| | 00:27 | These are replicated on the toolbar
with icons for Save, Save All
| | 00:32 | and there is also a Print icon.
| | 00:34 | The Search menu item is useful for navigating
among multiple projects, and among
| | 00:39 | multiple pieces of source code within projects.
| | 00:43 | Search also has a toolbar icon.
| | 00:45 | The Project menu controls the display
of projects and permits you to choose
| | 00:50 | when source code within your projects is built.
| | 00:54 | Building refers to preparing
source code to run on computers.
| | 00:57 | The toolbar contains many icons
that apply only to Java programming.
| | 01:02 | We'll consider some of
these later in the course.
| | 01:05 | These include Debug, Run, Run Last.
| | 01:09 | Also you'll see Skip All Breakpoints,
this refers to debugging;
| | 01:13 | a New Java Package refers to creating items
for Java programming; creating New Java Classes.
| | 01:20 | Finally, you'll see these arrows.
| | 01:22 | As we learn to edit source code, you'll
have the ability to go through
| | 01:28 | and jump to previous locations and jump
forward, that's what these arrows are for.
| | 01:33 | Right now, as you begin to learn Eclipse,
you can skip learning about these,
| | 01:38 | we'll cover the important
ones later in the course.
| | 01:42 | The Window menu item permits you to
reorganize the display of perspectives,
| | 01:47 | and the display of views within perspectives.
| | 01:50 | As you may suspect, the Help menu
provides access to information
| | 01:55 | about using Eclipse and its components.
| | 01:56 | It also provides the ability to search
for new versions of Eclipse components
| | 02:01 | by checking for updates.
| | 02:03 | It will also help you to install
new software into Eclipse.
| | 02:07 | I'll illustrate using the
Help menu in a future chapter.
| | 02:10 | Eclipse permits you to change
many features through Preferences.
| | 02:14 | As you can see, there are a
large number of preferences.
| | 02:19 | For this example, I'll change the font
size for displaying files within editors.
| | 02:23 | As you'll see later throughout the course,
Eclipse contains many editors.
| | 02:28 | To change the font size, what we'll
do is we'll expand Appearance, we'll
| | 02:32 | select Colors and Fonts, we'll go to Basic
and now we'll select Text Font and edit this.
| | 02:40 | What we'll do is we'll select a particular Font,
Calynda, and we'll select
| | 02:46 | a 16 point Font Size.
| | 02:49 | The next thing that we'll do is
we'll add line numbers to Text Editors.
| | 02:53 | To do this, what we'll do is we'll
expand the Editors selection,
| | 02:58 | we'll expand Text Editors
and we'll select Show line numbers.
| | 03:03 | When we're done, we'll select OK.
| | 03:05 | These changes will appear anytime
that you open a text file within Eclipse.
| | 03:10 | Eclipse contains a large number of preferences.
| | 03:13 | The ability to change even a few of
these will help you to customize Eclipse
| | 03:17 | to a style that works best for you.
| | Collapse this transcript |
|
|
2. Working with Projects in EclipseCreating a new project| 00:00 | Projects are the basic unit of work
and organization within Eclipse.
| | 00:04 | You can choose any name that
you like for your projects.
| | 00:07 | To create a project, navigate
to the File menu, select New.
| | 00:11 | This will bring up the New Project wizard.
| | 00:13 | Select the type of project
that you wish to create.
| | 00:16 | In our case, we are going
to use a General Project.
| | 00:19 | Give the Project a name and select Finish.
| | 00:22 | Once you have a project within Eclipse,
you can populate it with text files,
| | 00:26 | Java files, and other artifacts.
| | 00:29 | For example, if you would like to include
a text file within your project,
| | 00:33 | again select New, this time we'll
select File, we'll give it a File name,
| | 00:39 | select Finish and now we'll type.
| | 00:40 | Note that this file has file numbers.
| | 00:44 | The reason for this is that in the previous movie,
when we were examining Preferences,
| | 00:48 | we chose to add file numbers.
| | 00:51 | Also note the size of this font
and the font that we are using.
| | 00:55 | In the previous movie, we selected
Calynda in a 16-point type.
| | 01:00 | This file contains unsaved information
and Eclipse tells us this by using
| | 01:05 | a small asterisk (*) in the
tab that has the filename.
| | 01:09 | If we type Ctrl+S for Save, the file
is saved and the asterisk (*) goes away.
| | 01:15 | Let's create a second project.
| | 01:16 | Again, it's New>Project>General>Next
and let's give it new project name.
| | 01:23 | There may be times when you will find
it convenient to access files and folders
| | 01:26 | from your computer's file system within Eclipse
rather than switching back and forth
| | 01:30 | between Eclipse and
your computer's file explorer.
| | 01:34 | To do this, we'll import
files into a particular project.
| | 01:38 | Open the context menu with the right-click,
select Import, select File System,
| | 01:44 | browse to the location where you would
like to import files from, expand
| | 01:49 | and select the files that you'd like to
import into Eclipse, select Finish.
| | 01:54 | Now, if we expand the Project, you
will see the files that are available.
| | 01:58 | In particular, if we double-click on
this textfile, it's imported into Eclipse.
| | 02:02 | There will be times when you'll need
more space on your screen to
| | 02:07 | work with a particular text file.
| | 02:08 | You can do this by navigating
to the tab, double-clicking.
| | 02:12 | Once you've finished working with the
information and you would like
| | 02:16 | to change the Editor to its previous size,
again, double click on the tab.
| | 02:20 | As you proceed through the course,
you'll find these features for using
| | 02:24 | projects, editors, and files to be very useful.
| | 02:27 | We'll use them in future
movies within this course.
| | Collapse this transcript |
| Creating a Java project| 00:00 | In this movie, we'll take a
first look at a Java-Editor.
| | 00:03 | Note that we've copied this file HelloWorld.java
into the Exercise Files from Chapter 2.
| | 00:09 | Eclipse requires that all
Java files being a Java project.
| | 00:13 | To create a Java project, we use the
context menu, New and Java Project.
| | 00:18 | Give the Project a name and we'll select all
the defaults, select Finish and we have a Project.
| | 00:25 | A Java requirement is that all Java-class
files exist within a namespace.
| | 00:32 | This namespace is encapsulated by a package.
| | 00:35 | In order to create a package what we do
is; we use the context menu,
| | 00:40 | same New and Package, and we'll give this the name
com.charleskelly.hello, select Finish.
| | 00:46 | Now what we'll do is we'll take this
HelloWorld.java file from our previous project,
| | 00:51 | copy it, and paste it,
into this package.
| | 00:56 | If we expand the package, we see the
HelloWorld.java file, we can double-click on it,
| | 01:00 | and we can see the file.
| | 01:02 | We are not going to do any programming
right now, but what we'd like to do is see
| | 01:06 | if we have a file that contains a
valid Java class file, we can run that
| | 01:12 | from within Eclipse.
| | 01:13 | In order to do this, we select the
context menu, select Run As,
| | 01:19 | and run this as a Java Application.
| | 01:20 | And as you'll see, HelloWorld is
printed here in the Console view.
| | 01:25 | Alternatively, what we could've done is
used these buttons here: Debug, Run, etcetera.
| | 01:33 | If we select Run, the same thing happens;
| | 01:36 | HelloWorld is presented in the Console view.
| | 01:39 | The idea of a HelloWorld program comes
from the 1970s and the C language,
| | 01:44 | when it's author Brian Kernighan established
Hello World as a method of determining
| | 01:49 | whether a valid file could be created,
and whether that file could run
| | 01:54 | on a particular computer.
| | 01:56 | If you follow these steps and you
see HelloWorld in your Console view,
| | 02:00 | you'll know that your Eclipse version is properly
configured and you can run Java programs.
| | Collapse this transcript |
| Customizing the code style| 00:00 | Most software engineers
have a preferred coding style.
| | 00:03 | Braces placement is one element of coding style.
| | 00:06 | I prefer that Braces align
vertically within the code.
| | 00:10 | You can change this with Preferences
by creating a customized Formatter.
| | 00:14 | Again, we'll use the Window menu item
to select Preferences.
| | 00:18 | However, Braces placement is specific
to the Java Editor rather than being
| | 00:23 | a feature of all text editors.
| | 00:25 | Navigate to the Java item, expand it,
expand Code Style, go to Formatter,
| | 00:31 | press New and give a name to your Formatter, press OK.
| | 00:35 | Eclipse provides many items that you can format;
| | 00:38 | Braces is only one of these.
| | 00:40 | Select the Braces tab.
| | 00:42 | Notice the Empty interface and
the alignment of brackets here.
| | 00:47 | Look at Class or interface declaration
and then this dropdown.
| | 00:52 | Use the dropdown to change this
to Next line and notice the change
| | 00:56 | in the placement of braces.
| | 00:57 | In this course, we'll select Next line
for all of these dropdown items.
| | 01:02 | If you'd like, you can experiment with
changing options and these other items.
| | 01:06 | For example, look at Control Statements,
you can do the same thing with
| | 01:11 | Control Statements that we just did with Braces.
| | 01:13 | After you have finished
choosing your options select OK.
| | 01:17 | Press OK one more time.
| | 01:19 | As with General preferences, you can
change Java Preferences
| | 01:23 | to customize Eclipse to your
preferred styles and workflows.
| | Collapse this transcript |
| Using the Package Explorer and Navigator| 00:00 | Modern operating systems have file explorers
that filter the presentation of files and folders.
| | 00:06 | Typically, the default presentation
does not display certain hidden files.
| | 00:10 | The Package Explorer that is currently
displayed on the left-hand side
| | 00:14 | of the Workspace is similar.
| | 00:15 | It does not display the binary files
created from Java source code
| | 00:19 | and it does not display internal Eclipse files.
| | 00:22 | The file navigator view is similar
to an operating system file system explorer.
| | 00:27 | We can open this view using the sequence
Window>Show View>Other>Navigator.
| | 00:34 | If we choose to open our previous project
in the File Navigator instead
| | 00:37 | of having it opened in the Package Explorer,
we'll see two new folders,
| | 00:42 | a .settings folder and a binary folder.
| | 00:44 | We'll also see two new files
a .classpath file and a .project file.
| | 00:49 | If we expand the binary folder,
we can navigate in the style
| | 00:54 | through these folders that Java prepares
for us and we'll notice there's
| | 00:58 | a HelloWorld.class file.
| | 01:00 | The .class file is a binary file that
contains Java byte code and in the context
| | 01:05 | of a Package Explorer, it's similar
to a hidden file in a file explorer.
| | 01:10 | Similarly, the .project file is not
displayed in the Package Explorer,
| | 01:15 | but we can see the contents of the
files and it contains ordinary XML.
| | 01:19 | Similarly, if we double click on the
.classpath file, we can see the classpath entries.
| | 01:25 | Although, you usually not need these
when you are writing Java code,
| | 01:29 | it's interesting to know how to
find them if you do need them.
| | Collapse this transcript |
| Changing views and perspectives| 00:00 | You can rearrange the views on the Desktop
to accommodate your preferred workflow.
| | 00:04 | Also, you can save an arrangement
of views as a Perspective.
| | 00:08 | For example, you can move the File
Navigator that we just opened
| | 00:12 | to a new position within the Workspace.
| | 00:15 | To save a new arrangement of views
as a Perspective, use the sequence
| | 00:19 | Window>Save Perspective As
and give the Perspective a name.
| | 00:24 | You can return to your previous
Perspective, that is the Java perspective,
| | 00:28 | by clicking Java, OK.
| | 00:31 | This reopens that default Perspective
and contains the Outline view
| | 00:35 | that we previously minimized.
| | Collapse this transcript |
|
|
3. Building and Testing SoftwareIntroducing the project| 00:00 | In this movie, we'll explore
a fun and interesting project
| | 00:03 | that develops encryption tools.
| | 00:05 | It sounds sophisticated, but the
only mathematics that we'll use
| | 00:08 | are addition and subtraction.
| | 00:10 | This movie isn't about cryptography;
it's about learning the software
| | 00:13 | development tools within Eclipse.
| | 00:15 | However, we'll cover just enough
cryptography so that you'll have
| | 00:19 | a basic understanding.
| | 00:20 | The slide contains an illustration
of a Caesar cipher where the key = 3.
| | 00:25 | To encrypt your plain text which is
the message that you want to protect,
| | 00:29 | you shift each letter in the message three
positions, so that an A becomes a D,
| | 00:35 | a B becomes an E, a C becomes an F, etcetera.
| | 00:38 | When the recipient receives a message,
he or she works in the opposite direction,
| | 00:42 | moving from the bottom row to the top row.
| | 00:45 | While this may have been sufficient
during the Roman Empire,
| | 00:49 | most modern amateur cryptographers
can break this code without using a computer.
| | 00:53 | We'll explore cryptography using a one-time pad.
| | 00:56 | If you have ever seen the Spy movie
where the courier was carrying a briefcase
| | 01:00 | that is handcuffed to his or her wrist,
then you'll understand
| | 01:03 | the theory behind a one-time pad.
| | 01:05 | It is difficult to transfer
the keys within a one-time pad.
| | 01:09 | This is in contrast of public key
cryptography that you've probably used,
| | 01:14 | for example, when your browser accesses
a Web site using the https protocol.
| | 01:20 | In the exercises for this movie,
you'll emulate the role of a software tester.
| | 01:25 | The Exercise Files contain the encryption software.
You will write the test code
| | 01:30 | to ensure that the encryption works properly.
| | Collapse this transcript |
| Using the editor| 00:00 | This movie shows advanced editing
techniques within the Java Editor.
| | 00:04 | The Exercise Files contain Java
classes that provide encryption.
| | 00:08 | You will use the Java Editor
to create JUnit classes.
| | 00:12 | In the HelloWorld exercise you created
a Java class that contained a main method.
| | 00:16 | A software engineer might never write
a main method in his or her
| | 00:20 | entire professional career.
| | 00:22 | The reason is that most Java code
runs within a container, for example,
| | 00:27 | a Java Enterprise Edition Application Server
or a Web Server.
| | 00:31 | JUnit provides a container for running test
classes, and Eclipse supports this container.
| | 00:36 | You can write Java classes that will run
inside any container, then test them using JUnit.
| | 00:43 | Your first test for this chapter
is to import the Exercise Files
| | 00:47 | into the 1_Samples project that we created.
| | 00:50 | Select Import, from the File System
browse to the location where you store
| | 00:56 | the Exercise Files, expand the folders
and import everything for Chapter 3 (Ch03).
| | 01:02 | Expand the Chapter 3 folder and
notice that there are two projects;
| | 01:06 | a CipherProject and a CipherTestProject.
| | 01:09 | The first thing that you'll do
is create two new Java projects.
| | 01:15 | Select New>Java Project and give it a name,
choose all the defaults and select Finish.
| | 01:20 | Now create a CipherTestProject
and again select Finish.
| | 01:28 | Expand the CipherProject.
| | 01:30 | Now expand the Source folder, copy
everything in com and its subfolders
| | 01:36 | and place them within the source (src)
folder in the CipherProject.
| | 01:41 | Notice, the source file now contains
this small red X as a decorator
| | 01:46 | and the Problems view indicates that
there are five errors in the source files
| | 01:51 | that you copied into this new project.
| | 01:53 | Select the first error, double-click,
and the cursor in the Java Editor
| | 01:58 | will be positioned at the line
where the error occurred.
| | 02:01 | Note the red X decorators in this gutter
and the red boxes here in this gutter.
| | 02:07 | You can use these to navigate between errors.
| | 02:11 | An interesting feature of the Java Editor
is that it collapses lines of code
| | 02:15 | that contain similar statements.
| | 02:18 | If you hover over this X,
the Import Statements will be displayed.
| | 02:23 | If you click on the X,
the source code is expanded.
| | 02:27 | Note lines 10 and 11,
these are where the errors occur.
| | 02:30 | The cause for these errors is that Eclipse
and Java can't find the libraries
| | 02:36 | that contain Logger and LoggerFactory.
| | 02:39 | If we look at the code that we imported
into 1_samples, there is a jar file, slf4j.
| | 02:44 | What we need to do is copy this file
and paste it into the CipherProject.
| | 02:51 | Now what we want to do
is modify the Java class path.
| | 02:54 | While this isn't a course in Java,
it's sufficient to know that a class path
| | 02:59 | is a group of files and needed to run
any particular piece of Java code.
| | 03:04 | We can modify the class path
by modifying the properties
| | 03:08 | of a particular project.
| | 03:10 | Select Properties, go to Java Build Path,
select Libraries, then select Add JARs.
| | 03:17 | Expand the CipherProject and select the JAR
file that we just copied into the project.
| | 03:23 | Select OK, select OK one more time.
| | 03:27 | Notice that the errors went away
in the source file.
| | 03:31 | There were no errors listed in the
Problems view and there was no longer
| | 03:36 | an error decorator on the source folder.
| | 03:39 | For professional software engineers,
resolving library dependencies and class paths
| | 03:44 | are among the most difficult problems to solve.
| | 03:47 | Many features within sophisticated
build systems are devoted
| | 03:51 | to solving dependency problems.
| | 03:52 | Software engineers have varying preferences
about where to store classes,
| | 03:57 | either within the project that contains the
classes to be tested or within a separate project.
| | 04:03 | If you use Apache Maven to organize
your code, which we'll illustrate
| | 04:07 | in the advanced chapter of this course,
Maven will include the test within
| | 04:11 | the same project as the codes under test.
| | 04:13 | In this movie, we'll use a separate project,
so that we can learn to associate
| | 04:18 | external projects with a particular project.
| | Collapse this transcript |
| Using JUnit and templates| 00:00 | To illustrate your role as a software tester,
copy com and all its subfolders
| | 00:05 | into the source folder of the CipherTestProject.
| | 00:08 | Notice we have errors.
| | 00:10 | As in the previous movie, it's similar
to a build path problem and in particular
| | 00:15 | Eclipse and Java don't know about test,
and import statements for org.junit.
| | 00:21 | The easiest way to correct this
problem is to create a second test file
| | 00:25 | New>JUnit Test, give it a name, select
Finish and Eclipse tells you that JUnit 4
| | 00:31 | is not on the build path, select Yes,
we do want to add the JUnit for our library.
| | 00:38 | This time instead of having to do it manually,
using properties of the Java build path,
| | 00:42 | Eclipse will do it for us.
| | 00:45 | A temporary test case is created.
| | 00:47 | We don't need this.
| | 00:48 | So you can close this file
and you can delete the default package.
| | 00:53 | Expand the package, double-click on the
OtpTest.java file, expand the Editor
| | 00:59 | and we can take a quick look at
what's going on in the Test Case.
| | 01:03 | What we're doing is we're creating
a simple message "The quick red fox,"
| | 01:08 | we're converting that message
into a byte string.
| | 01:11 | We're encrypting it using subtraction,
we are decrypting it using addition,
| | 01:16 | we are testing if the decrypted string
is equal to our original message
| | 01:22 | and we're asserting that this is true.
| | 01:23 | Also here's a feature of the Java
Editor that's often very useful.
| | 01:28 | This particular line of code,
System.out.println, the decrypted string
| | 01:33 | is commented it out.
| | 01:34 | What you can do to add comments
to one or more lines is Ctrl+/.
| | 01:40 | Now the line is uncommented.
| | 01:42 | If I want to add comments again,
I simply use Ctrl+/.
| | 01:48 | It's considered bad form to put print line statements
within your test code, but for our examples
| | 01:53 | it will be worthwhile.
| | 01:54 | The first thing that we want to do
is run this Java test code.
| | 01:58 | To do this, right-click on the context
menu, select Run As>a JUnit Test case,
| | 02:04 | if you're prompted to save, select OK
and notice that the JUnit view appears
| | 02:10 | and we get a green bar.
| | 02:11 | This indicates that there were no problems
with our test code and that it ran successfully.
| | 02:17 | If we close the JUnit Test case
and return to our source code,
| | 02:21 | let's intentionally insert
an error into our test case.
| | 02:25 | Take this assert statement that says
assertTrue and change it to assertFalse,
| | 02:31 | save the file, once more
running as a JUnit Test case.
| | 02:37 | This time the JUnit view indicates that
there is an error by showing this red bar.
| | 02:43 | If you're doing your own testing and
you see that an error occurs,
| | 02:47 | what you can do is double-click on the line
in the JUnit view and again the cursor,
| | 02:52 | in the Java editor will be
positioned to where the error occurs.
| | 02:56 | Once more, let's change this back to
assertTrue and this time let's leave
| | 03:01 | the print line statement in the code,
save it and run it as a JUnit Test case.
| | 03:07 | This time the Console view is opened
and the message that we encrypted
| | 03:12 | and then decrypted is presented
in the decrypted form.
| | 03:16 | The fact that we can read the quick red fox
indicates that our code
| | 03:20 | is probably working correctly.
| | 03:22 | If we've written our test cases
correctly, the green arrow shows
| | 03:26 | that our code is correct.
| | Collapse this transcript |
| Refactoring code and using Javadoc| 00:00 | In this movie, we'll illustrate
a few more features of the Java editor.
| | 00:04 | First, expand the editor, let's take a
look at this variable sillyKey,
| | 00:10 | you may not think the name is appropriate,
the reason that the key is called sillyKey
| | 00:14 | is that the sequence 0, 1, 2, 3
is very easy to guess.
| | 00:18 | Search and replace in Java is referred
to as refactoring; select a variable,
| | 00:24 | choose Refactor>Rename and give
it a new name for example myKey.
| | 00:29 | Notice that I we're typing myKey
is changing everywhere in the code.
| | 00:36 | After we hit Enter, sillyKey is replaced
with myKey everywhere in this source file.
| | 00:42 | The pop ups that you may have noticed
during this movie contain documentation
| | 00:46 | in the form of Javadoc.
| | 00:47 | When you hover the cursor over a
method name or a variable name,
| | 00:51 | the associated Javadoc appears.
| | 00:53 | This applies both to the code that you write
and to code that is written by other people.
| | 00:58 | For example, if you hover the cursor
over test message, the Javadoc appears,
| | 01:03 | but it's not very informative.
| | 01:05 | If you scroll down to the bottom
of the source file and you look
| | 01:08 | at the assertTrue method and hover here,
you'll see that the Javadoc is more informative.
| | 01:14 | In particular, you'll see that the parameters
to this method are the condition
| | 01:19 |
to be checked also the Javadoc explains
what we can expect if the test passes
| | 01:25 | or if the test fails.
| | 01:27 | An interesting feature of the Java Editor
is that it will help you write boiler code
| | 01:30 | such as Getters and Setters, hashcode methods,
equals methods and toString methods.
| | 01:36 | You'll probably never need these
methods within test cases,
| | 01:40 | but we'll illustrate them here.
| | 01:41 | First, let's start with Getters and Setters,
position the cursor within
| | 01:46 | the editor to where you'd like to
Getters and Setters to appear.
| | 01:49 | Access the context menu,
select the Source method,
| | 01:54 | then select Generate Getters and Setters,
choose the Getters and Setters
| | 01:58 | that you'd like to include, then select OK.
| | 02:00 | The accessors, the Getters and Setters
are positioned in the Java source code file.
| | 02:05 | Now let's create a toString method.
| | 02:07 | Again go to Source>Generate toString,
pick what you would like to appear,
| | 02:13 | select it, press OK.
| | 02:15 | This form of toString is often useful
within a debugger, when you don't have access
| | 02:19 | to the internals of the class
that you're using within the debugger.
| | 02:23 | I've show you a few features
of the Java Editor, there are many more.
| | 02:28 | Hopefully, we have stimulated your interest
and you'll explore these features.
| | 02:32 | In an upcoming movie, we'll show you
how to use the help system
| | 02:36 | to find these new features.
| | Collapse this transcript |
| Introducing the Eclipse debugger| 00:00 | In the previous movie, we corrected
an error that we introduced.
| | 00:03 | In this movie, we'll do the
same thing using the debugger.
| | 00:07 | The purpose is to learn how
to set breakpoints in the debugger
| | 00:10 | and how to review the value
of variables in the debugger.
| | 00:13 | Once again, we'll run the code as a
JUnit Test case, we get an error message,
| | 00:18 | and we'll navigate to the line
that contains the error code.
| | 00:21 | We'll move a few lines above where
the error is, and we'll set a breakpoint.
| | 00:26 | We can do this by double-clicking
in the gutter to the left of the line number.
| | 00:30 | After we double click, we'll see that
there's a decorator, and it tells us
| | 00:35 | that a line breakpoint has been set.
| | 00:37 | For the purpose of this demonstration,
we are going to set a second breakpoint.
| | 00:41 | We don't need it, but I want to show
you how to step through breakpoints.
| | 00:46 | In order to use the debugger, we're going to
use the Debug option instead of the Run option.
| | 00:51 | In this case, we'll use the context menu,
select Debug As and we'll select Debug it as
| | 00:56 | a JUnit Test case.
| | 00:58 | Here, Eclipse is asking us, if we want
to change our Perspective, click the box
| | 01:03 | to remember this decision, and say Yes.
| | 01:06 | The first time that we open the debugger,
this is what the Perspective will look like.
| | 01:10 | I find it convenient to minimize
the Outline view, and also let's take
| | 01:16 | the JUnit view and include it
in this Perspective.
| | 01:19 | If you recall, we already included
the JUnit view in the Java Perspective,
| | 01:24 | now we're going to include it
into the Debug Perspective.
| | 01:27 | As before, it's Windows>Show View>Other,
expand the Java tab and select the JUnit view.
| | 01:34 | After we've done this, we're ready
to step through our code.
| | 01:38 | Notice right now, the cursor is positioned
at line 25, this is where we
| | 01:43 | set our first breakpoint.
| | 01:44 | To step through our code, we'll use
the icons in the toolbar at the top
| | 01:49 | of the Debug Perspective.
| | 01:51 | The icons that you will use most often
are Step through, which is also available
| | 01:56 | on the F5 key, Step Over
on the F6 key, and Return.
| | 02:01 | If you're not familiar with debugging,
Step Into means that if you're using a method,
| | 02:06 | step into the code within that method.
| | 02:09 | The alternative is Step Over,
which means if you're using a method,
| | 02:14 | execute the entire method, and go to
the line after the call to that method.
| | 02:18 | So, what we'll do is we'll step over,
and at this point, if we continue to step over
| | 02:24 | the code, we're going to execute
every iteration of this for statement.
| | 02:30 | What we'll do is go to the next breakpoint,
and we'll use this icon.
| | 02:35 | Now you can see that we stepped
through to the breakpoint,
| | 02:39 | just a little bit before
where the error occurs.
| | 02:41 | At this point what we might want to do,
if we are actually in a debugging session,
| | 02:45 | is look at the values
of certain variables.
| | 02:48 | We can do this in the Variables view.
| | 02:50 | For example, if we highlight the messageByte,
we see the value for each item
| | 02:56 | in this byte array.
| | 02:57 | If now we go through, and we continue with
the Resume button, what's going to happen,
| | 03:02 | we'll complete the execution
of this JUnit Test case.
| | 03:06 | As before, with a Console print,
the quick red fox, however the JUnit view
| | 03:12 | shows that there's an error.
| | 03:12 | What we can do here is while we're in the
debugger, is we can step into the Editor
| | 03:17 | and correct the error.
| | 03:19 | Now this is easier than it would be in
a normal debugging situation,
| | 03:24 | since we introduced the error ourselves.
| | 03:26 | We'll save the code and once again,
we'll debug this as a JUnit Test case.
| | 03:33 | We'll step through the breakpoints, one
breakpoint, the next point, step over the code.
| | 03:38 | The print line statement shows in the
Console view, here we are completing
| | 03:42 | the code, and we'll finish.
| | 03:45 | If we look at the JUnit view now,
we'll see the green bar, and we'll know
| | 03:49 | that our test ran correctly.
| | 03:50 | This is a quick and a simple
introduction to debugging.
| | 03:54 | The debugger has many more advanced features,
but hopefully this is sufficient
| | 03:57 | to give you a flavor of what debugging
is like inside Eclipse.
| | Collapse this transcript |
| Using and customizing code completion| 00:00 | In this movie, we'll see how to
use code completion in the Java Editor
| | 00:04 | and we'll also see the interaction
between code completion and templates.
| | 00:09 | The first thing that we'll do is
we'll create a New Java Project,
| | 00:16 | expand the Project, and create a Package.
| | 00:18 | Now we'll create a Person Class
within the Package.
| | 00:29 | The first thing that we'll do is
add fields to our Person Class.
| | 00:33 | We see a red error decorator.
| | 00:35 | It tells us that date
cannot be resolved to a type.
| | 00:38 | If we click on the error decorator,
we have the option to Import 'Date'
| | 00:42 | from either Java.util
or Java.sql, select Java.util.
| | 00:47 | We now get these warning messages.
| | 00:49 | The value of the field person.fName is not used.
| | 00:52 | Essentially, what it's telling us
is that we don't have any accessors
| | 00:56 | for Getters and Setters,
and these are private fields.
| | 00:59 | Let's expand the Editor, and before
we create the Getters and Setters,
| | 01:04 | let's create constructors for this class.
| | 01:06 | The Java Editor will create the
constructors for us automatically.
| | 01:11 | Open the Context menu, go to Source
and select Generate Constructor using Fields,
| | 01:15 | deselect all the fields, so that we can create
| | 01:21 | a no argument constructor.
| | 01:22 | Now let's create our Getters and Setters.
| | 01:25 | Again, open the context menu, go to
Source, and select Generate Getters
| | 01:31 | and Setters, Select All, OK.
| | 01:35 | The next thing that we'll do is
add a method to our Person Class.
| | 01:39 | Let's use code completion to add
a try catch block to this method.
| | 01:43 | Type try, hit Ctrl+Space, you'll
see the Javadoc for the proposed
| | 01:50 | try catch block, select this.
| | 01:52 | Let's use code completion again to
insert an if then statement, type if,
| | 01:58 | Ctrl+Space and select ifelse.
| | 02:02 | As a condition, let's say if (null == this)
and use code completion,
| | 02:10 | and select dob (date of birth).
| | 02:11 | So we are saying if the date of birth
(dob) for this person is null,
| | 02:15 | we're going to throw an exception.
| | 02:16 | Now in the else block, let's add a
GregorianCalendar and when we do this,
| | 02:23 | we see more error decorators.
| | 02:24 | We can add an Import statement here, and we
can add another Import statement for calendar.
| | 02:30 | The next thing that we'll do is
extract the date from our calendar.
| | 02:34 | We'll use code completion for one more ifelse block,
and now we'll add an else statement.
| | 02:41 | If we look at the code, what we are saying
if this particular person was
| | 02:45 | born before January 1, 1900, we are
going to print out a message that says
| | 02:50 | getting kind of old.
| | 02:52 | Otherwise we'll print out a message
that says still got plenty of time,
| | 02:56 | that's the end of this class.
| | 02:57 | Now what we'll do is create a JUnit
Test class, select the same package,
| | 03:03 | say New>JUnit Test case and give
the test case a name, say OK.
| | 03:12 | Let's create another try catch block
and place this fail statement at the end
| | 03:17 | of the catch and let's substitute the
message Not yet implemented with whatever
| | 03:22 | string is generated by the Exception,
'e.' and use code completion, type t
| | 03:29 | and then select toString.
| | 03:31 | Let's create a person object.
| | 03:33 | We'll add a GregorianCalendar.
| | 03:35 | We get the same error decorators that
we received when we created the Person Class.
| | 03:39 | We'll remove those.
| | 03:46 | We'll use some more code completion,
type per Ctrl+Space, select person.s
| | 03:55 | then setDob, for our parameter, we'll
use old Ctrl+Space period (.) getTime.
| | 04:04 | Now we'll call the person's object
evaluateAge method, save the test case,
| | 04:10 | open the context menu Run As>JUnit Test.
| | 04:15 | We see the green bar and we know that the
test case ran successfully to completion.
| | 04:19 | You've seen a few examples of code completion,
and their interaction with templates.
| | 04:25 | This is a very rich source of productivity
improvements within Eclipse.
| | Collapse this transcript |
| Exploring syntax checking| 00:00 | In order to illustrate syntax checking
in the Java Editor, I've taken the code
| | 00:04 | from our previous Person Class
and I've renamed it PersonWithErrors.
| | 00:08 | As you can see if you look at the
right gutter, there are many error markers.
| | 00:13 | What we can do is we'll correct these
one at a time and we'll show
| | 00:17 | how the syntax errors are illustrated
and what we can do to correct them.
| | 00:20 | The first error that the editor
finds for us is right here on line 8.
| | 00:25 | The pop up says
Date cannot be resolved to a type.
| | 00:29 | If I click here I'm given the
option to use an Import statement.
| | 00:34 | I'll create the Import statement
using java.util and we see import
| | 00:38 | java.util.Date is now included in our code.
| | 00:42 | If I highlight our next error,
I'll come down to this statement on line 23.
| | 00:46 | String literal is not properly
closed by a double quote (").
| | 00:50 | I'll add a closing double quote
and I'll save the file
| | 00:55 | and we still have an error indicator.
What's the problem?
| | 00:58 | Well, if I highlight it one more time,
Syntax error, insert ";"
| | 01:03 | to complete BlockStatement.
| | 01:05 | If I add a semicolon (;),
the error decorator goes away.
| | 01:09 | If I go down to line 26,
GregorianCalendar cannot be resolved to a type.
| | 01:15 | This requires another import statement.
| | 01:17 | I'll import GregorianCalendar from java.util.
| | 01:20 | On line 28, calendar cannot be resolved
to a variable.
| | 01:25 | If I double click, Import 'Calendar' from
java.util, I see that we have one more error.
| | 01:31 | If dob, date of birth, equals 0,
| | 01:36 | Type mismatch: cannot convert from Date to boolean,
Type mismatch: cannot convert integer to Date.
| | 01:42 | So the syntax checking editor features
within the error are telling us
| | 01:47 | that there's a problem,
but it can't resolve the problem for us.
| | 01:51 | In particular, if you look carefully
what's happening is we're using an
| | 01:55 | assignment statement and attempting to
assign the value of 0 to date of birth,
| | 02:00 | when really what we want to say
if date of birth is equal to 0.
| | 02:05 | If I rephrase this is as
if null is equal to date of birth,
| | 02:10 | the error indicator goes away.
| | 02:12 | As a point of reference, I think it's
always a good idea when you're doing
| | 02:17 | a test between a constant such as null
and a variable to place the constant
| | 02:22 | on the left-hand side of the conditional operator.
| | 02:26 | In some languages such as scripting
languages and functional programming
| | 02:30 | languages, it's syntactically correct
to include an assignment statement
| | 02:35 | within an if statement, that's the
reason that you always want to include
| | 02:40 | the constant on the left-hand side of
the operator to avoid problems
| | 02:44 | in these types of languages.
| | 02:46 | The final thing that we see if we look in
the right-hand gutter is a blue indicator.
| | 02:51 | It's neither an error nor a warning.
| | 02:54 | It's telling us that we've included a TODO here.
| | 02:57 | If I replace the TODO indicator with
an error message from the exception,
| | 03:03 | the blue box in the right-hand gutter goes away.
| | Collapse this transcript |
|
|
4. Search and HelpSearching in Eclipse| 00:00 | As the size of your software projects grow,
it might become difficult
| | 00:03 | to remember all the locations
for variables, methods and classes.
| | 00:07 | The Eclipse internal search system
is helpful in this situation.
| | 00:11 | Suppose that you know that the word key
is contained somewhere in your workspace.
| | 00:14 | You can use the search system to find it.
| | 00:17 | In this case select Search, select File
Search, type the word that you want to use,
| | 00:21 | key, and select Search.
| | 00:24 | The results of your search are
presented in the Search view.
| | 00:28 | We can expand this by double-clicking.
| | 00:30 | Let's navigate down to the Security folder
through cipher and into
| | 00:34 | the OneTimeKeyCipher program.
| | 00:37 | Select one of the instances of key that
was found by the search and display this.
| | 00:42 | Note, that this is a text-based search,
not a search based upon
| | 00:46 | the internal structure of the Java code.
| | 00:48 | We can verify this by noting that
search found instances of the word key
| | 00:53 | that are located within comments.
| | 00:55 | In contrast with text-based search,
we can use the Show In feature
| | 00:59 | of the context menu to find variables, methods
or classes within the Package Explorer.
| | 01:04 | The internal structure of the code
is displayed using this method.
| | 01:08 | Suppose that we are interested
in the veritable oneTimeKey.
| | 01:12 | We can highlight this, use the context menu,
select Show In and show it
| | 01:18 | within the Package Explorer.
| | 01:20 | In this case, rather than being
a text-based search, this is based
| | 01:24 | on the internal structure of the Java code.
| | 01:26 | The C decorator indicates that this is a class.
| | 01:30 | The red decorators indicate
something that is private.
| | 01:33 | Here we can select the method, for example,
the init method and the cursor
| | 01:38 | is positioned at the init method
within the Java Editor.
| | 01:42 | As we'll see in subsequent movies,
the search feature is one way to navigate
| | 01:46 | into Java code and learn more about
the structure of your own Java programs.
| | Collapse this transcript |
| Getting help within Eclipse| 00:00 | The help system is a useful tool
for learning more about Eclipse.
| | 00:04 | Here we see the Package Explorer.
Suppose that you want to learn more
| | 00:09 | about the Package Explorer.
| | 00:11 | One option is to use the internal
Help system, select Help Contents.
| | 00:16 | Here you'll see a basic
introduction to the Help system.
| | 00:19 | If you're new to Eclipse, you
will probably want to start
| | 00:22 | with the Workbench User Guide.
| | 00:24 | The next thing that you like to do is
probably use the Getting Started section
| | 00:28 | of the Workbench User Guide, and
note that there's a Basic tutorial.
| | 00:32 | In our case we are interested in learning
about the Package Explorer so we can
| | 00:36 | use the Search function.
| | 00:37 | You'll see that you received 81 matches.
| | 00:41 | If you navigate to the first link,
you'll receive basic information
| | 00:46 | about the Package Explorer.
| | 00:48 | The Help system is a great resource
for learning about Eclipse.
| | 00:51 | You can read the guides and tutorials
to investigate fundamental information
| | 00:56 | or you can use the search feature
to find specific information.
| | Collapse this transcript |
| Using the community forums| 00:00 | A great resource for learning
about Eclipse is the community forums.
| | 00:04 | In particular, I recommend the newcomer forums.
| | 00:07 | You can access the forums by pointing
your browser to eclipse.org/forums.
| | 00:13 | In particular, I recommend the Newcomers forum.
| | 00:17 | If you navigate down through the forums,
you'll see one listed New forum members,
| | 00:21 | READ THIS FIRST.
| | 00:23 | Of course, I'm going to recommend
that you read this forum posting.
| | 00:27 | Many beginners, intermediate and advanced
Eclipse users follow the Newcomer forum.
| | 00:31 | If you post a question to this forum,
you will probably receive a reply
| | 00:34 | relatively quickly.
| | 00:37 | Remember to be courteous and patient,
the responders are Eclipse users just like you.
| | Collapse this transcript |
|
|
5. Additional ToolsExtending Eclipse with bundles and plugins| 00:00 | There are many opportunities to extend Eclipse;
| | 00:03 | some of these are shown
in the Eclipse Marketplace.
| | 00:06 | The URL for the marketplace
is marketplace.eclipse.org.
| | 00:12 | Technically, when you extend Eclipse,
you're bringing new bundles into Eclipse.
| | 00:16 | Fortunately, you don't have to do
this manually because Eclipse uses
| | 00:21 | Update Sites to manage new bundles.
| | 00:23 | Just a note on terminology:
| | 00:25 | modern versions of Eclipse
are composed of OSGi bundles.
| | 00:28 | Older versions of Eclipse were
composed of modules called plug-ins.
| | 00:33 | In modern versions of Eclipse,
the word plug-in refers to an OSGi bundle.
| | 00:38 | In the following movies, I'll show you
how to use update sites to extend Eclipse
| | 00:43 | with Apache Maven and with WindowBuilder.
| | 00:45 | Then I'll show you how to add
support for git, a popular software
| | 00:49 | version control system.
| | 00:50 | I encourage you to look at the Marketplace
to get a sense of what's available
| | 00:54 | and to see if there are any features
that you would like to incorporate
| | 00:58 | into your versions of Eclipse.
| | Collapse this transcript |
| Extending Eclipse with Apache Maven| 00:00 | This movie shows the Apache Maven
software project management tool.
| | 00:04 | The homepage for Maven is maven.apache.org.
| | 00:09 | To learn more about Maven, navigate
to User Center using the link
| | 00:13 | in the documentation section of the home page.
| | 00:15 | This page has download information, a five-minute
test and a Getting Started tutorial.
| | 00:21 | Note that the information on this page pertains
to the command line version of Maven.
| | 00:25 | You can also use the information
for the user interface version of Maven
| | 00:29 | that we'll see in Eclipse.
| | 00:30 | Now we'll prepare to integrate Maven into Eclipse.
Point your browser to this URL,
| | 00:36 | look at this Update Site and copy
it from your browser, return to Eclipse.
| | 00:42 | We'll use the Help menu to integrate
new software into Eclipse.
| | 00:48 | Select Install New Software and
we'll want to add an Update Site.
| | 00:53 | Click the Add button, now paste
that link here, select OK.
| | 00:58 | Once this line appears, select the
entire group for installation,
| | 01:03 | press Next, press Next once more, accept the
terms of the license agreement and press Finish.
| | 01:09 | When prompted to restart Eclipse, select Yes.
| | 01:13 | At this point, you can look at
the integration information for Maven,
| | 01:17 | close the Welcome screen and
we're back to the Java Perspective.
| | 01:21 | I'll use a Maven wizard to
create a new Maven project.
| | 01:25 | We'll take the default information
which is a maven-archetype-quickstart.
| | 01:32 | For the Group Id, use information that
refers to yourself or your organization.
| | 01:37 | For the Artifact Id, let's use
MyFirstMaven, press Finish.
| | 01:44 | Expand the project and double-click on
the pom file, you'll see the information
| | 01:48 | that we typed in the wizard.
| | 01:50 | A pom file is really just an XML file.
| | 01:53 | If you'd like to view the source for
this XML, you can use the pom.xml tab.
| | 01:58 | We can go back to the Overview.
| | 02:00 | Notice the folders that have been created.
| | 02:03 | Maven creates a source/maven/java folder
and a source/test Java folder
| | 02:09 | within one project.
| | 02:10 | This is a different strategy and that
which we used in the JUnit movie
| | 02:15 | where we created separate projects
for source code and for test code.
| | 02:19 | Expand the src/main/java folder,
expand the Package.
| | 02:24 | You'll see App.java which was created by Maven.
| | 02:27 | Double-click you'll see it's a variation
of our Hello World program.
| | 02:32 | If you try to expand the target folder
in the Package Explorer, you'll see
| | 02:36 | that it doesn't contain any information.
| | 02:38 | Now select the project,
choose Run As and Maven test.
| | 02:44 | In the Console window,
you'll see that we ran one test,
| | 02:48 | there were 0 failures and 0 errors.
| | 02:50 | If you expand the Target folder,
you'll see there are reports now.
| | 02:54 | If you double-click on the test, the
JUnit view opens and you'll see that
| | 02:59 | the test ran correctly.
| | 03:01 | Once again select the project, use the
context menu, select Run As>Install.
| | 03:07 | Expand the Console and
you'll see what Maven did for us.
| | 03:12 | In particular, it ran the compiler
and it created a JAR file.
| | 03:17 | It placed the new JAR file
into the target folder.
| | 03:20 | The JAR file contains the binary
byte code version of our app class.
| | 03:25 | Maven is a powerful project management tool
that is used by many professional
| | 03:29 | software engineering teams.
| | 03:31 | If you decide to work with teams
that build Eclipse plug-ins
| | 03:35 | or large systems built with Java,
you'll probably encounter Maven.
| | Collapse this transcript |
| Extending Eclipse with WindowBuilder| 00:00 | At some point you may decide to
build your own digital tools based
| | 00:03 | upon the Eclipse platform.
| | 00:05 | A significant part of the effort for
building tools is building the user interface.
| | 00:09 | The main components within Eclipse
user interfaces are SWT and JFace.
| | 00:15 | You could choose to develop your UI
using Java code to make calls to the SWT
| | 00:19 | and JFace libraries or you could use
a GUI builder such as Window Builder.
| | 00:25 | Window Builder was originally
a commercial proprietary project.
| | 00:28 | Google purchased the company that
developed WindowBuilder, then released it
| | 00:32 | under an open-source free license.
| | 00:35 | WindowBuilder is not preinstalled in
the 4.2 version of Eclipse Classic
| | 00:39 | that we're using in this movie.
| | 00:41 | What we'll do is we'll use an Update Site
to integrate WindowBuilder into
| | 00:45 | this version of Eclipse.
| | 00:47 | Point your browser to this page.
| | 00:49 | It's the Update Site for
WindowBuilder within Eclipse.
| | 00:52 | Since we're using the 4.2 version
of Juno, press this link.
| | 00:57 | The page is blank, but the URL contains
the Update Site, copy this information,
| | 01:02 | return to Eclipse, use the Help menu,
Install New Software,
| | 01:08 | add an Update Site, press OK.
| | 01:12 | Select the components
that you'd like to install.
| | 01:14 | If you want to, you can include the
Swing Designer, we'll use SWT Designer
| | 01:19 | and the WindowBuilder Engine.
| | 01:21 | Select Next, select Next again,
agree to the license terms, press Finish.
| | 01:27 | When prompted to restart Eclipse, press Yes.
| | 01:30 | Now the first thing that we'll do
is create a WindowBuilder project.
| | 01:36 | Name the project, expand the project,
go to the source file and create a Package.
| | 01:48 | Within the Package, we'll create a form
using the GUI builder, expand SWT Designer,
| | 01:54 | expand Forms and select FormPage,
give the page a name and select Finish.
| | 02:01 | Here you'll see the source code that was
generated by WindowBuilder. Not too exciting.
| | 02:06 | What we want to do is navigate
to the Design tab.
| | 02:10 | Here you see our empty FormPage,
select Composite and paste a composite
| | 02:16 | onto the empty FormPage, select a layout and
place the layout within the composite, say Yes.
| | 02:22 | Now select the component, select the
Check box, place the Check box, rename it,
| | 02:29 | use the context menu to Test Preview.
| | 02:32 | As you can see, you can check and
uncheck the button, close the preview.
| | 02:36 | The interesting thing at this point
is to look at the source code.
| | 02:39 | Here you can see the source code
that was generated for you.
| | 02:43 | As you can probably guess, it's much
easier to use the GUI to drag and drop
| | 02:47 | than it is to write the source code
to do the GUI development.
| | 02:51 | WindowBuilder has an excellent form.
| | 02:54 | Eric Clayberg, the original developer of WindowBuilder,
is an active member in this forum.
| | 02:59 | He and the other members of the forum
will be happy to answer your questions.
| | Collapse this transcript |
| Extending Eclipse with EGit for source control| 00:00 | Software development teams
rely upon code repositories.
| | 00:04 | I'll show you how to install
the EGit package into Eclipse.
| | 00:07 | This package provides a user
interface within Eclipse for using git.
| | 00:11 | To install it, I'll use the link on the
Projects page and I'll copy this link.
| | 00:16 | I'll return to Eclipse, go to the Help menu,
choose Install New Software
| | 00:23 | and then click Add, paste the location,
click OK and now we'll add both packages,
| | 00:30 | click Next, click Next again, accept
the license agreement and click Finish.
| | 00:35 | You'll be prompted to restart, select Yes.
You may see warning dialogues
| | 00:41 | as you go through the installation process.
| | 00:43 | If git is not configured on your system,
you can ignore these messages for now.
| | 00:48 | After you restart Eclipse, you can say
Window>Open Perspective>Other
| | 00:55 | and choose Git Repository Exploring.
| | 00:58 | This Perspective shows you some
of the tools and options
| | 01:01 | that are available within git.
| | 01:03 | Configuring a git repository is beyond
the scope of this course,
| | 01:07 | but for more information about git,
you can look at Git Essential Training
| | 01:11 | with Kevin Skoglund here in
lynda.com Online Training Library.
| | 01:15 | I encourage you to explore the EGit
documentation for more information as well,
| | 01:19 | and if you're curious about other
kinds of source control systems,
| | 01:23 | see Fundamentals of Software Version
Control with Michael Lehman here in the
| | 01:27 | lynda.com Online Training Library.
| | Collapse this transcript |
|
|
ConclusionGoodbye| 00:00 | I hope that you have enjoyed
this overview of Eclipse integrated
| | 00:03 | development environments.
| | 00:05 | Eclipse supports many languages
including Java, JavaScript, C and C++ and PHP.
| | 00:11 | lynda.com has courses
for each of these languages.
| | 00:14 | Depending upon your language preferences,
you can use
| | 00:18 | Java Essential Training with David Gassner,
JavaScript Essential Training with Simon Allardice,
| | 00:24 | C/C++ Essential Training with Bill Weinman, or
PHP with MySQL Essential Training with Kevin Skoglund.
| | 00:30 | Eclipse supports development for Web servers,
application servers, and mobile devices.
| | 00:35 | lynda.com also has courses of these topics such as
Installing Apache, MySQL
| | 00:41 | and PHP with David Gassner,
Up and Running with Aptana Studio 3 with Joe Marini,
| | 00:47 | Titanium Mobile App Development
Essential Training with Rafael Hernandez,
| | 00:52 | Flash Builder 4 and Flex 4 Essential Training
with David Gassner, ColdFusion Builder
| | 00:57 | Essential Training within Daniel Short.
| | 00:59 | Thanks very much for watching.
| | 01:01 | This is Charles Kelly saying goodbye.
| | Collapse this transcript |
|
|