I'm working on eclipse and sometimes I have to delete some lines of code that indeed I prefer to backup on a notepad file (because I never know if that lines of code could be useful in another moment), so I have to select all the code I have to delete, ctrl+x, open a text editor, ctrl+v, and save it somewhere.
I was searching for a "code recycle bin plugin", so that I can select the code to trash, right click and "send to code recycle bin"; and in the future the deleted code is still there if I need it.
You can achieve a similar effect by configuring your workspace Local History settings:
What I'm gathering from your question is that you often modify code in such a way that you're not sure if it will work after you modify it. What you need is a software versioning system.
Often, because a coder may introduce new code that is faulty or introduces unnecessary defects, we need to revert back to the last working version. There is an easier way than "Ctrl+X"ing the code and placing it in a "recycle bin" for future use. Try using a software versioning system such as Git for better results. The source code is available online, and you can get an account for free.
In short, version control system will stop you from having to juggle files unnecessarily.
There is something similar which will resolve your issue, the Eclipse Remus project. You can download the plugin via the Eclipse Marketplace. After installation you can open the Remus Navigation view in your Java perspective, select the code and drop the code into the Navigation-Structure of the Remus Navigation view. The dropped source-code will be saved.
Related
I'm coming from NetBeans and evaluating others and more flexible IDEs supporting more languages (i.e. Python) than just php and related.
I kept an eye on Eclipse that seems to be the best choice; at the time I was not able to find an easy solution to keep the original project on my machine and automatically send / syncronize the files on the remove server via sftp.
All solutions seems to be outdated or stupid (like mounting a smb partition or manually send the file via an ftp client!
I'm not going to believe that an IDE like Eclipse doesn't have a smart solution of what I consider a basic feature of an IDE, so I think I missed something... On Eclipse forums I've seen the same question asked lots of time but without any answer!
Some suggestions about is strongly apreciated otherwise I think the only solution is stick on one IDE each language I use that seem to be incredible on 2018.
I'm developing on MacOS and the most interesting solution (kDevelop) fails on building with MacPorts.
Thank you very much.
RSE is a very poor solution, as you noted it's a one-shot sync and is useless if you want to develop locally and only deploy occasionally. For many years I used the Aptana Studio suite of plugins which included excellent upload/sync tools for individual files or whole projects, let you diff everything against a remote file structure over SFTP when you wanted and exclude whatever you wanted.
Unfortunately, Aptana is no longer supported and causes some major problems in Eclipse Neon and later. Specifically, its editors are completely broken, and they override the native Eclipse editors, opening new windows that are blank with no title. However, it is still by far the best solution for casual SFTP deployment...there is literally nothing else even close. With some work it is possible to install Aptana and get use of its publishing tools while preventing it from destroying the rest of your workspace.
Install Aptana from the marketplace.
Go to Window > Preferences > Install/Update, then click "Uninstall or update".
Uninstall everything to do with Aptana except for Aptana Studio 3 Core and the Aptana SecureFTP Library inside that.
This gets rid of most, but not all of Aptana's editors, and the worst one is the HTML editor which creates a second HTML content type in Eclipse that cannot be removed and causes all kinds of chaos. But there is a workaround.
Exit Eclipse. Go into the eclipse/plugins/ directory and remove all plugins beginning with com.aptana.editor.* EXCEPT FOR THE FOLLOWING which seem to be required:
com.aptana.editor.common.override_1.0.0.1351531287.jar
com.aptana.editor.common_3.0.3.1400201987.jar
com.aptana.editor.diff_3.0.0.1365788962.jar
com.aptana.editor.dtd_3.0.0.1354746625.jar
com.aptana.editor.epl_3.0.0.1398883419.jar
com.aptana.editor.erb_3.0.3.1380237252.jar
com.aptana.editor.findbar_3.0.0.jar
com.aptana.editor.idl_3.0.0.1365788962.jar
com.aptana.editor.text_3.0.0.1339173764.jar
Go back into Eclipse. Right-clicking a project folder should now expose a 'Publish' option that lets you run Aptana's deployment wizard and sync to a remote filesystem over SFTP.
Hope this helps...took me hours of trial and error, but finally everything works. For the record I am using Neon, not Oxygen, so I can't say definitively whether it will work in later versions.
This is basically the same question as this except for Netbeans 8.0.2 (running under jMonkeyEngine SDK 3.1-alpha1) instead of Visual Studio.
Honestly, the aforemetnioned link says it better than I can, but basically I'm a vim key binding user, and have the netbeans jVi plugin installed and want to map, for example, alt-j and alt-k to scroll through the code completion list instead of the arrow keys:
I've searched through Tools->Options->Keymap, as well as the the JVi configs at Tools->Options->jViConfig. I don't see anything at all under jViConfig, so I think the standard NetBeans key bindings are the way to go.
I have tried modifying most of the obvious down keys e.g insertion point down, scroll down, page down etc, but they all affect the underlying text in the editor, never the completion list.
And:
Does anyone know of a way to do this?
Or maybe a plugin to provide the functionality?
It simply appears that the raw arrow key movements are not mappable by netbeans (?).
Note: this is possible to do in Visual Studio 2015, so I'm hoping it's possible in NetBeans as well.
Many Thanks.
AFAIK, there is no way to do this in NetBeans. At least there wasn't in 2010, when I filed the NetBeans bug hint completion makes assumptions about associated editor pane bindings. I maintain jVi. I filed the bug since I was having trouble with completion bindings for some special keys. In the NB source take a look at
editor.completion/src/org/netbeans/modules/editor/completion/CompletionScrollPane.java
And you'll see a bunch of hardcoded stuff.
In the jVi source
nbvi/nbvi-module/src/org/netbeans/modules/jvi/KeyBindings.java
method fixupKeypadKeys, you see what jVi does (given the fix for the bug I filed). This is part of some arcane code that depends on being friend with some NB editor package.
You could file a bug with NB. If you provided NB a patch, they might incorporate it. If you file a NB bug, cc me (err at netbeans.org)
Alternately, you could try adding some code to the jVi file to add your keybindings.
I have done a fair amount of googling about this question and most of the threads I've found are 2+ years old, so I am wondering if anything has changed, or if there is a new method to solve the issue pertaining to this topic.
As you might know when using IntelliJ (I use 14.0.2), it often autosaves files. For me, when making a change in Java or JavaScript files, its about 2 seconds before the changes are saved. There are options that one would think should have an effect on this, such as Settings > Appearance & Behavior > System Settings > Synchronization > Save files automatically if application is idle for X sec. These settings seem to have no effect for me though, and IntelliJ still autosaves, for example if I need to scroll up to remember how a method I am referencing does something.
This is really frustrating when I have auto-makes, which mess up TomCat, or watches on files via Grunt, Karma, etc when doing JS development. Is there a magic setting that they've put in recently? Has anyone figured out how to turn off auto-save, or actually delay it?
It cannot be totally disabled. It is core to the functionality of the IDE and heavily integrated into its operation, including its Open API (for plugins). Turning it off would cause problems with a lot of features.
You can disable both Save files on frame deactivation and Save files automatically if idle for x seconds settings (via File > Settings > Appearance & Behavior > System Settings):
With those settings disabled, IDEA only auto-saves on a major event such as building, running make, running a test or application, etc. <EDIT>It should also be noted that plugin authors have access to the FileDocumentManager.saveAllDocuments() method that invokes the auto-save. This is also one more reason why removing this functionality would be problematic.</EDIT> Scrolling up in a file should not be an event to trigger auto save (unless a third party plugin is doing such). I waited a good 15 minutes to verify - no auto-save. If you are seeing different behavior, I would recommend you open up a bug report (https://youtrack.jetbrains.com). You'll want to provide as much detail as possible since IDEA 14.0.2 has been out for quite some time and there are no reports of an issue with auto-save.
Note that I have the Settings > Editor > General > Editor Tab > Mark Modified tabs with asterisk turned on to verify the file is not being auto-saved. (i.e. the asterisk remains even after a long idle period and when I reactivate the IDEA frame.) Have you turned that on? It may be something else besides auto-save that is causing the other tools to see a file change. Enabling the asterisk option would help determine that.
Why you really don't need manually saving
It should also be noted, that you always have access to Local History. Local History constantly tracks (and records) all changes made to a project. And it allows you to easily revert a file, or an entire directory, back to a previous state (even unsaved ones). So any perceived loss of functionality by not being in full control of when a file is saved is made up for with this functionality. When I first started using IntelliJ IDEA in 2003, I found the auto save functional strange and felt that I lost some control as to determine when I wanted files included in a recompile. But as I used IntelliJ IDEA, I quickly (within a week or two) came to realize that this was a false feeling of control. Between local history, changelists, and the ability to shelf changes, I ultimately had a lot more control while at the same time didn't waste time trying to figure out why my recent change was not working, only to realize I forgot to save one of the files I changed. I switch from disliking the feature to absolutely loving it. I'd encourage people that see the auto save as a "limitation" or even a "deal breaker" to just try it for a while and see. It will require some changes to your personal workflow, I think in the end you will have a better workflow. I have not missed it in the past 16+ years I've been using IDEA.
EDIT
Are you launching Tomcat via an IntelliJ IDEA run/debug configuration? If so, do you have the "on frame deactivation" option in that Run/Debug configuration set to one of the "Update" options? That would cause the files to change.
You can disable the recompilation by enabling Power Save Mode.
When Power Save Mode is on, IntelliJ IDEA reduces its functionality to the one of a text editor, by not executing expensive background activities that drain laptop battery. These activities include error highlighting and on-the-fly inspections, autopopup code completion , and automatic incremental background compilation.
Alternatively, or if you think this is a bit too extreme, change the update action for your Tomcat to "Do Nothing".
I think the correct answer was given as a comment from ryanlutgen above:
The beaviour of "auto-saving" your file is not due to the auto-save options mentioned.
IJ saves all changes to your build sources to automatically build the target.
This can be turned of in:
Preferences -> Build,Execution,Deployment -> Compiler -> Make project automatically.
Note: now have to initiate the project build manually (e.g. by using an appropriate key-shortcut)
(All other "auto-save" options just fine-tune the build in auto-save behaviour.)
The bad new is: it's not possible to disable autosaving for intellij & Co. (JetBrains Webstorm and so on). I lost some work because i pressed CTRL-Z few time to take some older code, for mistake i pressed "z" and i couldn't do anymore CTRL-Y. I cannot keep the file open in other programs because it changes all the time and the other program asks me to refresh hundred times per day...
The good new: there are some workarounds. Just see the following (the references in square brakets point to the bottom of my comment):
From the official intellij support website[1]:
«Tuning the autosave behavior
The following options are available for tuning the autosave behavior (File | Settings | Appearance and Behavior | System Settings):
Save files on frame deactivation (i.e. on switching from IntelliJ IDEA to a different application)
Save files automatically if application is idle for N seconds
Note that those are optional autosave triggers, and you cannot turn off autosave completely.»
Please also check the website [2] (bottom of my comment) where you can find other workarounds and more details, as the following:
«In Settings → IDE Settings → General
uncheck "Synchronize files on frame activation" → uncheck "Save files on frame deactivation"
if you can, uncheck "Save files if application is idle for". If it's greyed out, set it to 6442450 seconds (about 74 days)...»
The last is to install eclipse and choose a dark skin for it. Nothing is perfect but...
EDIT: the option described in [2] about setting a big number it's not necessary, unless something is greyed and you cannot disable the autosaving... I need to test that.
Ah... the next problem will be to find the "save" button/command. In intelliJ Ctrl+S is "Save all" ...
[1] https://www.jetbrains.com/idea/help/saving-and-reverting-changes.html#d1542336e137
[2] https://intellij-support.jetbrains.com/hc/en-us/community/posts/207054215-Disabling-autosave
In the latest intellij or pycharm ide use the below option for disabling autosave.
File -> Settings -> Appearance & Behavior -> System Settings -> Save files when switching to a different application(Uncheck)
I stumbled upon this as well. Besides all the answers already given, there could be another cause: In my case it was due to the SonarLint plugin I've installed. That plugin does automatic analysis of each touched file and will do an auto-safe under the hood.
When I disabled certain file types (for example TypeScript/JavaScript files) for automatic analysis, finally those files weren't auto saved any more in IntelliJ.
If there are any file watchers active (Preferences>Tools>File Watchers), make sure to check their Advanced Options. Disable any Auto-save files to trigger the watcher toggles.
This option supersedes the Autosave options from Preferences>Appearance & Behaviour>System Settings.
What worked for me was unchecking the box to save files when switching to a different application or a built-in terminal. Preferences → System Settings
According to the documentation, it does not stop auto-saving all together. But it stops it from doing it all the time - which is at times annoying and unnecessary
If you are using flow, you should also disable the auto save there.
Preferences -> Languages & Frameworks -> Javascript
For the past month and a half I have been working on a project, an app for Android. Today my computer crashed. Apparently the backup didn't backup the source files for any of my projects though; it only backed up the drawable folders for some reason?
Anyway, I was wondering if there was a way to recover the source code from the app on the phone somehow. I never fully finished the app and created an .apk or anything, but I ran it on my phone several times for debugging purposes, so it is on my phone in a fairly recent state. Is there a way to somehow recover the source code for this? I would hate to have to redo anything, but it seems like I'm probably going to have to end up doing that.
I began the project in Eclipse Indigo but later switched IDEs to IntelliJ IDEA. The files I currently have on my computer are:
An EML file for the project. It appears to be blank.
The drawable folders
And that's it. Any ideas?
You can use dex2Jar to get a jar and then use JD-GUI to examine the code. Since it is decompiling it will not be exact, but close.
dex2jar: http://code.google.com/p/dex2jar/
JD-GUI: http://java.decompiler.free.fr/
You could look into this as an option:
It is a tool for reverse engineering 3rd party, closed, binary Android
apps. It can decode resources to nearly original form and rebuild them
after making some modifications; it makes possible to debug smali code
step by step. Also it makes working with app easier because of
project-like files structure and automation of some repetitive tasks
like building apk, etc.
http://code.google.com/p/android-apktool/
You can try file recovery softwares to get back your deleted files from your hard disk(if it is working).
These softwares worked for me in recovering pictures from a formatted SDCARD. So you can give it a try.
You may be able to use IntelliJ IDEA's "local history" feature. IntelliJ keeps track of all your edits in .IntelliJIdea10 folder in the use home. If that folder has not been damaged in the crash you should be able to recover all your codes.
Just right click on the module directory in the Project tab and select Local History > Show History. Wait for the list of history items to load, it may take a couple of seconds. Right click on an item in the left panel and select Revert.
Lately, I've been working on a project in NetBeans using the GUI editor that's built in. Before I noticed that it generated an XML ".form" file that didn't appear in the Project Explorer Pane which makes sense. Earlier I was working on the form in the "Design" tab when it notified me about 15 updates. I just updated without reading anything which was probably a bad idea but when I restarted the IDE, it showed my GUI ".class" file and ".form" file separately in the Project Explorer and I couldn't switch between "Source" and "Design". I also noticed that the generated code that was usually not editable was now editable.
P.S. I'm able to create a new frame just fine and the design editor still works with new frame
I have encounter the same problem and I have solved it.
The key in this problem, I think, is particular plugins for JFrame in Netbeans are not active after updating, so we only need to activate them. The easiest way to achieve this is create a new JFrame class, so in this progress, NetBeans can activate all relevant plugins for us. Finally, restart NetBeans, then everything would be fine.
Thank you very much for all of you that you give me some idea and clues in this situation:)
Work on a similar problem led me to this discussion concerning Guarded blocks inside form Java source file. I'm not sure it's related to your situation, but it may help you recover.
If you are trying to recover the lost state of the backing xml for the form I don't know what to tell you.
This has happened to me, but I tend to highly componentize the forms (break up the forms into little pieces), which makes this not such a big deal. Have you tried the NetBeans forums? You might get better luck there:
http://forums.netbeans.org/
Nevermind, simple solution.
I finally decided that, after plenty of tinkering, to restart the IDE which I should have though of first. The Java SE Plugin must have crashed or something, anyway it's fixed.
Thanks for the help!
Or just right click on the corresponding .form file and select open. The Design tab/editor reestablishes.