Eclipse shortcut for Compare With Head Revision - eclipse

I want to have a keyboard shortcut for comparing the current open buffer with the HEAD version of that file. This is available in the context menu by clicking Compare With/Head Revision.
I tried to add a key binding in Preferences/General/Keys, but the key binding is ignored. I can set (and use) shortcuts for Compare with other resource and Compare with previous version, but the most useful one, Compare with HEAD Revision doesn't work. I couldn't find any difference between the ones that work and the ones that don't.
I am using Eclipse Helios (3.6.2).

The answer is actually what Mohsen suggested:
Window dropdown menu > Customize Perspective > Command Groups Availability and there check the Git box.
This enables the relevant shortcut keys for this perspective.

Go to Eclipse Window->Preferences
General->Keys
Select the Compare command and add bindings for it.

It works after upgrading to EGit 2.0. I am now using Indigo (Eclipse 3.7.2).
I can set (and use) shortcuts to Compare with HEAD and Show Annotations (blame), both of which didn't work before.

Related

eclipse compare editor stopped showing detailed differences

I've been using eclipse for java android development for 6 months and I love the compare editor. In the last few days I have been hacking away and I think I have all my git ducks in a row, or close enough that things are clean and neat and I can find old working versions of apps.
But it seems in the last day or two, the eclipse compare editor has stopped showing diffs! i right click on uncommitted PlayThread.java and choose to compare with Commit... or HEAD or branch or anything, and no matter how similar the files might be, the compare editor shows one big white bar on its right side, and clicking to go to the next difference highlights the whole file!
I have looked through the git and compare preferences on eclipse and can't find anything that might help.
Any help getting my beautiful compare editor working for me again would be greatly appreciated!
With respect to Javascript compair showing nothing, there is a known bug.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=509820
Workaround...
Window >> Preferences >> General Tab >> Compare/Patch
Deselect checkbox next to "Open structure compare automatically"
Note the the latest EGit 5.3.0 (Feb. 2020, 8 years later) improves the right side of the compare editor, using the Eclipse -> Preferences -> Text Editors -> Show whitespace characters mentioned in Vivek's answer.
Text comparisons in Eclipse have been improved to make "Show Whitespace" work in more cases.
Also, concurrent editing of a file in a merge editor and in another editor open on the same file has been improved and works now better and even for files not in the Eclipse workspace.
Note that both showing whitespace and concurrent editing depend not only on the way EGit sets up the comparison (which is what we improved) but also on the actual editors being used. These editors are beyond the control of EGit.
With files not in the Eclipse workspace, one may encounter Platform bug 214351 when a file is open in another editor.
Original answer (May 2012):
The compare editor shows one big white bar on its right side,
That means Egit considers the local content of that file (on your disk) differs completely from what have been committed.
The one classic case where that happens is for automatic eol conversion (Windows <=> Unix), which is why I always set core.autocrlf to false.
See "Git beta on Windows (msysgit) - Unix or DOS line termination".
See also "Distributing git configuration with the code" for managing those eol through .gitattribute file (except EGit doesn't support yet .gitattribute file).
In this instance, the OP mwengler reports:
Well that was it.
The way I fixed it was in Eclipse > Window > Preferences > General > Compare/Patch > General on that page I checked "Ignore white space" and now the editor shows my diffs.
But I think I will turn off that autocrlf stuff, I don't think I'm using anything on windows that can't handle both flavors
See Egit bug 361503 which mentions that this "Ignore White Space" now also honors the core.autocrlf setting.
Below setting also works for Eclipse Oxygen Release.
It appears that this has something to do with the Structured Compare. To
use the simpler and apparently working version of compare choose:
Window > Preferences > General Tab > Compare/Patch
Deselect checkbox next to "Open structure compare automatically"
Enjoy text level diffing of ES6 classes.
Regards,
Rasool Javeed Mohammad
javeed.mca#gmail.com
Today again after long I caught in this issue. Every-time I fix this problem and move on but this time I tried understanding the root cause and get it fixed and since the fix which worked for me is not in the answers to this question, thus adding part with details :
I am using EGit plugin in eclipse, and the problem was same as OP - eclipse compare tool was not highlighting the differences rather a whole block as if the whole file has changed.
Lets understand the issue first , since I was aware that this is related to CRLF vs LF eol , so went to check that first and enabled the visibility as :
Eclipse -> Preferences -> Text Editors -> Show whitespace characters
In the above click on configure visibility.
Now as you see highlighted in above image, select the check boxes under Trailing and against both Carrier Return (CR) and Line Feed (LF).
Apply - Save and Close. Now in my case , file looked like this :
and this evident that for me I had CRLF window like eol which further also confirms as I do not have core.autocrlf set to true and by default it is false thus Git actually didn't tried to do anything about my EOL delimiters (as expected in this case).
And until this stage, the compare tool was showing the whole file as changed.
Now, moving to fix which worked for me.
Since, I wanted to get this fix within IDE realm, thus I first converted the particular file to Unix delimiters as :
Then my file became with LF (Unix delimiter) eol :
And compare tool started highlighting the delta.
So the issue as it was assumed was because of CRLF (window style) eol and eclipse comparator was not able to highlight delta rather whole file.
Then, instead of changing each file or package to Unix delimiters .
I updated in Eclipse->Preferences -> Workspace
By this, eclipse takes care of line-endings for new files to Unix, so that text files are saved in a format that is not specific to the Windows OS and most easily shared across heterogeneous developer desktops. After all this compare tool worked happily ever.
Hope this helps.

eclipse keyboard shorcut list/poster

I am trying to locate a list of shorcuts so I can print it and learn a couple every day till I master not using the mouse.
I know about Eclipse Shortcut Overview but this is using emacs bindings, and I am using the default shorcuts.
I am not looking for an blogpost mentioning 10 nice shorcuts, I want a comprehensive list (maybe not complete but near, whatever fits in one page printout)
I am using eclipse 3.6 on windows but a list of 3.5 etc would help too.
I always found Ctrl+Shift+L the only first shortcut I needed to know with Eclipse.
Wherever you are, type Ctrl+Shift+L, and the list of all shortcuts available to you given the current context will pop-up.
See this article for reference.
in Preferences > General > Keys
you got them all (dunno about EMAC ..)
and - but - can export them to csv !

The Author column in the CVS history disappeared from Eclipse

It happened since yesterday that the Author column in the CVS history disappeared in my Eclipse IDE. I have gone through all the menus in Eclipse and all kinds of Google search but couldn't figured out how to add it back. Does anyone have a clue on it?
I am using the latest Eclipse (Helios) on 64-bit Windows 7. I used the following steps to show CVS history: right click the file name under Project Explorer => Team => Show History.
Thanks!
This happened in my eclipse as well. Unfortunately the other answers did not help me but I was able to fix it by manually editing the cvs plugins stored preference.
Close Eclipse.
Go to the path $WORKSPACE/.metadata/.plugins/org.eclipse.team.cvs.ui in your filesystem. Where $WORKSPACE is the directory that has your Eclipse workspace.
Edit the file dialog_settings.xml in that directory.
You should see an item element with the attribute key="COL_AUTHOR" change the value attribute to be non-zero (I set mine to 100). Specifically, the Xpath for the attribute your trying to change is //section[#name="org.eclipse.team.internal.ccvs.ui.CVSHistoryTableProvider"]/item[#key="COL_AUTHOR"]/#value
Start up Eclipse and the problem should be fixed.
This happened to me as well. It turns out that the author column can be completely collapsed in between the 'Revision Time' column and the 'Comment' column. I had to carefully put my mouse cursor on the right side of the divider between the two columns and drag to the right, in effect resizing the author column to not have 0 width. The UI then exposes the author column, which should always be there if the Revision and Comment columns are present.
I have changed my eclipse environment, so have no way to go back to the old one to confirm that. But thanks for the help, and I will keep it in my mind in future.

How to activate revision info in line number view

I know of an Eclipse feature to show revision information (gradual coloring, more info like revisionnumber, date and author on mouseover) for the last changes in a line in the linenumbers-view.
Does anyone know how to activate this feature for a file, or even better, by default? I accidently hit some shortcut lately which made it show in one file, it does not show up in the others, though.
This is called "Show Annotation" and you can find it in the "Team" menu. Since this is a pretty expensive operation, you can't make it the default.
Regarding the shortcut: You have to enable the command group SVN.
Window -> Customize Perspective... -> Command Groups Availability -> check "SVN".
If you do this, some SVN actions show up in the toolbar which you can remove again (if you want) using the same Customize Perspective dialog (tab Tool Bar Visibility).
Remapping the shortcut did not work for me but enabling the command group did (with the default key mapping Ctrl+Alt+A).
(did not find a way to reply to Aaron's answer so I had to create a new one)
I found my way here while trying to find a way to get the option to show up with code from my git repository.
A lot of the logic in the other answers applies to git too, and I followed the equivalent steps for git but it didn't help me.
It turned out that my projects, although imported from a git repository, hadn't been connected to (or had become disconnected from) the eclipse git integration. I think this happened because I imported the projects before I installed the elcipse git plugin.
I needed to connect them thus:
Right-click your project (or multiple selected projects) in the Project Explorer
Select 'Team' > 'Share Project...'
The default settings were fine for me, but change them if needed
Click 'Finish'
I found this solution here.

Eclipse Search Menus disabled randomly

I use Eclipse 3.3 in my daily work, and have also used Eclipse 3.2 extensively as well. In both versions, sometimes the Search options (Java Search, File Search, etc) in the menu get disabled, seemingly at random times. However, with Ctrl+H, I am able to access the search functionality. Does anyone know why this happens? Has it been fixed in Eclipse 3.4?
window > close all perspective works for me.
Using Eclipse 4.3(!) this happened to me after doing a case-sensitive search.
Window -> Close All Perspectives didn't fix it and neither did restarting Eclipse using -clean. While messing with the search box, I discovered that simply clicking to a previous search entry allowed me to edit it and search again! Clicking back to the case-sensitive search grayed the option out again.
So before you reset anything in your workspace, try pulling up an older search entry using the Down Arrow.
I think this answer is what you all need to solve the issue on all versions.
I am using RAD 8 and I have also faced this problem than I removed org.eclipse.search directory in (workspace currently using) workspace/metadata/plugins folder then restart the eclipse.
That's all.
I don't have an exact answer. I will recommend that you try to correlate the disablement with which perspective is active. Likewise, which view is active. I have been using 3.4 and not experienced this issue.
Darn! I have that problem too -- in Eclipse 3.4.2.
Seems to be related to Navigator and Project Explorer views:
- Switch to Debug perspective: Search menu items are there.
- Switch to Java or Java EE perspective: Search menu items still there.
- Click on a project in Navigator or Project Explorer: Search menu items all DISABLED.
(Curse! I use search in Selected Resources a lot! )-:
Hmmm... It may slso depend on the file type currently open in the editor. (Like Java vs xml.)
Still present in Eclipse 3.5.2 -- and for the first time really sticky.
I checked out the "close all opened files and open any other file afterwards" answer and that brought back the Search menu items. Additionally, if you were lucky and have the Search result view open, than indeed there is this little link "Open search dialog".
By the way, additionally lots of other project-related menu items seem to be greyed out also together with this, and they did not reanimate :-( But I did not really check out if these are only items for which it is useful and planned to be greyed out in this situation.
I'm using RAD 7.5.1 which runs on Eclipse 3.4 and I get this problem frustratingly often. It doesn't matter which perspective or view I'm in, or which editor I have open.
Restarting RAD usually clears it up, but because that's such a colossal pain, I found that you can get around it in the Search View, there is a link; "Start a search from the search dialog" which will bring up the search dialog.
This isn't a great workaround because the link only shows if you have no search history. To do another search, you'll have to clear your search history in the view.
A late comment for anyone getting bitten by this, but I found "eclipse -clean" fixed it => this does a cleanup of the workspace before starting
Thanks http://letsgetdugg.com/2009/04/19/recovering-a-corrupt-eclipse-workspace/ for the tip, after I guessed my workspace might be corrupt.
Before search, check you may choose scope in empty Working set. Most Search menu disables Search button when you choose it. And mine, too :)
window > close all perspectives worked for me too.
But if you are just looking for a text search in the project you could press Ctrl+Alt+G on a marked text
I couldn't get it to work even when restarting Eclipse.
Here's what worked for me: Closing all open files and opening a different file. The different file happened to be .java, but not sure if that had anything to do with it.
I get this problem from time to time.
In the past I've fixed by starting eclipse with the -clean option.
Once when that didn't work I created a new workspace.
I followed these instructions for those two solutions.
The clean option didn't work for me today and I found this thread because I didn't want to create a new workspace. The closing all files and reopening one file did work however.
I had this issue also in eclipse 3.6.2: Helios Service Release 1.
Closed all the editor windows, and the search has been enabled.
Switching to another perspective, then back, works quickly for me.
I've faced similar issue in Ctrl+H "File Search" tab. The "Search" and "Replace" button was grayed out (disabled). The solution is fill the "File name patterns" text box (for eg, *.py). May be this is by design!
I have this problem with MyEclipse 7 (eclipse 3.4) under Debian Lenny. Perspective doesn't seem to matter. I get around it with the shortcut Ctrl+H but I was hoping for a better way.
Just had this problem in Eclipse Neon 3. It is a very common problem in RAD. I could find using in the console, then switch back to the source and search. RAD would disable the find/search options per source file open. This is very frustrating.
I had this problem too. It appeared when I installed the m2eclipse plugin.
I had not found a solution, but you can use Ctrl+H shortcut instead.
And you can navigate between tabs with Ctrl+PgDown or Ctrl+PgUp keys.
I've uninstalled the following pluings and it worked.
Maven integration
PMD
eclipse checkstyle plugin
EclEmma (coverage)
I don't know which of those cause the problem. To uninstall a plugin: Help -> Software Updates...-> "Installed Software" tab.