How can I get block comment hotkey functionality when editing *.ftl files in Eclipse? - eclipse

Trying to edit Freemarker Templates in Eclipse, and going nuts because I have some inline Javascript that I'm creating on the fly, and can't easily comment / uncomment multiple lines at a time.
I've tried the following:
expanding the scope of the "toggle comment" behavior (to things like "Editing Text", or "In Windows") - has no effect
installing the official Freemarker eclipse plugin (both 1.0 and 1.1) - has absolutely no effect that I can see, other than appearing under "Preferences ... File Associations"
associating the .ftl extension with other types of editors - HTML, JavaScript, 3rd party - all these have absolutely no effect that I can see
Is there a way I can tell if Eclipse is even honoring my file associations? How do I know, for sure, which Editor is being used? I know when a Java file is being edited, I see additional pulldown menus (Source, etc.) - is there any other diagnostic way to figure out what's going on?
Any help is appreciated.

I know this isn't what you want to hear, but the Freemarker support in IntelliJ IDEA is really great.
Unfortunately, it isn't part of the free Community Edition, so you have to get the Ultimate Edition to benefit from it. But you can try it out for 30 days for free.
No, I am in no way associated with JetBrains, just a happy user.

Related

Eclipse 4.12 comment out multiple lines in .gradle file with hotkey

Just installed a new version of Eclipse ("Eclipse IDE for Enterprise Java Developers", 2019-06 / 4.12.0) and I find that although the hotkeys Ctrl-Shift-C and Ctrl-/ work to toggle comments for blocks of code in .java files, as expected, this doesn't seem to work for my .gradle files for some unaccountable reason.
OS is Linux Mint 18.3.
Anyone know how one goes about tweaking this sort of functionality in Eclipse (i.e. so that this toggling also works in .gradle files)?
NB I also find that going Ctrl-Shift-L twice does NOT open up (as previously) the "preference page" (i.e. where you can edit key bindings). I hope they haven't messed up things here.
However you can still edit these bindings by going Windows --> Preferences --> General --> Keys. This shows no fewer than 20 (!) "Toggle Comment" bindings, with Ctrl+7, Shift+Ctrl+C and Ctrl+/. The "When" column includes things like "Editing Java Source" but also "Editing in Structured Text Editors", etc..
So I tried to add my own key binding with "When" at "Editing Text". No joy. Anyone at all familiar with this aspect of Eclipse functionality?
greg-449 has the right answer.
Therefore what you have to do is install the correct Groovy editor.
I in fact gave the answer about how to do this here in early 2018.
It has changed ever so slightly now (for Eclipse "2019-06"/4.12), as described in my update there.
When you install that Eclipse-Groovy editor it automatically applies the various normal editing functionality not only to .groovy files but also (out of the box) to .gradle files: syntax highlighting, toggling of comments, etc.
I did not think this worked and was about to uninstall it, then I tried selecting Open with > Groovy editor, Thought I would share a little more detail, thanks!

add method/functions list like visualstudios on netbeans 7 editor toolbars?

is there any way, to enable a dropdown list of methods or functions, on the Editor Toolbars of NetBeans 7, like VS does? , i mean the toolbar that is inside on the tab of each file when you are editing a code, that has some options like, "last edit, next breakpoint, next bookmark, ..."
In VS is really helpful this feature, to jump of functions o methods more quickly, i know that netbeans has the navigator, but sometimes this help more
Greatings
is there any way, to enable a dropdown list of methods or functions,
on the Editor Toolbars of NetBeans 7, like VS does?
There is no way provided by standard NetBeans IDE offering or certified plugins available in NetBeans Update center, but a NetBeans plugin can be written for doing what is expected in your question. Has it been done? In my opinion no, as no one asked till now. Now that you have asked someone may think of developing such a plugin.
Best way to expedite such request and feature to be added to NetBeans is to add a Request for Enhancement in the NetBeans issue tracker.
In VS is really helpful this feature, to jump of functions o methods
more quickly, i know that netbeans has the navigator, but sometimes
this help more
There are many ways to reach specific methods in NetBeans IDE. You have already listed one and that is Navigator. Others include GoTo Type [CTRL+O] and GoTo Symbol [CTRL+ALT+SHIFT+O]

