Why a revert a file in EGit, but the dirty symbol '<' still exist in the project view? - revert

I try EGit revert for several days, It's very confuse that when I revert the file following the user guide, and I still got the file dirty symbol in the related file.
http://wiki.eclipse.org/EGit/User_Guide#Reverting_Changes
I choose 'Replace with' -> 'File in Git Index', it works, the content has been revert, but the symbol stays the same, sometimes, the symbol will disappear after a while, but sometimes, it didn't disappear.
I'm using eclipse on windows, I'm not sure it's about the '\r\n' character. But I use 'Compare with ' -> 'File in Git Index', two files look the same.
Hope someone can tell me why, I think it can be a bug? Thank you in advance.

If you are trying to revert the file back to the version in the latest commit you should use the Replace with > HEAD Revision action.
Running this action should remove the dirty symbol from the file's decorations.

I had the same problem, just today. And I was doing "Revert to HEAD" revision and still the "dirty" symbol ">" would still be there.
First only restart Eclipse have helped, but after I tried to press "refresh" button in the "Git Staging" view. And this has removed the file from the staging view from "Unstaged changes" list and also removed the "dirty >" mark.
Hope this helps.
I used Eclipse
Version: 4.2.1.v20130118-173121-9MF7GHYdG0B5kx4E_SkfZV-1mNjVATf67ZAb7
Build id: M20130204-1200
with android development tools ADT
Build: v22.0.1-685705
under Windows 8 64

Related

Only partial syntax highlighting in Kotlin script file

I opened a folder in Android Studio which contains a Kotlin script file (.kts). I configured a JDK as SDK in Project Structure (but I added no gradle files), and running the file as Kotlin script works fine. However the syntax highlighting is only PARTIALLY working, see below example (Linux Mint 19.3 and AS 4.1.3):
Some of the stuff missing:
unused variable should be gray (val unused)
to/forEach keyword should be yellow and italic
misspelled variable names should be red
bad style such as extra spaces should be underlined
etc.
What's even going on here? Is this some sort of "fallback" mode?
Any way to use the "full" syntax highlighting from normal Android projects, so I can spot mistakes earlier?
For reference, this is what it "should" look like (pasted into a random Android project):
Renaming the file to end in *.main.kts (scriptname.main.kts) enabled full highlighting for me!
I get this type of issues from time to time with IntelliJ IDEA. I haven't found the reason why it happens, neither do I know the 100% working solution. But here are the options that usually help me solve it:
Restart IDE
Invalidating caches: File > Invalidate Caches...
Re-import the project. Remove the .idea folder and the project.iml file and try to import the project again.
Update the IDE. Last time I had this issue, nothing helped but updating IDEA to 2021.1.
I hope some of these options will help.

IntelliJ: Lost files after "Update project" and can't find them on Local history

I have a nodjs project and i use IntelliJ to run it. Lately the project structure is not appearing as it used to, as if the project was not compiling. So, while searching for answeres, I clicked on the "Update project" button on the right top, but quickly realised it was going to update based on what was on the remote repo.
I've been developing for a few weeks without a single commit because my company asked me to (don't ask why), and the code had sensible data so I didn't have a backup.
After clicking that button, IntelliJ asked me if I wanted to merge my project files with the remote ones, I just pressed Cancel, and that was enough for IntelliJ to merge my entire project and lose a bunch of files I've been working with.
Suprisingly, they're not even on the Local History list. Even though it says "279 files" there I can't click or find any of the files.
Despite not being able to find them, I went to the changes.storageData file under IntelliJIdea2017.2\system\LocalHistory, searched for the names of the files I'm looking for, and found them all there, which makes me think there's still a way of finding them.
So, does anyone know where I can find deleted files after pressing the git "Update project" button on IntelliJ when they're not on the Local History file list?
Thanks a lot in advance!
As I understand, the files were not committed, so Update could not delete them, because git merge/rebase do not start when there are uncommitted changes (see e.g. this question)
They were probably automatically stashed before the update, and not unstashed because the update was actually canceled.
So the first place to check is git stash VCS - Git - Unstash... or Shelf (if Update project is configured to use Shelf)

TFS 2012 - Compare With Previous.. Previous

I tried diging to find who wrote a certain line in a project.
I've Annotate the cs file notice there was a change couple of days ago..
When clicking "Compare With Previous" I notice that the last developer only added indent spaces.
I want to see the previous of that version.
My workaround is to use View History and start comparing.. But that's not fun.
Any clue how can I do that?
Have you tried doing a Get Specific version to download a previous version to your local workspace, then doing an Annotate. I think that should work.

Android Studio-wont remember new edits and automatically reverts to old versions of files sometimes

