How to navigate through a lot of files in Eclipse without opening them - eclipse

In some popular code editors and IDEs such as Sublime Text and Xcode, we can swiftly navigate through lots of code files by a single click without opening them. This is an advantage when we look into many parts of the code base scattered across the projects but nevertheless want to avoid opening too many tabs, which affects performance on slow machines. Does anyone know such a "navigating-without-opening" functionality in Eclipse?
I understand that Eclipse does provide a lot of useful shortcut keys to switch between opened tabs and classes in the project, but what I am looking for is the functionality whereby I can switch between files without opening them in a new tab by a single click (and preferably open specific files by double clicks when we want to keep them opened in new tabs).
EDIT:
I am not searching specific classes or methods. Rather, I would like to peek project files one by one to grasp the structures of the application which contains hundreds of files. In Sublime Text and Xcode, unlike in Eclipse, when one clicks file names in the project explorer only once, the files get opened in a "temporary tab" which automatically closes when we single-click another file. For example, in the following screenshots, when I single-click ToDoListPane.java in Sublime Text or CNBackgroundView.h in Xcode, the files are opened in new temporary tabs, but once another file such as HelloWorldSpring.java or CNAppDelegate.m is clicked once, then the contents in the temporary tabs are switched to those of HelloWorldSpring.java or CNAppDelegate.m without additional tabs being created.

Use Ctrl+Shift+R to search files by name (pattern).
If you know a string that is inside of the files you seek, you can use Search -> File Search (there is a button in the toolbar for that).
Related:
http://www.vogella.com/tutorials/EclipseShortcuts/article.html
http://eclipse.dzone.com/news/effective-eclipse-shortcut-key
http://www.shortcutworld.com/en/win/Eclipse.html
[EDIT] For exploring unknown code, try the "Java Browsing Perspective", it's optimized for this use case.
As for "slow performance", I have often more than 99+ files open without a big impact on performance.
As a quick way to close tabs, you have several options:
Click anywhere in the tab with the middle mouse button to close it.
Use Ctrl+W to close the current tab
Use the tab's context menu to close it, close all tabs or close all other tabs.

Related

How do I get VS Code to stop replacing opened tabs with the one I'm trying to open?

Whenever I try to open a new file in a tab on my workspace instead of adding the tab to the workspace, it turns one of my opened tabs into that file. So I have 5 tabs open, and if I try to open a new file, it turns one of those 5 tabs into the file I'm trying to open.
How do I tell it to just open the file in a new tab? I'm going back and forth a lot and with a lot of files and folders to go through.It's really annoying to have to open a tab to check something, and then look through all the folders just to get back to what I was working on.
I tried looking through the settings but couldn't find anything useful.

Force eclipse to open files in a different tab

I would like that each time I open a reference to another file, Eclipse will be forced to open the file in a different editor, even if the current editor has already a tab with that file.
The motivation is that I hate when I click CTRL+Left Click (or just F3) to open a reference to a variable/function/class and such... it uses my current editor to open the file, drives me nuts because I have 6 different editors open in my workspace, and I would highly like them to be utilized.
An image for illustration, in this image Eclipse is open with 4 different editors.
Any ideas?
To me it sounds like this is what you like to do:
Eclipse: Files opened by multiple searches using same editor tab
"Disable the option
Preferences > General > Search > Reuse editors to show matches"
Although this will not open a second tab for an already opened file.
Sounds like you might have limited the number of open editors in your preferences, causing them to be recycled.

In RubyMine, how to preview a file's contents by selecting it like in Sublime Text?