Macro functionality with keyboard shortcuts in Eclipse?

Having used Netbeans for ages and being new to Eclipse I couldn't see any built-in Macro functionality in Eclipse. I found the Practically Macro plug-in but this does not seem to have the capability to add keyboard shorcuts. One needs to go through two menus and therefore two mouse clicks to run a macro using the aforementioned plugin.
This does not serve well for my need of frequent macro applications. Is there anyway to have very simple Macros using keyboard shortcuts in Eclipse? Or should I start writing my own Eclipse plugin for this? Or perhaps use another light weight tool for this purpose? Do you have any suggestions?
There doesn't seem to be anything else than Practically Macro for Eclipse. Once you use a Macro, you can press Ctrl-Alt-P to replay that. This helps a bit, but when you want to switch between a couple of macros back and forth doesn't help much.
Not sure about this Macro plug-in you're using, but you can modify keyboard shortcuts (Helios) in Preferences->General->Keys.
Testing PracticallyMacro I found that it did not record right clicks but I was able to find a perfect utility 'TinyTask' and 'TyperTask'. The former can export record and save as small 'exe' files which can then be added as external Eclipse builders the latter can automate tasks based on typed characters - epic.

Eclipse - Save Folding on Quit

Is there any way to save my code folding in eclipse?
It's horrible to scroll trough my entire UI declaration. (And yes, I googled it! :)
The question is very similar to Is there a way to collapse all code blocks in Eclipse? .
I'm re-posting my answer there here.
The question is a bit old, but let me add a different approach. In addition to the above hot-key and utility approaches, there are default preference settings that can be toggled.
As of Eclipse Galileo (and definitely in my Eclipse Version: Indigo Service Release 2 Build id: 20120216-1857) language specific preferences can open up new files to edit which are already collapsed or expanded.
Here is a link to Eclipse Galileo online docs showing the feature for C/C++: http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.cdt.doc.user/reference/cdt_u_c_editor_folding.htm .
In my Eclipse Indigo I can open the Folding Preferences window via : menu/ Window/ Preferences/ Java/ Editor/ Folding and set all options on so I can open files by default that are completely collapsed.
Amongst other things, Mylyn allows you to fold/hide content and persist the state.
Mylyn monitors your work activity to identify relevant information, and uses this task context to focus the user interface on the task-at-hand. This puts the information you need at your fingertips and improves productivity by reducing searching, scrolling, and navigation. By making task context explicit Mylyn also facilitates multitasking, planning, reusing past efforts, and sharing expertise.
Once Mylyn is enabled it will start folding/hiding the content. If you have an active task (can use a local task repository) the state should be persisted between sessions. Alternatively you can attach the state to the task (sorry don't have Eclipse to hand to check the exact method to do this) then retrieve it. This is useful if you are sharing tasks with others.
I know this isn't exactly what you were asking, but this was really helpful for me:
Ctrl+Numpad_Multiply can also be used
to expand all
Ctrl+Shift+Numpad_Divide is bound to
collapse all
Ctrl+Numpad_Divide toggles folding on
and off
(Taken from this post: Is there a keyboard shortcut in Eclipse to fold the current method/block? )
This, and plenty other issues of Eclipse made me switch to JetBrains IntelliJ IDEA. It's worth sneaking a peek at it if you find Eclipse's performance annoying, need more control on your code formatting or if you just want to have your code foldings persisted.
I'm not using it for too long now but it seems pretty handy for anyone developing in the Java, Android or Scala corner.

Painless integration of Eclipse with Vim?

Has anyone managed to get Vim integrated into Eclipse painlessly? I just want to use Vim for the editor while retaining the general Eclipse interface. I have tried using Eclim plugin but the editor seemed to crash more often than work (the site said that the editor replacement functionality is still beta).
On the flip side, is there any IDE which matches Eclipse's functionality—mainly the integration with SVN, ant, etc.—and is also able to use Vim?
I mostly use eclipse for SAS SCL, Java and Javascript programming and find the eclipse editor too "mouse-y".
I'd also like, in a perfect world, to use vimdiff as a diff viewer for SVN (we use TortoiseSVN) while checking for diffs or conflicts during merge etc. I admit I havent spent a lot of time trying to get these things to work. I feel guilty about spending too much time on potential wild-goose-chases while my other team members are working away at their code, perfectly content with all that Eclipse has to offer.
Edit: Just found this while desperately browsing around: Vim plugin. Any experience using this? From the claims on the site, it sounds perfect.
I've been using Vrapper for about 2 months and it works great. It is simple to install, and makes life much easier.
It doesn't integrate Vim with Eclipse, it just emulates Vim's behaviour so you don't need to have Vim installed.
EDIT:
I have been experiencing errors while refactoring methods in Eclipse (only when Vrapper was installed) so I stopped using it.
Now I'm using ViPlugin (very similar to vrapper). It works great (especially since version 2.0) and I recommend it, but it is not free (but cheap and has a trial version)
Edit
As the new post mentioned, if we always use the rename dialog to rename, it can be a work around for Varpper.
Preferences > Java > and uncheck "Rename in editor without dialog"
http://sourceforge.net/apps/trac/vrapper/ticket/96
The consensus seems summarized in that Wanted: VIM in Eclipse article.
No decent Vi plugin exists for eclipse, except viplugin which does not offer macro mechanisms.
Whereas on the NetBeans side... jvi does a killing job ;)
WOW, this is the one!
http://vrapper.sourceforge.net/home/
It just came out a few months ago, and seems much better than the other alternatives...and it is open source.
I use Viable, which is a new plugin for Eclipse providing Vi emulation. It is very similar to vrapper, but it doesn't have the same problem as vrapper with refactoring (as cysiek10 described.)
It's got some pretty cool features which none of the other Vim emulators in Eclipse seem to have (though jvi for NetBeans has a few of these) such as:
Visual block mode
External filters and commands
Command history
Window splits (love having this one!)
It is pay; however, you can try the full version for free just like viPlugin.
I never had much luck with vim integration into any IDE, be it Eclipse, Visual Studio, NetBeans, or sth else. Instead when stuck using an IDE, I just make the IDE launch a custom program: which passes the file onto vim using the client/server feature.
I.e. vim --servername SomeName --remote-{choice of how to open it: splits or tabs} {extra args like filename and +line#}
I just tried Eclim http://eclim.org/ and found it really good. I can still edit inside Vim, and enjoy most of the benefits of the eclipse IDE inside Vim (such as better omni completions).
The best thing about Eclim is we are still using the original Vim, so I can enjoy all the existing benefits (my own functions, macros, etc.) while having the extra convenience provided by an IDE.
http://vimplugin.org, which I found over the weekend was the closest I could come to a nice integration. Unfortunately when I opened more than 2 files in my IDE, it made my entire workstation unresponsive. And I didn't even use the "new process" option for the editor.
So bottom line it does seem that there is no decent integration available yet. Although with some it's close. I'm rooting for vimplugin to stabilize and I'll also some time (when I'm not eating up my employer's time like now) play some more with hte plugin to see if I can make it usable.
I tried Eclim and didn't like it at all. I ended using this plugin called "viPlugin," which actually works well enough to warrant using it every day. Here is the site for viPlugin:
http://www.viplugin.com
The big downside of this plugin is that it's not free. I paid for it, and I think it's worth it.
...is there any IDE which matches Eclipse's functionality -- mainly the integration with SVN, ant, etc. -- and is also able to use Vim?
IntelliJ IDEA has a very good VI plugin, but I didn't like it, although the plugin did it's work.
My problem was I have formed habits to use IDEA and those were harder and my experiment didn't it through. So I uninstall the plugin, and learned idea shortcuts instead.
But, is not free :(
Vrapper does the trick.
After installing Vrapper you need to remove CTRL+W key binding in Eclipse settings. Or else it keeps closing the editor when you actually meant Backspace.
It also comes with "surround" and split window plugins. Be sure to install those.
This is not 100% Vim, though. And nothing is 100% Vim except for Vim (doh!). You will find some commands missing (or you may not, depending on how "vimy" you are). But vrapper has :vim command, which opens up Vim editor with the current file in the buffer and places your cursor in the exact location in the file. This way you can continue editing from where you left off. When you're done in Vim just close the editor, and you return to your eclipse editor.
I hope this was helpful.