Highlighting modified lines in Eclipse - eclipse

In netbeans, if I open a file which is under version control the lines which are modified are highlighted in the left. (green for new lines and blue for modified lines)
Is it possible to get a similar effect in Eclipse?

Open the Preferences window
Search for "diff"
Select Quick Diff
Change the "Use this reference source" to a SCM provider (like CVS, SVN or Git)
By default, it compares to the latest version on disk, which, if you've saved the file, is no diff at all. You have to activate the comparison against a SCM repo. I'm not sure what happens if you more than one type of SCM since this is only a single selection.

With Subversive, you can do Team > Show Annotations, and it will annotate the lines with the author and date of the last modification of that line.

Right-click on the file > Team > Show annotation.
A brown tape will appear on the left-side of the code (it represents commited lines), and the modified lines will be shown in white.

In Eclipse by using its Quick Diff feature. This is easy to do:
Go to Window -> Preferences -> General -> Editors -> Text Editors ->
Quick Diff. This is the dialog from where it can be configured.
Turn on Quick Diff, by enabling the option Enable quick diff.
Choose the version control system for which Quick Diff is needed
from the dropdown Use this reference source. Git, SVN and CVS should
be present here. Mercurial appears if the MercurialEclipse plugin is
installed.
The overview ruler is the ruler to the right of the scrollbar in the
editor. If you would like to see the uncommitted lines to be marked
on it, enable the option Show differences in overview ruler.
Choose Apply and OK. Close all editor windows and reopen the source
file that you want in the editor.
You should be able to see the newly added, modified or deleted lines marked in colors in the left bar on which line numbers are usually displayed. The colors used are the ones set in the Quick Diff dialog (see above steps). You can also view these uncommitted locations marked along the overview ruler on the right.

For Eclipse Version: 2019-03 (4.11.0) Go to
Select 'window'
Select 'Preferences'
Go to General -> Editors -> Text Editors -> Quick Diff
Tick 'Enable quick diff'
Tick 'Show differences in overview ruler'
If you want to keep the changes after you save your local copy, then you need to tell the eclipse to compare the local copy with the repository version. To do that change the reference source accordingly.

EGit plugin's Quick Diff does exactly the same as netbans modified lines feature.
http://wiki.eclipse.org/EGit/User_Guide/State

There are at least two things you must do to get revision-based change highlighting (i.e., ones that do not disappear when the file is saved) to show up in Eclipse's "overview ruler" when using Git:
Prior to import, make sure that Preferences > Team > Git > Projects > Automatically Share project that are located inside Git repositories is checked or import the project into your workspace using Import... > Git > Projects from Git (as pointed out by #cornelius in a comment on another answer)
Enable Quick Diff and select "A Git Revision" as the reference source: Preferences > Editors > Text Editors > Quick Diff

In eclipse too you will get the line highlighted which is changed util you save the file.
and highlight is nothing but the change in color at the left panel of the editor before the start of that changed line.

Related

How to highlight the recently edited lines on the right side of the editor

Is there any way to get the recently edited lines or blocks highlighted on the right side the way an error,or warning or a TODO is highlighted as given in the below screenshot
I think you are looking for the Quick Diff Feature:
Preferences -> General -> Editors -> Text Editors -> Quick Diff
Here you can set whether to show the quick diff in the left and/or right ruler, what colors to use, and what base version to diff against, e.g. since last save, or different types of version control.
If you are using version control, such as GIT or SVN, you can have a similar effect by selecting Team -> Show Annotations from the context menu.

In Eclipse, how to make Flat Presentation default in the Team Perspective?

When using a centralized versioning system like CVS or SVN, I like to review my changes in the Team Synchronizing View before I commit them.
By default Eclipse collapses the source tree, and I always have to click on the little arrow in the icon "Show Java Workspace" and select the checkbox for Flat Presentation:
Is there a way to make this the default for the Synchronizing perspective?
Window > Preferences > Team > Choose the presentation to be used when displaying Workspace projects : Flat
"The same can be done for CVS in Team -> CVS -> Synchronize/Compare settings, though I haven't tested it."
Tested it for CVS. Doesn't work. Scumbag Eclipse :/
I've found a way to do that for SVN, unchecking the option Allow models to participate in synchronizations:
The same can be done for CVS in Team -> CVS -> Synchronize/Compare settings, though I haven't really tested it.
UPDATE: If that does not work on the first time, on the View Menu (activated clicking the little arrow beside the minimize button for the Synchronize panel), select Presentation -> Tree.

Equivalent of Komodo's "show unsaved changes" in Aptana Studio?

I've been using Komodo Edit for the last few years, but am once again thinking of switching to Aptana Studio because of it's built in refactoring tools for Python.
One of the features I use all the time in Komodo Edit is "show unsaved changes". This simple feature pops up a window with a diff of the text in the current editor window vs. the saved file on disk.
There must be a way of doing this in Aptana Studio (or more to the point, there must be a way of doing this in Eclipse, since Aptana is built on top of it.)
How do I get a diff show unsaved changes?
Windows -> Preferences -> General -> Editors -> Quick Diff.
Check the 'Show Differences in overview ruler'. Set the combo on 'Version on disk'. Select nicer colors for the diff ;) and OK the dialog.
Now, every change in your file will be visible on the 'Overview Ruler' and on the 'Annotation Ruler' (the editor left and right bars). The marks will be visible until you save the file.
Not an exact match to the Komodo feature, but this, along with the local history feature of Eclipse, can provide a lot of control.
Hope that helps.

