Enable context-sensitive help in Eclipse - eclipse

Using Eclipse Mars (4.5) to write a Java application. Say I'm trying to see the documentation for the keyword final. I put the cursor in the middle of "final" in the line final static int RIGHT_PADDING = 12; and hit F1.
In Delphi and Visual Studio a related keyword might be const and the context help displays correctly. In Eclipse, I would expect the relevant Java documentation to be displayed in Eclipse or possibly in a web browser (either is fine). The relevant page might be this Oracle Java documentation page.
Instead I get this Help panel which appears on the right as in the image below. No help on final is displayed. I've tried setting some of the Windows > Preferences > General > Keys binding for help-related commands to F1 but so far without success.
Is this functionality available in Eclipse Mars?
Do I need to use a different key binding other than F1?

The Eclipse Java editor supports context-sensitive help only for names (of classes,
methods, fields, variables), but not for keywords (like final, class, int).
AFAIK the same holds for other language editors (C/C++, JavaScript, Python) in Eclipse.
By the way, distinguish between the following two key-bindings:
Click F1: Context-sensitive help for the active GUI-part (in your example: the Java editor itself)
Click F2: Context-sensitive tooltip for the selected token (for example String,
toString, myVariable)
You probably want F2.

Related

Autocomplete of Groovy in Eclipse Oxygen Changes What I Type

