-
create a project on an existing source hierarchy
Project Name: foobar
Location: Create project an external location
Directory: D:\Docs\perso\develop\ptm
F12 | editor |
Ctrl⇞ | next tab |
Ctrl⇟ | previous tab |
CtrlF6 | next editor |
CtrlShiftF6 | previous editor |
CtrlW | close current editor |
CtrlShiftW | close all editors |
CtrlQ | go to last edit location |
Alt← | backward history |
Alt→ | forward history |
CtrlF7 | next view |
CtrlShiftF7 | previous view |
CtrlF8 | next perspective |
CtrlShiftF8 | previous perspective |
AltShiftQX | display errors |
CtrlShiftR | display the Open Resource dialog |
Ctrl3 | find action |
Compilation
- define the Java version used by compiler and select the Java version in
-
in Editor window
Ctrl- unzoom Ctrl+ zoom Ctrl_
split/unsplit window horizontaly split/unsplit window verticaly F2 show tooltip F3 display declaration (i.e. source code) of selected item F4 display class hierarchy of selected item CtrlAltH display call hierarchy of selected item AltShift↑ expand selection to enclosing element AltShift→ expand selection to next element AltShift← expand selection to previous element AltShift↓ restore last selection CtrlS save CtrlShiftS save all CtrlL goto line CtrlO display Quick Outline CtrlShift:
CtrlShiftCtoggle comment CtrlShiftIns toggle Smart Insert Mode CtrlD delete selected lines Alt↑ move selected lines one line up Alt↓ move selected lines one line down CtrlAlt↓ copy the selected lines CtrlI correct indentation CtrlNum * expand all folded code CtrlNum / enable/disable code folding CtrlShiftQ enable/disable QuickDiff AltShiftO toggle mark occurrences AltShiftY toggle line wrap AltShiftA toggle Block Selection Mode CtrlShiftX convert selection to uppercase CtrlShiftY convert selection to lowercase CtrlShiftF reformat the code AltShiftZ surround with Quick Menu CtrlShiftO organize imports CtrlShiftP go to matching bracket - configure the folding with .
-
Workspace setting:
, then -
Project setting:
, puis -
To correct a file:
-
add a boomark on the current line:
right-click on the left margin of the Editor and select or in the menubar
and type the name of the bookmark -
display the Bookmark View:
in the menubar, select
select -
delete a bookmark:
right-click on the left margin of the Editor and select or
select the boomark in the Bookmark View and type Del
in Editor window
CtrlF | find/replace |
CtrlK | find next |
CtrlShiftK | find previous |
CtrlJ | incremental find next |
CtrlShiftJ | incremental find previous |
CtrlH | search |
CtrlShiftG | find occurrences of the selection in the workspace |
CtrlShiftT | find a type and display it in an editor |
CtrlShiftH | find a type and display it in the type hierarchy |
F5 | update the search |
Code generation
- set the field name prefixes in
- type the fields
- generate the constructor with
- generate the setters and/or getters
-
AltShiftS, R display Generate Constructor using Fields dialog AltShiftS, O display Generate Getters and Setters dialog
In Editor window
AltShiftT | display refactoring menu |
AltShiftR | rename |
AltShiftV | move |
AltShiftM | extract method (transform the current selection into a new method) |
AltShiftC | change method signature |
Compilation
-
define the Java version used by compiler
and select the Java version in
In Editor window
AltShiftXT | run main in current editor |
CtrlF11 | run last launched |
F11 | debug last launched |
F5 | step into |
F6 | step over |
F7 | return |
F8 | resume |
CtrlShiftD | display variable |
CtrlShiftI | inspect expression |
CtrlShiftB | toggle breakpoint |
in Debug window
reenter the current stack frame in debug mode |
Create a run configuration
- select and click
- define its name in the field and fill all the necessary parameters
Run an application
- and select the run configuration
- select the main class and
- CtrlF11 run last launched
- in the "Java Browser > Types" view, select the main class and
- in the "Debug > Debug" view, select process and
Debug an application
- select the main class and
- F11 debug last launched
- in the "Java Browser > Types" view, select the main class and
Adjusting console size
- Use and
Solve a deadlock
- in the Debug View, select
- suspend the threads
- for each thread, look at the lock waited for and to what owns it
Application creation
-
Create a JAR file
- Right click on the project name in the and select .
- Select and click .
- Select the file to generate in the field and click .
- Click .
- Select the class containing the method to generate in the field and click .
-
in Editor window
ShiftF2 open external Javadoc AltShiftJ insert Javadoc comment -
Declare the Javadoc command
-
Eclipse 3.0:
-
Eclipse 3.1
Fill the field in
-
Eclipse 3.0:
-
generate the documentation
-
Define the location of the JDK Javadoc
-
Eclipse 3.0:
double click on a JRE
-
Eclipse 3.1:
double click on a JRE
unselect
expandC:\Program Files\Java\jre1.5.0\lib\rt.jar
double click on and typeC:/Program Files/Java/jdk1.5.0/src.zip
double click on and typefile://C:/Documents and Settings/Laurent/Mes documents/docs/JDK 1.5.0/api
-
Eclipse 3.0:
-
key binding customization
-
CtrlShiftL display the list of shortcuts CtrlShiftL, CtrlShiftL display the shortcut configuration
-
Configure the location of the local repository
-
Create the directories
C:\foobar\maven2
andC:\foobar\maven2\repository
. -
Create the file
C:\foobar\maven2\settings.xml
containing<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>F:\foobar\maven2\repository</localRepository>
</settings> -
In
User Settings
toC:\foobar\maven2\settings.xml
, set
-
Create the directories
-
create JUnit tests for the current class AltShiftXT run all JUnit tests of the current source file -
To solve the problem of unkown import files, delete
src/module-info.java
-
use e(fx)clipse
The packages are installable from https://download.eclipse.org/efxclipse/updates-released/3.0.0/site/.
-
Installing FindBugs
- select
- click on
-
Name: FindBugs update site
URL: http://findbugs.cs.umd.edu/eclipse - select and click
- in the Search Results Window, select and click
- select and click
- click
- in the Verification Window, click
- restart Eclipse
-
Using FindBugs
- right click on a Java project and select
-
command line to start Eclipse/MAT in order to have enough memory to parse a 2GB heapdump:
MemoryAnalyzer.exe -vm "C:\Program Files\Java\jdk1.6.0_13\bin\java.exe" -vmargs -Xmx1600m
-
once the perspective is displayed, in the view, right-click on the project and select