
Tips & Tricks
Topics
Create new project from scratch
- From the menu, choose: File | New | Project.
Be sure Java and Java Project are chosen in the displayed
window. Click Next.
- Enter a name for the project.
- In Project Contents, uncheck the box, use default and
click on Browse.
- In the Browse for folder window, navigate to the parent folder
for the new project.
- Then click the New Folder button to define the folder you wish
to use for the project files and enter a name. Click OK.
- Click Finish (don't click the Next button).
Create new project from existing Java
files
- Use this option when you wish to make a non-Eclipse folder of Java files
into an Eclipse folder and project.
- From the menu, choose: File | New | Project.
- Be sure Java and Java Project are chosen in the displayed
window. Click Next.
- Enter a name for the project.
- In Project Contents, uncheck the box, use default and
click on Browse.
- In the Browse for folder window, navigate to the Java folder. Click
Finish
- Click Finish (not Next) to complete the operation.
Display full screen editor
On the file tab (top of editor panel), right click and choose Maximize.
Choose Restore to return to the default setting. Or, double click the
file tab to toggle between full screen and "normal."
Go to matching bracket
Place cursor immediately after the bracket or parenthesis and press CTRL-SHIFT-P.
Import existing Eclipse project:
- From the menu, choose: File | Import.
- In the Import window, choose Existing project into workspace. Click
Next.
- In the next Import window, click the Browse button and find the
project folder.
Import other Java files from another folder
into an Eclipse folder/project:
- Be sure to open the Eclipse project.
- From the menu, choose: File | Import.
- In the Import window, choose file system. Click Next.
- In the next Import window, use the Browse button for the From Directory
to locate the source folder. The Into Folder should already be defined as
the current project folder. Then check the boxes to select the files in the
source folder you wish to import.
Running a project
Choose: Run | Run As | Java Application (or Java
Applet).
Testing code
Choose File | New | Scrapbook page. In the page,
you can enter code snippets, highlight them and choose Execute from
the context menu (right-click).
Searching for references to a variable or function
in the source code
Here's a scenario: your cursor is on a function definition or a variable and
you want to find all lines in the code that use the function/variable. Do the
following:
- Right click on the identifier or function and choose Search | References
| Workspace
- A yellow arrow will appear in the left margin of each such line and a list
of references appears in the bottom panel.
- When done, right click on the search results panel and choose Remove
all matches.
Working with breakpoints in the debugger
Remember - When first running the debugger, your program will execute up to
the first breakpoint encountered.
- To set a breakpoint, double left click on a line in the left margin.
Doing so again will remove the breakpoint.
- In the Debug perspective, the breakpoints tab (if not found, choose Window
| Show view | Breapkpoints from the main menu) lists all
currently defined breakpoints. You can right click on any entry and choose
to remove it. Or, right click in the breakpoint panel and choose remove all.