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

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. :-)

Related

Java Syntax Highlighting Issue for IntelliJ Ultimate

When I run the files in IntelliJ Idea Ultimate, I can getting improper syntax highlighting of only orange, green, and gray. Is there any way to get more colors for syntax highlighing for methods and variables like VSCode does? Thank you for your help!
This is my theme with One Dark Theme below
I want the theme to be like:
Theme
I would suggest using Atom One Dark as a theme. It's really colorful, so it makes easier to focus on (at least for me). You should give it a try.
Reformatting
There is a setting about reformatting. You should try it. You can access it with CTRL+SHIFT+ALT+L.
You can customize the syntax coloring of an existing Scheme within Intellij IDEA:
Press ctrl-alt-S to open the Settings screen, then select the scheme you want to modify from the Scheme drop list. I chose Classic Light.
Navigate to Editor > Color Scheme > Language Defaults, or Editor > Color Scheme > Java if you want to restrict your customization to Java source only.
Select the language feature for which you want to modify the color(s) under the main categories (i.e. Classes, Comments, Identifiers, etc.). For example, to modify the color for curly braces select Braces and Operators, then Parentheses.
If the Inherit values from checkbox is displayed and checked, uncheck it to enable customization. Then check the foreground checkbox, click the color field to its right and select a color of your choice, then click Apply, OK to implement your change.
See below for the syntax coloring of some Java source, before and after color customization, showing changes such as dark pink italicized string literals, light blue curly braces, purple round brackets, orange class names, gold Java keywords and light green comments.
Default coloring:
Syntax coloring after modification:
Notes:
The ugly changes I made were just for demonstrating the approach, but the required changes shown in the question's screen shot should be straightforward to achieve.
Selecting italicization for string literals had an unintended side effect. The display of the character 'áš™' was changed because there was no italic equivalent to render.
If you mess things up completely, you can easily revert to the defaults. Click the settings cog wheel next to your Scheme name and select Restore Defaults from the popup menu:
A disappointing limitation with this approach is that all Java keywords must be the same color. That's why import and package and public and throws and char and new all have the same color in the Java source screen shot above.
You can export your customization if you want to preserve or share it. Select Export from the context menu shown when you click the settings cog wheel. There is also an Import Scheme option.
See Colors and Fonts in the Intellij IDEA documentation for more information.

(Translation) I want to keep overrides without dev tools

I want to change the title bar color of the Google Create shortcut window.
The left is the basic state, and the right is the appearance of adding functions through elements.
From How to change Chrome App Caption Bar color in Windows 10
I changed the title color by referring to the link above. Answer at the bottom.
I want to keep this state from when I turn it on, but it doesn't work without dev tools.
I wanted to keep this state, so I looked for a way, but this was the only hopeful comment.
How can I use 'Custom JavaScript for Websites 2' to keep title bar color without dev tools?
You should use an extension like this or this and inject CSS like:
body {
background-color: #131722;
}
If you want to change the top bar in the image you posted, that's Google Chrome. Try Dark Mode.
The problem has been resolved.
You can use this extension.
https://chrome.google.com/webstore/detail/permanent-inspect-element/alfgclaljdbleenfjjnkefddlgbknl
After editing the element, you can save it.
But the downside is that the site is too slow. The evaluation is also complex. I think it will be a good tool for some. For me, this tool is too inconvenient. I'm looking for a better way.

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.

text color coding in Netbeans

I have a pretty annoying issue with text highlighting on my EL statements.
I have scrolled through every field in the Options/Fonts&Colors/Syntax Control Panel three times, paying extra attention to the Expression Language options and I can not find the parameter that controls the white background of the whole ${initParam.productImagePath} expression statement.
Try looking under Fonts&Color -> Syntax. Then select the language and check all the color settings there.
UPDATE
I would add that sometimes the settings are inherited... it can be really hard to find which setting controls the color.
You can save the color settings exporting ("Export" button) then change every setting under "Expression Language" just to see if it changes.
Also, you can look through all colors in all languages and tabs until you find the color that matches the one you are seeing in the editor.
I'm guessing you may have done all this already, but I want to be sure I give the most complete answer I know of just in case.
Did you also check the entries in the Fonts&Colors Highlighting-Tab?
Your image shows that the white expression is not in the current selected line, so my guess is that you have enabled "highlight Search" (small Editor Toolbar). Another guess: if you are using the jVi Plugin, there's another highlight search parameter in jVi's settings dialog.

TextBox inside eclipse's draw2d figure

Is there any way to include a Text Box inside a draw2d figure? (a code example would be nice)
Not easily, and if you're just using Draw2d without GEF, then I don't think it's possible.
With GEF, you can make use of a DirectEditManager in an Edit Part, and create an Edit Policy (extending DirectEditPolicy, installed with the key EditPolicy.DIRECT_EDIT_ROLE) to allow a direct edit to be performed on a figure.
You could create a figure which extends Label that is styled to look like a text box, and activate (by overriding performRequest in the Edit Part) editing upon selection.
This Schema Diagram example contains this type of functionality (and more importantly, the code!), although the figure used for edit (EditableLabel) isn't styled to look like a text box, and the activation itself is on double-click rather than selection.
It may point you in the right direction though.

Categories

Resources