Is it possible to dock the "Find/Replace" window in Eclipse? - eclipse

I could have sworn I saw it once before in a screencast where someone had the find/replace window docked in their Eclipse environment.
However looking through the list of options in "Window > Show" the closest thing I can find is the Search window.
I find that I use it quite a bit and with larger monitors these days I figure I could afford to have it open in my perspective all the time.
Is this possible?
Thanks.

One poor-man's workaround is to dock a view that you don't need in a part of Eclipse where you want the find/replace view and then place the find/replace dialog on top of that like this:
Clearly this is a huge kludge but it does work.

I am not sure about that, since Fast views are:
icons allowing users to quickly display different views that have been created as fast views
And the search/replace is a Dialog, not a View..
(source: bpsite.net)
(That Dialog box is not like Views, which support editors, also have their own menus. Some views also have their own toolbars.)
The help page mentions:
Fast views are hidden views that can be quickly opened and closed. They work like other views except they do not take up space in your Workbench window.

This might not be an exact answer for the question. But this works like a charm.
Press ctrl + j and keep typing...
Use ctrl + k to go on
Use shift key wherever required.
Use Edit > Incremental Find Next (Ctrl+J) or Edit > Incremental Find Previous (Ctrl+Shift+J) to enter the incremental find mode, and start typing the string to match. Matches are found incrementally as you type. The search string is shown in the status line. Press Ctrl+J or Ctrl+Shift+J to go to the next or previous match. Press Enter or Esc to exit incremental find mode.

Related

Move Eclipse's Find/Replace dialog to a view?

I find Eclipse's (Eclipse 3.7, Indigo, running under Mac OS X 10.6.8) Find/Replace floating dialog box to be very annoying. Part of the time it ends up obscuring the search results. Is there any way to have Eclipse move the Find/Replace somewhere else? I'd like it to be a pop-up view, as I often do with the Console, Servers, Outline, and other views. However, if it could be incorporated into the view which it's searching, that would be great, too.
Eclipse's Find / Replace dialog is a dialog, not a view, so you can't drag and drop it to one of the view areas.
Here's a Eclipse search plugin that might work for you. Scroll all the way to the bottom of the page to get the Software Update link.
Worst case, you could write your own Eclipse plug-in that creates a view that does a Find / Replace.
TL;DR
Find/replace cannot be used as a view. Here are two ways to find text without obstructing the search:
Use incremental search (CTRL+J)
Use the quick search plugin (CTRL+SHIFT+L)
Pros and cons
Both approaches behave differently from the traditional find/replace and may require some getting used to.
Approach 1.
It works out of the box, no need to install a plugin, but it (currently) does not support pasting nor searching for the current selection (but there is CTRL+K for the latter). You can use UP and DOWN or repeat CTRL+J or CTRL+SHIFT+J to jump between matches.
Approach 2.
This still opens a dialog, but one which integrates the search results rather than obscuring them. I suggest resizing it to have a good preview size.
The default shortcut shadows the "Show Key Assist" original, but this can be changed. It is an extra install and AFAIK only supports case sensitive searches, but it supports searching for the selection and pasting.
It shows matches across files, starting with the top open editor (if you have more than one visible, e.g. side by side, it sometimes does not start with the one you were last on). You can move between matches with UP and DOWN and hit enter to go back to the editor on the selected match.
NOTE
I suppose on OSX you can replace CTRL with CMD in keyboard shortcuts above to achieve the same, but I could not test it. The shortcuts can be customized in Preferences->General->Keys

Navigating the Content Assist List in Eclipse

