What does the green dot with yellow star mean in eclipse? - java

I have searched in google but unfortunately couldn't find any answers, so the question is:
What this symbol means in eclipse? (eclipse version : neon.1 for EE developers)
(It is known that the green dot indicates a method but what about the yellow star?)
Update: In this image you can see 8 methods that have the star symbol.

Completion proposals with that icon are contributed by Code Recommenders. That plugin leverages external information to recommend more relevant proposals, as you can also see by the percentage shown beside each entry: it indicates s.t. like the probability that the given proposal is what you need in your context.
You will also find mention of Code Recommenders and how it intergrates with JDT in the preferences under Java > Editor > Content Assist > Advanced.

Doesn't it have a tooltip? Just hover over it and see what it says.
That might be a custom icon that was introduced by a certain Eclipse plugin that you installed. To figure out what plugin it relates to, go to Window -> Customize Perspective. There, under Tool Bar Visibility tab, you will see the tool bar structure. You can expand each section to see the list of functions and the related icons. Your icon should be there somewhere.

Eclipse generally sorts methods alphabetically.
To ease users, top used methods are listed before the alphabetical sorting; think of System.out where println will be on top.
Another case is when a certain return type is expected, say for any arbitrary object:
String str = obj.
toString() will be on the top.
Methods like these are starred.

Related

IntelliJ - View a *single* method in a class full of many methods

Is there a way to just see one method of a class in the IntelliJ IDEA editor and hide everything else, and/or toggle between this and the regular view.
Please note, I'm not looking to fold/collapse other methods, which is certainly a way to minimize getting lost in a large file.
I am looking for a way to only view a specific method I'm working on within a class.
e.g. If there is a legacy code where an existing class has 10 long
methods (each ~50 lines long), and I'm working on one of them and don't wish to be lost in
the 500 lines of code and need to focus on a single method thereby narrowing my view to 50
lines of code.
I do remember a few versions back that this was possible, but am not able to find that setting now.
Further clarifying my question. Consider the method selected in the image below
I am interested in a view that'll show just the method like below (with all the java capabilities like code highlighting, refactoring etc., enabled of course):
In IntelliJ IDEA 2019.3.3 (Community Edition) there's a fold option 'Fold Selection' that hides even the signature.
Select / highlight the code above the method you want to focus on
Right click > Folding > Fold Selection. Shortcut = cmd + .
It might be in earlier versions but I haven't checked.
Fold selection menu option

What is a method with a star icon in eclipse?

I often see a yellow start near the methods, and some percentage in Eclipse Luna's intelligent code completion:
What does this star and the percentage mean?
Both the star and the percentage are added by the Intelligent Code Completion.
These suggestions are based on context and code analysis (data mined) of similar situations. The percentage is presumably an indication for the confidence of that suggestion.
Protected methods (which was the explanation suggested by Ted Hopp) are in fact indicated by a yellow diamond with rounded corners, similar to the icon in the outline view.
From the Eclipse Luna documentation, it appears to mean that it is a protected method.
A number of code completion engines come equipped with Eclipse Mars edition onwards. They are provided by by eclipse.org Code Recommenders.
Normally eclipse orders members alphabetically. However, Code recommender engines will override the alphabetical listing and place commonly used icons near the top. For example println() would be presented near the top with a yellow star after you type System.out. and toString() would appear near the top with a yellow star after typing String obj.
The starred items will be followed by an alphabetical list of members which either could not be identified by the engines or identified as being unlikely to be applicable.
Percentages indicate the likelihood of the suggestion being applicable based upon code from other users who have used your components in their code.
The yellow star indicates that the suggestion has been provided from code recommenders based upon mined data.

How do I change JavaDoc syntax color for Groovy

I have my syntax highlighting set up pretty much exactly how I want it with one basic problem, I can't seem to figure out what is causing the coloring of the JavaDoc comments to be the color they are.
/**
* This is the sort of thing I'm looking to change the color of,
* note the two asterisks to kick it off.
*
* args foo
* return bar
*/
So far I've gone to Preference > Groovy > Editor and looked there, there is no reference to either comments or JavaDoc comments. So I followed a link over to Preferences > Java > Editor. They do have the JavaDoc comments in there, but changing the color there has no effect.
Does anyone know where the correct place is to be changing that color?
Okay this ended up being a little convoluted. The colors are indeed affected by the Java > Editor > Syntax Coloring > Javadoc section. But, owing to the unique way Eclipse preferences are made, those preferences will not affect the Javadocs unless you follow a fairly specific routine.
*note, this routine only applies to a very specific situation: If you load up a syntax coloring by using Color Theme and you don't like how the JavaDoc elements are colored in Groovy, but do like how they show up in Java. It ought to be controlled by Java, but for some reason it's not, and clicking apply on the current Java color scheme doesn't do anything.
Basically, you need to change the color to something else, apply it, then change it back to the original color and apply it. And apparently you have to do it while these elements are on a text page that you can see running in the background (Eclipse syntax colors changes are like sub atomic particles apparently.) This will make it so that the Java syntax coloring is able to over-write whatever the Color Theme tool did to the Groovy preferences...
Anyway, yeah, it's a bit convoluted and is probably a bug. But at least it can be worked around.

Changing the behavior of the Eclipse auto-complete (Content Assist)

