How to have Eclipse automatically open/preview fil

2020-07-08 07:39发布

问题:

Is there a way to have Eclipse automatically open/preview files as I select them in Project Explorer? I know I can double-click, but I want to quickly arrow up/down as I explore a project.

I am essentially looking for something like Mac Finder's Quick Look or Windows 7 Explorer's Preview Pane. IntelliJ IDEA has this functionality also and calls it "Autoscroll to Source".

Eclipse has "Link to Editor" but that works the reverse of what I want (what IntelliJ IDEA calls "Autoscroll from Source") - it updates the Project Explorer from the editor. I want the editor to update from the Project Explorer.

回答1:

Window -> Preferences -> General -> Open Mode (single click)

This option open new source file in new editor tab. To disable this, and keep only one active editor tab, use:

Window -> Preferences -> General -> Editors -> 
Select checkbox 'Close editors automatically' -> 
Set 'Number of opened editors before closing' to 1


回答2:

I think combining mishadoff's suggestion of single click open mode with "Open when using arrow keys" exactly answers OP's question:

Window(or Eclipse on Mac) -> Preferences -> General:

(I am using Juno version)



标签: eclipse