Eclipse Indigo "Save Actions" are not being applied - eclipse

I'm new to Eclipse and downloaded the following version:
Eclipse Java EE IDE for Web Developers.
Version: Indigo Release
Build id: 20110615-0604
[edit] Eclipse Platform Version 3.7
I have edited Java > Editor > Save Actions to do the following: Remove trailing white spaces on all lines, Correct indentation
When I save the .java file, those actions are not applied... is this a bug?
Found this that might be related: https://bugs.eclipse.org/bugs/show_bug.cgi?id=350475

Assuming that this relates to JavaScript files, then the related Eclipse bug could be helpful.
The problem (as I've just experienced) is that you can edit the JavaScript -> Save Actions preferences via the context menu when editing a JavaScript file, but the actions will not be run.
The solution is to right click on the project containing the .js file, and select Configure -> Convert to JavaScript project.
The bad news is that this will then will also enable Eclipse's not-so-great JavaScript validation, therefore telling you that libraries such as moment.min.js are broken.

Well for those of you who have found this topic... I did find 2 solutions, no thanks to Eclipse, other than the fact that it is open source and people can write plugins.
Eclipse Platform Version 3.7
AnyEdit - plugin that does it for you when you Save file (I believe this is what eclipse SHOULD be doing)
Go to: Window > Preferences. Then under General > Keys. Make sure drop down for Scheme: is Default and enter 'remove trailing' in the filter. You should then see "Remove Trailing Whitespace" under the command column. Bind it to your own key command.
The only drawback to #2 is that you have to actually press the key binding while editing the file, kindof like a cleanup action.
Too bad Eclipse hasn't taken the approach that ALL file types should be configurable in this way... sometimes I miss TextPad.

Old question, but at least for newer Eclipse versions there's a better solution: Go to the project properties, then to Project Facets. If it tells you that your project isn't in faceted form yet, then convert it. Afterwards (or if it already was faceted), just enable the JavaScript checkbox.
I had the same issue with Eclipse 4.4 (Luna) and this fixed it for me, the save actions are now executed on save.

Adding to jlh's answer, I also had to configure the JavaScript include path of the project to enable save actions. Before that even a manual "Clean Up ..." from the source menu wouldn't work.

Related

Eclipse jsp automatic validation

In my old Eclipse (version 3.4.2) if I wrote an error in a java fragment inside a .jsp page (example a variable that doesn't exist) I automatically and immediately saw the problem (red line under
the word).
In Eclipse neon I have to manually validate the page (right click, validate) to obtain the same result.
Is it possible to configure the new version with the old feature?
You can try to go to Window > Preferences > Java > Compiler > Errors/Warnings
and set up your things here.
This feature is also included in Eclipse Neon, don't worry ;) but if you really struggle hard, I suggest an uninstall/reinstall

How to enable collapse/expand code blocks feature in eclipse

I'm using the following version of eclipse on windows 7 desktop. On my ColdFusion files opened in eclipse I don't see +/- symbols for collapsing/expanding blocks of code. On the tool bar I can't find any option for enabling this feature. I don't see an option for Java-->Editor... either. In Preferences section I see only the options shown in the attached image:
Eclipse IDE for Java Developers
Version: Mars Release (4.5.0)
Build id: 20150621-1200
UPDATE Using the help from #E-Riz I found the folding option in Preferences and enabled all the options there as shown in the updated image below. But still I'm not seeing +/- symbols in the code editor to collapse/expand the code blocks. I've tried closing and reopening eclipse, as well.
As you can see there are no +/- sings in the file below although the editor used is CFEclipse:
The feature is called folding. If you enter "folding" (without the quotes) in the Preferences search field, you'll find the places where it's configured.
I don't know if you have a plug-in specifically for editing ColdFusion files; if you do, it may or may not support folding. For example, CFEclipse has folding support, so if you open your files in that editor, you should see it.

How to recover java folder in NetBeans 8.0>Tools>Templates

I accidentally deleted the java folder in Tools -> Templates in NetBeans 8.0. Now it does not show me the option to make a Java class. I reinstalled netbeans, but it did not help.
Could you please help me to recover it?
Close NetBeans IDE, go to NetBeans userdir, then to config/templates directory and delete Classes_hidden file.
When NetBeans IDE is started again templates for Java are back.
An easy to recover your Java template is to go to Tools->Templates and delete another template at random (say the HTML one) then click the Revert to Default button at the right and your HTML and Java templates will be recovered.
P.S. I'm guessing you were trying to remove that author: thing in the template, so a good way to do that is by going to Tools->Templates->Java->Java class->Open in Editor and you can modify freely your template.

Is there an IntelliJ Keymapping plugin for Eclipse?

I am an old IntelliJ user, now working on a project that requires Eclipse.
I don't mind learning the Eclipse default keyboard shortcuts where they exist, but so many operations don't have shortcuts assigned (grrrr!)
I was wondering if there is any plugin that would automatically assign the IntelliJ defaults to any action that does not already have a mapping?
As an alternative I guess I could also use a plugin that just wipes out all of the Eclipse defaults and replaces them with the IntelliJ versions.
Or do I have to just go and manually replace them all one by one :( ?
The IdeaKeyScheme plugin was just developed by one guy that wanted the same thing. Source and binary are available. I haven't tried it myself, but many people use it with great success. It seems to be the only thing out there.
If you're concerned about keyboard mappings, the Key Promoter plugin for Eclipse (known as MouseFeed) will be a big help, too. There's also an IntelliJ version. I highly recommend this plugin for productivity enhancement.
Installation and enabling IdeaKeyScheme plugin
For Eclipse: add jar file to eclipse/dropins/plugins folder.
Restart Eclipse.
Open Window → Preferences → General → Keys and select the scheme "Intellij Idea".
I wanted the same thing since I predominantly use IntelliJ IDEA. Found this on the eclipse market place and up to now it has the same keymappings.
Activate it by going to :
Window >> Preferences >> General >> Keys : change the scheme to : IntelliJ IDEA
https://marketplace.eclipse.org/content/intellij-idea-keymap-eclipse
You may add a key map as described here:
http://www.jroller.com/santhosh/entry/intellij_idea_key_scheme_for
The plugin itself is:
http://jroller.com/santhosh/resource/IdeaKeyScheme.jar
You need just to put the jar file into eclipse/plugins and restart IDE. It works on Luna just fine!
Open your eclipse software
Drag and drop Installer button from
https://marketplace.eclipse.org/content/intellij-idea-keymap-eclipse
in your always open eclipse
and that's all
It turns out that in IntelliJ, by default you can choose a keymap scheme. So you can just apply the Eclipse Shortcuts without any plugin.
Just press CTRl + `
Details here
http://zeroturnaround.com/rebellabs/getting-started-with-intellij-idea-as-an-eclipse-user/4/

Can NetBeans auto-build java free-form (Ant) projects?

After every save I need to right-click on the project in the project browser and click on build.
Is there a way to configure NetBeans to auto-build the project when I save a file?
See Compile on Save FAQ: http://wiki.netbeans.org/FaqCompileOnSave
I don't use CoS myself, I highly recommend Jenkins for your auto-build needs (and so much more): http://jenkins-ci.org/
The compile on save option is not available for free-form projects as of NetBeans version 8.0. And I don't think it will be made available in future too. The very idea of free-form is that that IDE does not know anything about your project and completely relies on the ant-scripts and the mappings you provide.
If you don't want to build an entire project every time you make changes to a file, create a target in ant to compile a single file and map it to the IDE command compile.single. You could add a context menu for that if required, although the existing keyboard shortcut F9 should suffice.
You can read more on the advance free-form configuration here - Advanced Free-Form Project Configuration