When I am programming in Eclipse, the auto-complete \ suggestions box usually opens when typing a dot (for example after typing System. or SomeObject., and stays open while typing a similar code to any of the suggested.
This is what I'm talking about:
I often use the auto-complete \ suggestions box to my advantage, and there are couple of changes I would like to make in order to improve my productivity while programming, if possible;
Is there any way to make the suggestions box visible all the time,
showing suggestions in real-time (and showing a blank box when there
are no available suggestions) ?
Is there any way to add permanent custom suggestions to the suggestions box (e.g. a switch case template or a line of code like public String toString()) ?
Is there any way to re-order the suggestions box (e.g. class private variables before general functions or System.out.println() before System.out.print()) ?
Is there any way to re-design the suggestions box - i.e changing its text color, background color, re-sizing the suggestions box window and removing the yellow java-doc pop-up?
FYI, in Eclipse terminology this feature is called Content Assist.
Is there any way to make the suggestions box visible all the time, showing suggestions in real-time (and showing a blank box when there are no available suggestions) ?
No, that's not possible. You can invoke it any time you want via Ctrl+Space (Command+Space on Mac)
Is there any way to add permanent custom suggestions to the suggestions box (e.g. a switch case template or a line of code like public String toString()) ?
Yes, you can add your own templates via Preferences > Java > Editor > Templates
Is there any way to re-order the suggestions box (e.g. class private variables before general functions or System.out.println() before System.out.print()) ?
Not really. There is some control of the order for "cycling" through proposal types via Preferences > Java > Content Assist > Advanced, but it's not really what you're looking for. The order of proposals is, I think, based on the current context of when Content Assist is invoked.
Is there any way to re-design the suggestions box - i.e changing its text color, background color, re-sizing the suggestions box window and removing the yellow java-doc pop-up?
All of the customization option are available under Preferences > Java > Content Assist; color options are available under Preferences > General > Appearance > Color and Fonts, but I think the colors for that pop-up might come from your operating system color settings.
If you're using (or willing to use) Eclipse Juno (4.2) then there is a new project call Code Recommenders that you might find interesting.
E-Riz already answered all your other questions but for getting content assist in real-time there is a workaround
Under Preferences > Java > Editor > Content Assist there is an option for "Auto activation triggers for Java". By default it's set to ".". You can append to that all the alphabets (ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz) and then it should work.
Is there any way to re-design the suggestions box - i.e changing its text color, background color, re-sizing the suggestions box window and removing the yellow java-doc pop-up?
Just when the auto-suggestion box pops up, if you hover your mouse pointer to its botton-right corner, you'll be able to see mouse pointer turn into resize pointer. Resize it the way you like and next time when it pops up, it will be of the same size. Hope this helps. :-)

Eclipse PDE: Custom QuickFix only available in Problems View?

i am having trouble with custom quick-fixes, which i want to provide in my Eclipse plug-in, and i'm hoping for someone more experienced than me in Eclipse PDE to have some hints for me on this issue.
As i have understood, i can provide custom so-called "quick fixes" (or "resolutions", in Eclipse inside terminology), by extending the extension point org.eclipse.ui.ide.markerResolution for a specific marker id, such as for example some default Eclipse marker, org.eclipse.core.resources.problemmarker.
This works for me for the default marker types and for custom marker types, BUT:
The QuickFixes, which my IMarkerResolutionGenerator provides, are only accessible from the "Problems"-View, not from the Editor, in which my markers show up.
What i have: I create markers in the default text editor, which causes (1) an icon with the markers tooltip message to show up on the left editor ruler at the line, which the marker is assigned to, (2) a marker on the right side of the editor, (3) some underlined characters in the editor, and (4) an entry in the "Problems"-view.
What i want: Just like in Java IDE support, i want to press Strg+1, or Context-Menu->Quick Fix, or to click at the error icon on the left-side-ruler, to see the available quick-fixes and to select one.
However: Only in the Problems-View am i able to get the Quick-Fixes, by pressing Strg+1 or from the context menu.
Is this the normal behaviour, and do i have to access another extension point, or the specific editors features, to hook my quick fixes into them? I haven't found anything much detailed about it, except that everybody seems to be pretty happy with this only extension point that i have mentioned above. What am i missing?
For completion, here is my extension point definition:
<extension point="org.eclipse.ui.ide.markerResolution">
<markerResolutionGenerator
class="com.markers.test.MarkerResolutionGenerator"
markerType="org.eclipse.core.resources.problemmarker">
</markerResolutionGenerator>
</extension>
I have the same problem and I'm not sure, if this is the right way, but at least it works:
If you want to see your quick fixes in the source viewer you have to set an QuickAssistAssistant for it. In your class implementing SourceViewerConfiguration override getQuickAssistAssistant. You can instantiate org.eclipse.jface.text.quickassist.QuickAssistAssistant, but you have to set a QuickAssistProcessor, so implement the org.eclipse.jface.text.quickassist.IQuickAssistProcessor interface, especially computeQuickAssistProposals to return your quick fix proposals.
public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) {
IQuickAssistAssistant quickAssist = new QuickAssistAssistant();
quickAssist.setQuickAssistProcessor(new MyQuickAssistProcessor());
quickAssist.setInformationControlCreator(getInformationControlCreator(sourceViewer));
return quickAssist;
}
Also have a look at the code in the last post here, it is a bit messy, but you will get it. And look at this code here for an example implementation of ICompletionProposal, which you will have to return in your QuickAssistProcessor.
If you simply add one line to the marker extension point:
<super type="org.eclipse.core.resources.textmarker"/>
and add attributes to the marker
marker.setAttribute(IMarker.CHAR_START, ...);
marker.setAttribute(IMarker.CHAR_END, ...);
You will be able get this:
But I still can't found how to change marker icon (to variant with bulb) a show possible quick fix also after click on the annotation icon.

Categories

Resources