540 likes | 768 Views
Installing and running Eclipse. What we'll cover. Installing Eclipse Running Eclipse Eclipse terms and concepts: Perspectives, views, editors and other useful things Other editing functions. Installing Eclipse. Installing Eclipse.
E N D
What we'll cover • Installing Eclipse • Running Eclipse • Eclipse terms and concepts: Perspectives, views, editors and other useful things • Other editing functions
Installing Eclipse • To get started, go to eclipse.org and click the downloads link.
Installing Eclipse • Download the Eclipse SDK. • Currently the file name is eclipse-SDK-3.1.2-win32.zip (for Windows) • This file contains everything from Eclipse, including the Eclipse platform and the SDK. • Download the file (use a mirror if you can) and unzip it. • You're done! • There are instructions on the Eclipse download page if you need them.
Other things at Eclipse • The Eclipse SDK download gives you everything you'll need to get started. There are other basic packages you might want to look at, though: • Plug-in development environment (PDE) • Rich Client Platform runtime and SDK • FTP and WebDAV support
The Java Runtime Environment • Because Eclipse is written in Java, you have to have a Java Runtime Environment (JRE) on your machine. • A JRE isn't included with Eclipse itself. • eclipse.org lists sites with JREs available if you need one. • The Eclipse Foundation wisely doesn't recommend any particular JRE. • JRE 1.5.0_02 works well, although you can have multiple JREs/JDKs installed on your machine and switch between them in Eclipse.
Running Eclipse • Now that you've installed Eclipse, use the eclipse command to run it:
Workspace • The workspace is a physical location on your machine. • It contains projects, folders, and files. • A project is a collection of folders and files for a particular task. • A folder is a subdirectory; it can contain folders and other files. • A file is just a file. • In other words, a workspace is just a directory.
Choosing a workspace • The first time you run Eclipse, you'll be asked to choose a workspace. • You can also create different workspaces if you want. • Each workspace is a different directory that contains a set of projects. • To open Eclipse in a particular workspace, type eclipse –data c:\workspace.
Using different workspaces • You can create different shortcuts for different workspaces if you want:
Switching workspaces • You can use the Switch Workspace… item on the File menu to change workspaces. • You can change to another workspace without restarting Eclipse.
Performance tip • If Eclipse runs slowly, try adding this switch to the command line or shortcut: eclipse –vmargs –Xms256M • This starts the Java virtual machine with 256MB of RAM. • Eclipse loads plug-ins only when you need them, but it can start to slow down if you use lots of tools. • This tip is particularly helpful on Windows platforms.
Workbench • The workbench is the Eclipse environment. • When you open Eclipse, you see a workbench that displays the resources in a particular workspace. • A workbench contains perspectives, views, and editors.
Perspectives • A perspective is a set of views organized for a particular task. • If you're writing Java code, certain views are useful. • If you're debugging Java code, other views are useful. • If you're modeling business processes, etcetera, etcetera… • A perspective lets you arrange the views you need. • Eclipse comes with several perspectives installed.
Perspectives • As you install plug-ins for various tasks, other perspectives may appear. • The dialog on the left lists the perspectives shipped with the basic Eclipse SDK. • The dialog on the right is from IBM's WebSphere Business Integration Modeler, an Eclipse-based product with many advanced features.
Customizing perspectives • You can customize a perspective in many ways: • You can change the views that are part of a perspective • You can change how those views are arranged on the screen • If you use the Customize Perspective… menu item, you can define which menu items and toolbar buttons are available for a given perspective.
Saving perspectives • When you have the views and toolbars and everything else arranged the way you want, you can save that as your own perspective. • You can overwrite existing perspectives if you want.
Views • A view is a window on some resources in your workspace. • One view might list all the files in your workspace • Another view might list all the Java classes in a JAR file. • You can open and close and arrange views any way you like. • Two views might display the same thing in different ways.
Opening views • The Window Show View menu lets you open a view at any time. • Click the Other… item to see a complete list of views.
Moving and stacking views • To move a view, click and drag its tab. If more than one view is in the same space, they'll be stacked. • The Problems, Javadoc, Declaration and Console views are stacked here.
Fast views • A fast view has an icon; you can click on that icon to go directly to the view. • To create one, choose Fast View from the view's menu.
Preferences • Eclipse has a number of preferences you can set. • Whenever you install a plug-in, that plug-in can have preferences also. • As a result, your Eclipse installation can have literally hundreds of settings. • Choose WindowPreferences to get to the Preferences dialog. • You can change just about everything.
Preferences • If you have more than one Java Runtime Environment installed on your machine, you can tell Eclipse which one to use. • You can add new environments or change the default any time you want.
Editors • An editor allows you to modify a resource. There are different kinds of editors for different kinds of resources, as you'd expect. • Many plug-ins add their own editors, specialized for editing a particular type of document. • Like all views, editors can be stacked. The asterisk next to the file name above means that HelloWorld.java has been changed.
External editors • You can associate file types with external editors if you want. • The underlying operating system may have editors assigned to different file types already. • To associate file types with editors, go to Window PreferencesEditorsFile Associations. • In this example, we're associating the .ecore file type with the Ecore Model Editor.
Other editing functions • In addition to the editors themselves, Eclipse has several useful features for working with files. • Searching • Bookmarking • Tasks • Local history • File comparison (think "visual diff") • Import/export
Searching • Eclipse has a very sophisticated search facility. • You can search through: • Files • The help system • Java source • Plug-ins • There are special search options for each kind of search.
Searching • The results of the search show up in the Search view. You can double-click on a match and go directly to that file. • There are toolbar buttons in the Search view; these let you move through the search results. • There will be different buttons depending on the kind of search.
Bookmarking • You can create a bookmark in a file and go directly to that spot whenever you want. • To create a bookmark, right-click in the gray area on the left-hand side of the editor. You'll be asked to give the bookmark a name; that's what
Bookmarking • All your bookmarks are listed in the Bookmarks view. • Notice that the bookmarks here are in different projects, and that not all of them are in Java files. • You can set a bookmark wherever you want.
Tasks • You can create tasks throughout your project. • It's a way of building a to-do list. • You can associate a task with a line in a file ("add better error checking here") or create a more general task ("set up an Ant script to automatically regenerate the Javadoc")
Tasks • The first task here is a generic task that applies to the workspace. • The second is a specific task that applies to a particular line in a particular file. • As with bookmarks, you can create a task for any line in any file.
Local history • Only applicable to files • Each Save creates a new version • You can compare versions • There is a similar local history function for Java elements…
Comparing Files • Highlight any two files and select Compare With Each Other from the context menu • Differences are shown visually • Move information from one file to another: • Entire file • Current change • Select next or previous change
Import/Export • Eclipse supports many different ways to import and export resources. • You can import an existing project from another workspace • You can import or export a zip file, a JAR archive, an EAR file, etc. • You can also drag and drop files from the operating system into the Eclipse environment. • Dragging and dropping files from Eclipse into operating system containers (Windows Explorer, for example) also works.
Navigating resources • The Navigate menu has many ways to find and view your resources. • Go Into • Also available from context menu • Go backwards and forwards using the arrow icons • At lower levels the view includes the name of a folder or file • GoTo • Start typing the name of the resource to limit the choice • All other resources are hidden
Copying, moving, renaming • Copying and moving resources: • Use the command from the context menu, or • Drag and drop the resource • Copy by holding the Ctrl key as you drag • The Ctrl+X, Ctrl+C and Ctrl+V combinations work most of the time as well (depends on the view) • Renaming is part of Eclipse's refactoring support.
Properties • All resources have properties • The Properties view gives basic information on the resource • The Properties dialog (right-click the resource and select Properties) gives much more detailed info • Some resources have more properties than others.
Team functions • Eclipse has built-in support for versioning, configuration management and interacting with code repositories such as CVS. • Eclipse also supports FTP and WebDAV. • As with everything in the world of Eclipse, many groups (including IBM) have taken these basic functions and extended them.
Help is on the way • Eclipse's help system is very sophisticated. Choose HelpHelp Contents to see it. • You can view help topics from a list, or you can search for what you need. • When you install a plug-in, its help information is integrated with everything else in the platform. • You can create a plug-in that does nothing more than add information to the help system.