Subclipse - marking code changes like in NetBeans

I moved recently from NetBeans to Eclipse. Since I have to work with the project checked out from SVN I installed Eclipse. My question is: how to make Subclipse indicated the changes that I introduce in the source code (downloaded from SVN) just like NetBeans? Is there any way?
In Window -> Preferences navigate to General -> Editors -> Text Editors -> Quick Diff and tick "Enable quick diff", "Show differences in overview ruler" and set "Use this reference source" to "Pristine SVN Copy".
You might also want to change the colors to match NetBeans (blue for Changes, green for Additions, red for Deletions).
Note that you'll probably need to restart Eclipse for this to take effect.
As you go on changing the code it will show your changes on the side ruler until you commit to SVN.
If you are referring to the Viewing Changes in the Source Editor section of subversion in Netbeans:
alt text http://netbeans.org/images_www/articles/60/ide/vcs/left-ui.png
Then it should be like activating the Quick diff Annotate in Subclipse:
Team -> Show Annotations option on a file
Subclipse automatically keeps track the changes that you do in Eclipse.
If you would like to see the changes, the convention in Eclipse is to go to Team -> Synchronize menu on the project.
If you want to quickly compare changes from a single file, right click on it select 'Compare With' -> 'Latest from Repository'. The resulting diff would look much like the one in Binary Nerd's first screenshot, only it will appear in Editor section and you won't have to switch perspectives.
Doesn't subclipse mark the classes and packages in the Package Explorer as being different to the version checked-in to SVN?
EDIT
You can use the compare function to see the differences. One way to do this is to open the synchronize view, right click on the desired class and choose compare (i can't remember the exact menu option, but it's something like that).
(source: tigris.org)

Howto enable Quick diff with plus and minus in Eclipse?

i had a eclipse workspace. I used Galileo and Subclipse. I got the workspace from a associate. The following function was enabled:
There were signs shown to indicate differences to the svn state of the document, directly right beside the line numbers. If I added a line a "+" were shown. If I deleted a line a "-" were shown and a "~" when I edited a line.
I think this is much easier than the colored quick diff. Now I had to install the hole system again. I installed Eclipse Galileo and Subclipse again. Now I can't find the settings to enable this feature anymore.
How do I enable it?
Is this called Quick Diff, too?
Thanks in advance.
It is under the Accessibility preferences.
General -> Editors -> Text Editors -> Accessibility -> Use Characters to show changes in the vertical ruler.