Here are the ways the Eclipse documentation states you can navigate the Content Assist list:
You can use the mouse or the keyboard
(Up Arrow, Down Arrow, Page Up, Page
Down, Home, End, Enter) to navigate
and select lines in the list.
But all of the options require you to move your hands significantly away from their natural place on the keyboard!
Are there any other, quicker ways I can navigate this list? Something like tab, or the j/k from vi?
This is a great feature, and you can implement it like so: bind movement keys in Eclipse's key binder and then use them in the content assist menu!
Preferences/General/Keys
Line Down: Bind to Ctrl+K
Line up: Bind to Ctrl+I
(both when 'Editing Java Source')
and then try moving with Ctrl-K/I when the content assist pops up!
In Kepler, as jed mentions in the comments, select "when editing text" instead and it should work.
If you try to fill in the content manually, Eclipse will move.
The search is quite advanced, e.g. "ArL" can match ArrayList, etc., so if you know what you are looking for, instead of navigation you could use search.
This is certainly not a solution for everyone, but if you switch to the Emacs keyboard layout you can just use the key bindings for the "previous line" and "next line" commands, e.g., Ctrl-P and Ctrl-N.

How can I go to the next Eclipse marker (e.g. build error) using the keyboard?

Suppose I make a method signature change that breaks several callers, and I want to review the call sites manually to update them.
Once I change the signature, my "Problems" view shows, say, a dozen errors.
What keys can I hit to navigate through them while leaving the keyboard focus in the editor for fast fixups?
(It's been a while, but I think the Visual Studio equivalent is F8.)
Note that this question does not duplicate Eclipse: How to go to a error using only the keyboard (keyboard-shortcut)?, as that one seeks to navigate only between markers in the current file. In this case, I want to go to the next error regardless of which file it's in.
("Marker" is the general Eclipse term for errors, warnings, etc.)
The best I've come up with so far is Ctrl + F7 to flip to the Problems view, then ↓ to pick the topmost error, then Enter to go to it (which returns focus to the editor).
Here's a way to move to the next error, regardless of editor, in one keystroke. It's not perfect, but it works until it's fixed in Eclipse.
Open a "Markers" view. Click the down arrow at the top right, and choose "Configure Contents". Uncheck the show all box, and create the view to show only the problems you want to see. You'll probably want to deselect "warnings" and "errors" as well. Save it.
Click the same "Markers" down arrow, and choose "Group By". Select "None". This is important because you don't want the parent tree level nodes to show, otherwise some of your "next" actions will take you to those, which don't represent an error.
In Eclipse -> preferences -> keys, search for "Markers". If there is not a keystroke bound to the Markers view, create one. I use Ctrl + Shift + M
Get a keyboard hotkey tool like AutoHotKey (for PC's) or iKey for the Mac. I'm using iKey, but there are plenty of other Mac tools you can use. In your hotkey tool, define an action for the keystroke you want to use for "next error". I chose the standard CMD + .
For that keystroke/action in your hotkey tool, generate 3 keystrokes in the following order:
Ctrl + Shift + M
Down arrow
Enter
Of course, you'll want to change the first one to whatever you picked for yours. You'll probably want to restrict that action to be executed only when Eclipse is the current application.
Save that, create some compile errors, and test it.
Try Ctrl + 3 for Quick access popup window.
If the "Markers view" is not already visible, then type in "markers", in the searchbox on the popup window. Once you have selected it, it should stay available, when you press Ctrl + 3 the next time around.
I just had the same problem, after refactoring some parts of code. I had a lot of errors in different files and i had to go through all of those.
I used the following solution:
Mark all (relevant) entries in the Problems view.
To do this switch to the Problems view using Ctrl+F7 and select the entries with Shift+↓/↑
You can also select all entries using Ctrl+A
Open the marked errors by pressing ↵.
Every file containing at least one marked error will be opened.
The cursor will automatically select one error/file, as if you open only this specific entry
Fix the errors in the opened file.
Here you can use Ctrl+. to navigate to next error inside this file
Close the file using Ctrl+W when your done.
Eclipse will automatically focus the next file and you can go back to step 3
In my case this solution was much faster then switching to the Problems view each time.
There's an Eclipse bug entered for this that has an attachment that looks like it does what you want.
You could use AutoHotkey:
save the mouse position, send a mouse event to click on the arrow in CDT console and then return the mouse back to it's original location. Record the mouse coords with window spy or use autohotkey's search by image function (first capture the images of two arrows with printscreen into bitmaps).

Faster way (keyboard shortcuts?) to use quick fixes in Eclipse?

I often use the Eclipse feature (Galileo) of suggested error corrections to automatically create code stubs or to refactor things. For example, I would write a method that calls other methods which don't exist yet, then move the mouse over the error message and click on "create method". Or, change this to the class name and choose "add static modifier" from the quick fixes.
I think this is very convenient because it lets me stay in one place in my code and sort of "remotely" wire up what's not currently visible on my screen. What I think is annoying though, is that I have to leave the keyboard, hover my mouse over the error symbol, wait for the tooltip to pop up, and click on the option (doing that, I sometimes move the mouse a little over the edge and the tooltip goes away again - very annoying).
Am I missing a faster method here? I can't seem to find a keyboard shortcut, but then I have overlooked stuff from the huge preference dialog before.
Ctrl+1 : Quick Fix.
(Cmd+1 on Mac)
Just put your cursor on the part you suspect you can perform an action (correction, refactoring, ...) and hit the Quick Fix shortcut. The same popup will be displayed, and you can select the right option with the up and down keys.
That, combined with Ctrl+3 (Quick Access) gives you most of eclipse features at your fingertips ;)
See also:
Eclipse Tip: Shortcut to Quick Fix
My Favorite Eclipse Shortcut: Quick Fix
Eclipse hotkeys: eclipse shortcuts gold mine.
As an additional tip, a specific type of quick fix I use all the time has a dedicated shortcut:
Alt+Shift+J: Add Javadoc comment stub for current method.
After using ctrl+1 like mentioned in the top answer, press ctrl + enter to apply the selected fix all to problems of the same category.
In general, keyboard shortcuts in IDEs (and code tools in general) are coming from a user principle that holds that the more your hands/fingers can remain poised over the keyboard (as in the f-j centered "touch typist" position), the more productive you can become. This is probably why the use of the number keypad is not encouraged, or other keys, less common to the most basic layout keyboard, are not used. Many hold that useful keyboard shortcuts should be easily reachable from this position.
One thing I will say about eclipse keyboard shortcuts is that if you use a popular Windows presentation utility called Zoom-it, you need to turn that off when using eclipse. There are several show-stopper conflicts between the two, such as Ctrl-1 and Ctrl-3.

Anything similar to Emacs' buffer/window support for Eclipse?

I'm trying to make the switch from Emacs to Eclipse. One thing that seems to be missing is its buffer/window support.
I know in Eclipse I can drag an editor's tab title over to split the view, creating the equivalent of a new Emacs window, which is a step in the right direction.
I can't find any key bindings for this functionality, though. Ideally, I'd like to be able to set keys to split horizontal, split vertical, switch to next (there is a next editor, but I want the next window/whatever you call it), switch to previous, close this window split (not this editor), close all other editor window splits.
As it is, the only way I've found to close a split pane is to drag all the files over one by one until none are left. Things like this make working with split screens tedious in Eclipse.
Any help would be appreciated, hopefully there's something simple I'm missing.
Emacs+ has this exact behavior for Eclipse: http://www.mulgasoft.com/emacsplus
According to the keys preference there is an unbound command to open a new editor, which would open another tab rather than split the view. There is also an unbound command to close all other editors. Ctrl+W will close the current editor and Ctrl+F6 will switch between tabs. You can bind or rebind these to be closer to their Emacs equivalents. Alternatively there is an Emacs key map which you may find more helpful. Unfortunately I don't it's possible to split the view from the keyboard.
Try Ctrl-Tab and Ctrl-Shift-Tab for cycling through tabs (buffers) and Ctrl-F4 for closing a tab. You can also look through the shortcut bindings in the eclipse configuration.