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.