Every once and a while I have an issue with the new Android Studio. Sometimes while editing, if I make a mistake in one of my files, then try to build it, Android studio will come back with some "Gradle" error. It will then automatically REVERT back to my original code (thus deleting any of my changes). I do not necessarily like this behavior, but I could deal with it.
However... sometimes, in the course of SAVING and editing, it gets into this weird state where Android Studio will REMEMBER the error, and wont let me correct it. I.e. it will keep restoring the OLD version of the file, with the error in it, no matter how many times I try to correct it and re-save it. An example of this is as follows. In the following XML document fragment, I mistakenly added the [android:backcolor="#00000000"] to one of my XML layout files...
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textColor="#111"
android:background="?android:attr/activatedBackgroundIndicator"
android:backcolor="#00000000"
android:minHeight="?android:attr/listPreferredItemHeightSmall"/>
After trying to build, Android Studio came back with the following error:
"Error:(1, -1) Gradle:No resource identifier found for attributed 'backcolor' in package 'android'.
Of course, I tried to simply DELETE the offending line that I added to return my code to its original state, before I added the line. I saved it (i.e. save-all/etc...) then tried to rebuild. To my dismay, Android Studio RESTORES the bad version, reinserting the erroneous [android:backcolor="#00000000"] line again back into the file.
I have also tried SAVING (save all) exiting out, going back in, the rebuilding it again, and just about every variation of this. Though the ONLY way that seems that will correct it sometimes is to completely exit out of Android Studio, start it back up again, and try again.
I am guessing that this is really a "feature" and has something to do with source control, and/or Gradle, and that I just don't fully understand it yet. I am also guessing that there is some setting somewhere to adjust and/or correct this - but I am clueless as to what is going on and what to do to fix it.
Is there a way to correct this annoying behavior of Android Studio?
I've had a similar issue when I make a mistake in my strings.xml file, for example when I have an apostrophe without preceding with a '\'. The trouble is that when the build fails, Android Studio automatically opens app\build\intermediates\res\merged\debug\values\values.xml to show me the broken string. If I then try to correct the string in that file, it doesn't do any good because when I try to rebuild, strings.xml is still broken. The crucial thing is to make sure that you're making the correction in strings.xml rather than the values.xml file.
I have the same issue, but i followed following steps and it resolved my issue,
1) Edit your layout file and open the same layout file in notepad, if you can see updated data in notepad then its Studio Synch issue. then re-synch project.
2) If your edited layout file is not reflecting new changes in notepad file then, first re-synch Studio project and followed step 1.
I hope this will resolved your issue as well.
I still have this issue, the only way I have found to fix it is to go to the terminal in android studio and run
rm -R app/build/intermediates/data-binding-layout-out
Android Studio is failing to delete the last build of the layout, when you try to compile again. Once you do it manually everything is back to normal.
While this issue still occasionally happens (as of currently the latest version is 0.5.+), a simple workaround is to manually edit the xml file with a text editor, then save it. Android Studio will then force resync those files.
To save the latest edits, click on the particular file in project window and select synchronize, and rebuild the code. then the latest edits will be saved.
I just had the same error and made me go crazy
I solved it by copying my project file to another directory and then importing it as a new project and the problem disappeared

Can't Copy & Paste in Eclipse 3.5

I recently updated my Eclipse to the latest release 3.5 and since then I have a very annoying problem with c&p using the shortcuts.
In an editor (xml, jsp, doesn't matter which one) I try to copy something and paste it somewhere else, nothing happens. When I cut out something and put it somewhere else I sometimes get something else (like a messed up part of my previous selection) or just some whitespaces. This gets even worse when I change lines in between.
First I thought that my keyboard is probably broken but it works just fine in other programs. Then I tried using the context menus' c&p and there it works. Yesterday I managed to get at least an error message when I tried to copy a file in the navigator from one project to another (the message was just "error using copy...bla". no details).
Does anyone else have this problem, or know how to solve it?
I am running on Kubuntu 9.04, and have quite some plugins installed (but only from the Galileo Updates Site), like Birt, Mylin, WST, or Subversive.
For my problem, I had to go to Window > Preferences > Java > Editor > Typing, and uncheck "Update imports"
This must be related to the key mapping, since those shortcuts are defined according to context.
(Column "When", in Preferences / General / Keys)
Check if those shortcuts do not work for any editor (do they work for Java editor?)
If they work for some editor, not for other, then some plugin settings must have re-affected them to another command.
This is caused by various X clipboard managers doing weird things with the clipboard. (bug report).
In XFCE the clipman applet was rolled in XFCE 4.8, and will be the source of these problems.
To fix this in XFCE - kill xfce4-settings-helper. You will need to use Settings Manager -> Session and Startup -> Session to kill it, as otherwise it may restart automatically.
To prevent this starting next time, you will need to remove it from your startup/login programs in Settings Manager > Session and Startup > Application Autostart.
Problem was solved with newer Eclipse releases. I think >= 3.6. Depending on your distribution there may be a (back)port of this (not on my Xubuntu 11.04) within the repositories.
So a tarball installation of Eclipse 4.0 works perfectly for me. Cut&Paste works and I am lucky that my plugins are compatible to 4.0.
Unfortunately Sublime Text has the same problems.
I read somewhere that in KDE maybe Klipper / "Klipper on the panel" conflicts with eclipse copy action.
It's a tool for clipboard history. Try to remove that! It may solve your problem :-/
For me the xfce4-settings-helper killing worked.
Workaround:
You can cut&paste from the compare view. So simply compare the un-copyable file (e.g., local history) with a different version and Control-C what you need there.
In the *.java editor page, right click and select open in text editor. Past your snippet there. Your Snippet will show in the *.java page'
I use Eclipse Kepler for PHP development. It's dumb I know.
None of the solutions suggested here has solved this source of frustration.
I can confirm the copy function works whether shortcut keys are bound or not. As I can copy from eclipse and paste into any other application. Except eclipse.
My solution. Accidental discovery: Eclipse Kepler will allow you to paste outside the php open and close tags and allow you to click and drag the highlighted block of content into into position.
Acceptable solution for small bits of code. Horribly crippling for larger development environments.
For Xming, this resolved the problem for me. In XLaunch uncheck Clipboard (clipboard manager) in the "Specify parameter settings" GUI form.

Resources