Eclipse/使用Eclipse


目的 编辑

本书用于使用Eclipse软件作为集成开发环境(IDE)的C/C++、Java、Python程序员。


入门 编辑

下载Eclipse 编辑

首先从Javasoft网站下载最新的JRE (Java Runtime Environment)然后安装JRE。

再从Eclipse IDE网站下载最新的Eclipse。

建议64位计算机安装上述两个软件的64位版本。32位计算机安装上述两个软件的32位版本。

安装Eclipse 编辑

如果直接下载了Eclipse的安装程序,可以鼠标双击安装。

已经安装好的Eclipse,可以保持目录结构整个拷贝到另一个目录下或另一台计算机上直接使用。

安装插件 编辑

方法一:菜单Help-->Install New Software...-->Add...按钮-->输入相应的网址

方法二:菜单Help-->Install New Software...-->Add...按钮-->Local...按钮-->输入相应的硬盘目录地址,例如对cdt可下载相应的cdt-9.3.1.zip,解压缩后把repository目录输入,即可安装

方法三:安装好的Eclipse,可以通过菜单File-->Import-->From Existing Installation把别的安装好的Eclipse的配置与插件,安装到自身系统。但要注意,高版本的Eclipse可能不能使用插件(如cdt)的低版本,上述操作可能会无效,需要下载高版本插件单独安装。

方法四:下载到的插件的zip文件,解压缩后有两个目录plugins与features,把这两个目录复制到eclipse的dropins目录下

运行Eclipse 编辑

直接执行Eclipse.exe文件。

Getting Help 编辑

Types of help available with eclipse:

  1. Online documentation
  2. Context sensitive help
  3. Hover help
  4. Active Help

Eclipse Help can be accessed using external browser http://localhost:<port>/<path_for_help_content> <port>. The values for these fields can be found in preferences.ini file. Eclipse uses a tomcat server for displaying help documentation.

配置 Eclipse 编辑

Preferences and Properties in the Eclipse Workbench UI

使用 Eclipse 编辑

Workspace 编辑

Resource (projects, folders, files)

.metadata folder contains information about the workspace.

Keep different workspaces for different development projects (or different customers)

Bookmarks - A bookmark acts as a link to a particular line in a file.

Tasks - A task is created against each java error. Tasks can also be created as an reminder for some activities to be performed. Task contains priority and completion status. Tasks can also work as bookmarks.

  • Running Multiple Instances of Eclipse at the same time

(See command line options)

Perspectives 编辑

You can create your own (customized) perspective using configurations.

在Eclipse中运行其他程序 编辑

  • File Association (External Programs)
  • Run (External Tools)

need a "how to"/tutorial for External Tools running a main class in one project while referencing a jar file elsewhere. ex. project DoesReallyNeatStuff creates output based on project SomeStuff. How does a project reference the other project using External Tools?

Eclipse Architecture 编辑

Notes on the Eclipse Plug-in Architecture

亮点 编辑

  • Eclipse 3-in-1 - a Java development environment, a tool integration platform, and an open source community.
  • Editor -anticipates your next move - code assist , think faster that you write use spell checker, refactoring - iterative process of improving your code Object Oriented approach, scrapbook - experiment with expressions, search tools,

debugger - breakpoints, display value of variable, hot code replace support - change your code while in debug mode, preference settings - tailor according to your needs yourself,

  • General purpose - For both programming and non-programming development tasks

Java doc comments templates

integrated support for Ant, JUnit

基本概念 编辑

  • Developer's Toolset - (design) modelling tool, IDE, version control, word processor,
  • Artifacts - architecture diagrams, code and user documentation
  • Workspace is a directory where your projects are stored.
  • Workbench consists of views, perspectives and editors.
  • Views provide alternate way of navigation.
  • Editors are associated with the file types. External editors can also be used with editors. OLE based editors integrates well with Eclipse.
  • Perspectives are collection of views.

Eclipse体系架构 编辑

  • Eclipse Platform
  • SWT
  • JFace
  • GEF/GMF
  • Workspace
  • Workbench
  • Help
  • Team
  • Debug
  • Plug-In
  • Extension Points
  • Plug-In Development Environment (PDE)
  • Platform Runtime

Eclipse插件 编辑

Standard Widget Toolkit (SWT) 编辑

The SWT is a collection of APIs that allow writing GUIs (Graphical User Interfaces). The APIs are focused on providing tools to allow "widgets" (graphical controls such as checkboxes, edit controls, etc.) to be displayed and manipulated.

相关主题 编辑

EMF - Eclipse Modelling Framework EMF is a modeling framework and code generation facility for building tools and other applications based on a structured data model. EMF allows a model described using Annotated Java, XML or modeling tools to be generated as executable Java code. The generated code allows the model structure to be inspected, and the model data to be queried, updated and persisted to external storage.

附录 编辑

词汇表 编辑

WorkBench Terminology 编辑

  • Menu bar
  • Tool bar
  • Perspective
  • Fast View bar
  • Resource Navigator
  • Properties View
  • Message Area
  • Text editor
  • Outline view
  • Bookmarks view
  • Editor status area
  • Tasks view -

predefined tags TODO, FIXME, XXX

  • Stacked view
  • Help View

键盘快捷键 编辑

  1. Ctrl + F6 - switching between various editors.