In Eclipse (JEE) Oxygen I have the following plugins installed, other than what comes out of the box with a Java EE distribution of Eclipse:
groovy-eclipse for Oxygen (4.7) - Snapshot version as of November 8, 2017
Spring Tools for Oxygen - version from Marketplace as of November 8, 2017
I am coding in Groovy in .groovy files (created using New -> Groovy Class) and I very frequently get extremely weird and undesired autocomplete behavior.
Example 1
If I type System.out. on a new line, Eclipse autocompletes it to System.out0. (notice the 0). This is a private field of the System class and should definitely not be there.
To get rid of it, I can't just backspace and try the . again, or it'll put it back. I have to Backspace, then hit Esc, then hit . to get it to read System.out..
Example 2
In JUnit, I have in my class the following field:
#Rule
public ExpectedException ex = ExpectedException.none()
When inside a method body on a new line I type ex.expect( I see the autocomplete window pop up, and the first result is a member named anyExceptionExpected. Predictably, when I continue typing anything as an argument to the method, or type ), Eclipse replaces what is a perfectly reasonable method call with: ex.anyExceptionExpected(.
Again, hammering Esc "fixes" the problem, but what bothers me is that I shouldn't have to constantly hammer Esc to keep Eclipse from replacing perfectly valid code with total nonsense just because it's the first asciibetical hit in the list of member names of the object that happens to have the member name I typed as a substring.
Eclipse in Java certainly doesn't have this extremely oppressive behavior. Java autocomplete does not get in your way. You can blow through and type out your statements "raw" (without any autocomplete) when you don't want it, as if you're typing in plain vanilla Notepad, and Eclipse for Java generally won't mess with your code too much (except for sometimes making life harder by automatically adding closing parentheses or quotation marks when they are not wanted, but that's minor, since sometimes it's beneficial).
So why won't Eclipse for Groovy do the same? Is there a setting somewhere in the sprawling Preferences pane of Eclipse where I can tweak this behavior for Groovy code?
Basically I want Eclipse Groovy's autocompletion feature to work just like the default Eclipse Java autocomplete (meaning, the behavior you get with a default Eclipse install, a clean Eclipse workspace and without making any preference changes). How can I do this?
If you disable a couple of code assist options, proposals and completions will only occur when you explicitly request them.
Window > Preferences > Java > Editor > Content Assist :
uncheck "Enable auto activation"
uncheck "Insert single proposals automatically"

Groovy-Grails Tool Suite (GGTS) content assist not recognizing basic groovy

I have installed GGTS, on ubuntu and am trying to edit .Groovy files with the built in editor.
The autocomplete is extremely annoying because while it will recognize my domain objects i.e. my User class etc.. It doesn't recognize basic groovy, for instance I start typing "def" to define a variable then hit space and it will autocomplete to "Default", similarly if I try to type in "return" it autocompletes to "RETURN" while I am typing as soon as I hit space, which is very annoying.
Like i said it will recognize classes, so if I type def u = new User(), the User part will complete ok, but the problem is that the variable u I defined earlier isn't recgonized later in the code.
I hope you guys get my meaning... No idea how to fix it, short of not using the groovy editor and treating it as plain text. I even tried disabling content assist, but that didn't seem to work for some reason
I was having this problem in GGTS 3.4.0.RELEASE today, and getting very angry with the situation.
Somehow my workspace had the "Auto activation triggers for Java" set to "_.abcd....z" (all the lowercase letters)
Window -> Preferences
Java -> Editor -> Content Assist
"Auto activation triggers for Java" set to just "."
This seems to have helped dramatically.
I'm still not sure what caused my workspace to have this setting.
Make sure that you're in the Grails perspective; that can impact some of the Groovy/Grails features and how Eclipse (even GGTS) leverages them. You'll find the perspective button in the upper right. If you're in Java or Debug, odd things like this may occur.
Also, how are you creating and opening your Groovy files? Do you use the context menus or the Grails command prompt tool to issue orders like "create-controller"? If you're creating the files in some other way, try using those methods to generate them, and see if you get the same results.

eclipse's plugin or vim's plugin similar like ctrl+p and type # to find function/method list in sublime

eclipse is good at autocompletion when static typing , when is dynamic typing ,eclipse failed to autocompletion ; in sublime ctrl+p ,type # and type 'method name'to find function/method list , It is a wonderful way to find the right method while coding dynamic typing language ;
the key point is :
the operation in sublime text 2 is very convenient ,all key type is in one input box ; never need to chage active file tab; we can focus on the active code file tab ;
is there any plugin in eclipse or vim which can search method of any file conveniently ?
In ST2, this feature is used to quickly jump to a method anywhere in your project.
In Eclipse, Control+Shift+R can be used to jump quickly to a "resource" (file) and Control+Shift+T is for jumping to a type (not method). Control+o opens a very useful and quick outline of the current file. It doesn't work project-wide.
I'm not aware of something that works exactly like ST2's feature. Did you search the marketplace?
In Vim, FuzzyFinder, Command-T and CtrlP all allow you to navigate through your project using fuzzy matching. They can be setup to use your tags file. AFAIK, there's no plugin that provides exactly what ST2 provides.
From your question I'm not sure you use it as intended: it sounds like you use it to show a list of methods in some file in your project in order to use the right method in your code. This sounds a lot like you'd benefit from autocompletion to me.
Being an IDE, Eclipse shines on that front: its "code assist" window will show you where the suggestion is defined as well as its type.
Vim's "omnicompletion" is quite limited compared to an IDE but, depending on your language and using some third party scripts, it can be made quite powerful.

How can do code alignment in Eclipse base Force.com IDE

How can do code alignment with Eclipse base Force.com IDE.
Alignment shortcut key 'CTRL+SHIFT+F' is not working for Apex code.
None of the suggestions so far work for me. Note that the Force IDE opens the Apex class in an Apex Editor. This editor does not appear in the list of contexts that you can associate with a key event. For example, this list contains such contexts as "editing in structured text", "editing in Java Source", etc.
The Apex Editor does not contribute a "Source" menu option to the right click menu. So there is no way to get to the formatting features.
I tried to open the apex class in the Java. Now the "Source" menu option appears the format option doesn't do anything. (Hence no key event will be able to do anything.)
The only thing I can get to work is this ...
Select file.... Open With... Other ... locate Java Editor.
Once file is open ... select all text .. right click and select Source ... Correct Indentation .
This does not reformat but it does fix the indentation problem.
Someday I hope SFDC will make the code for the Force IDE open source. Then we, as a community, could build more developer-friendly tools.
Apex classes and triggers use a different editor than Java. The auto formatter (or code alignment) does not work with Apex Code (or the Apex Code Editor). I couldn't get CTRL-SHIFT+F to work in the most recent version of Eclipse with the Force.com IDE, either. I believe this is because the auto formatter is designed to work with Java only.
However, if you switch to the Java perspective and open your Apex class with the Java Editor, CTRL+I does correct indentation properly.
Go to Preferences -> General -> Keys and type "format" into the search box, you will see what keys (if any) are bound to the format commands. Then you can bind what you like or use what's available.

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]