I'm new to RubyMine 7 on Mac.
I used to use Sublime Text 3 and I love RubyMine so far except its lack of file previewing.
In Sublime Text, when clicking a file in the sidebar (file explorer), the selected file content shows in an editor tab for temporary viewing.
If I select another file, then the same tab changes to the content of the newly selected file.
I've been searching for this preference setting in RubyMine, or in a plugin, but I've had no luck.
A similar feature is "Autoscroll to source" but this feature opens files rather than previewing them.
If anyone knows how to do Sublime Text-like file content previewing in RubyMine, I'd appreciate it.
RubyMine doesn't have a feature exactly like Sublime Text file previewing.
The Quick Definition action can sometimes meet the same need. When invoked on a file, it opens a popup with the file's contents. You can invoke it on a file in the Project or Find pane and probably other panes, dialogs, popups, etc. that list files. (You can also invoke it in an editor on an identifier such as a class, module, or variable; it will show the code that defines the identifier.) Invoke Quick Definition with ⌥-space or ⌘Y in the Mac OS X 10.5+ keymap; use ^⇧I on Windows or check Preferences → Keymap for other keymaps, or use ⇧⌘A qd ⏎. Hit Escape or click outside the popup to close it.
When you invoke Quick Definition on a file in the Project pane and navigate to other files in that pane (with down and up arrows to move between files, and right and left arrows or Enter to open and close directories), the Quick Definition popup will stay open and update to the currently selected file, which is relatively close to Sublime Text file previewing. You can also hit Enter to open a file, F4 to open a file and move focus to the editor, edit the file, ⌘1 to jump back to the Project pane, etc., all with the Quick Definition popup still open, until you choose to close it.
If that isn't close enough, there are two feature requests for Sublime Text-like file previewing in JetBrains IDEs which you can vote for:
Preview currently selected file in project window
File Preview features from Sublime

Can Eclipse hold multiple different 'Compare' windows at the same time?

Like in the topic - is there any default way or any plugin that lets you have multiple 'Compare' windows open and active at the same time? I find it very frustrating that while doing changes to few files at the same time, I can't have active 'Compare' window for each of them, to see my changes/original code.
I would use Window -> New Window, rerun Team -> Show History and then compare another file.
A compare window in Eclipse is placed inside a normal editor tab.
You can have several editor tabs, including compare windows, visible at the same time. To do this just drag the editor tab (the one on the top with the editor name) to somewhere inside the editor area. The editor area will get split in two, each one displaying one editor.
This works with more than two editors also.
If you find that you need more space for the compare windows because other views take up much space you can maximize the editor area by pressing Ctrl+M while the editor area has focus.
Example:
Go to preferences -> team -> General Team Preferences. For me, the "Reuse open compare editors when opening comparisons" was already checked by default. I unchecked that and now I can have multiple file comparison windows open! (I'm using Eclipse Oxygen.3a -- 4.7.3a)

Eclipse auto close unused tabs

I have this habit of looking into other source codes from different projects for a reference. However, this leads to cumulative issue of forgetting to close the tab. I may have around 100 source tabs opened up (which is related to current and unrelated projects).
Is there a preference or plugin to auto close unused tabs after certain idle period? Like say after 10 minutes of inactivity.
The issue I face is when I'm in a hurry the tabs pile up and consume lots of memory, and not to mention if you have opened up Chrome for reading documentation and StackOverflow digging. Finally slows down my system due to swap usage.
[ Update ]
Found some interesting tips from this link
So how to quickly close unnecessary tabs in Eclipse?
Closing tabs one by one by clicking on the tab with a wheel/MMB. It’s faster than clicking LMB on a small cross icon, because it’s enough to click anywhere on a surface of a tab. I do it when there is few tabs to close (like one or two) and tabs that I want to closearen’t hidden.
Closing current tab using Ctrl+W keystroke. I do when tab to be closed happens to be an active tab. And when I just visited some class to check something and I won’t need to revisit it anymore soon.
Using Ctrl+Shift+W keystroke to close all tabs. I do it when I’m starting completely new tasks or at the moment I’m too lazy for 4 or 5. :-) .
Right-clicking on the tab that should stay open and selecting “Close all others” option. It’s handy in cases where only one editor is significant and others are a result of code exploration.
This is my favourite one: Using ctrl+shift+e keystroke to display “Open editors” dialog, selecting editors that should stay open (with ctrl pressed), “invert selection”, “close all selected” and finally hitting esc to close the dialog. It may seem complex but trust me it isn’t. It took me only a few attempts to learn how to use this trick effectively. I often do it when I forgot to close tabs for a while and I have a lot of tabs open and what’s worse, some of tabs aren’t visible on tabs bar (arrow icon needs to be clicked to see the hidden tabs).
There is a feature General > Editors > Close editors automatically which closes unused editors automatically.
There is no auto-close feature/plug-in in eclipse. Because user opened all the editors manually and he/she has to close these on their wishes but not automatically.
For your problem I suggest you to use Mylyn plug-in so that you can stick to only those editors(context) you frequent used, hiding all other editors, packages, classes etc.
Also there is an eclipse plug-in for pinning editors refer my answer for the post Eclipse - How to pin editor tabs?