Highlight negation operator in an IDE - java

I prefer Eclipse, but I'd love to know if there is any IDE anywhere that can detect, and offers syntax highlighting for, the negation operator (!). It's a critical thing, but it's often lost between long method names and an open parenthesis.

Well, from the Preferences->Java->Editor->Syntax Coloring dialog, you can change the font and colors for operators which include ! to be whatever color, bold, italic, strikethrough, underline you want. I'm not sure if you can just do ! though.

Thanks to #Techrocket9's comments in #dkatzel's answer, I eventually found my way to wiki articles on how to create an editor and providing coloring for custom syntax rules. These two articles have enough related information that I can begin trying my hand at creating a plugin. If anyone has experience in this, feel free to add to this community wiki answer. Otherwise, I'll update this when I have something.

Related

Changing the priority of markers in eclipse

When I set a break point on a row which already has a marker(The value of the local variable is not used) on it, I cannot see the break point marker; because the yellow lamp marker covers the break point marker.
Is it possible to change the priority of the markers so that the break point sits on top of the lamp marker?
As long as #Mena answer is ok, as he sais...
Use at your own risk :)
This can be dangerous in a big project.
To avoid problems with hided warnings due configurations, what I usually do is:
Leave config as is, to see warnings.
Remove all really unnecessary lines causing warnings
Add an annotation to method still having warnings but needing breakpoint at same line. You can annotate class if necessary when massive warnings or breakpoints needed.
#SuppressWarning("unused")
public void yourMethod() {
}
This will allow you to handle warnings individually and see breakpoints when necessary.
I find that incredibly annoying too.
The only solution I've found is to go to the Java editor preferences, and disable the checkbox "Report problems as you type".
This will not change the priority, it will disable the hint and only show the breakpoint.
Here's a picture to illustrate:
Use at your own risk :)
Finally a TRUE relief after years of a so annoying and tiny thing:
1) go to your eclipse install path and look for all files (filename) that contain the word "warn" and are of the format .gif or .png (because they contain transparency data), here there were 5 files whose icon/image matched, most were named as: quickfix_warning_obj.gif (or.png)
2) rename all of them to *.DISABLED like "quickfix_warning_obj.gif.DISABLED", and as soon you restart eclipse, this will force it to restore the right one as soon you open an editor that uses it and has some warning on it.
3) having detected the right file, replace it with one of identical size (width and height in pixels), I would like to suggest this image I just created, so simple and not annoying at all and still is useful!
4) restart eclipse again and clap with a smiling face!
PS.: you can try to just replace this file also, that was the right one here for Eclipse Luna:
$ECLIPSE_INSTALL_PATH/configuration/org.eclipse.osgi/478/0/.cp/icons/full/obj16/quickfix_warning_obj.gif
Obs.:
Of course you can replace all of them that look the same, change other annoying icons and so on, and experiment with your own gif/png size and image, just that these steps is what worked perfectly here.
The image I supplied is almost invisible some times, but they were never really useful to me as I let the code with warning become underlined as a highlight. A better image is welcome :)
And, of course, this is a workaround, like a theme change, that does not involve any coding/recompiling of eclipse, therefore the priority is not changed at all, but the results are good enough to me at least.
EDIT: here one for the search results: searchm_obj.gif at configuration/org.eclipse.osgi/331/0/.cp/icons/full/obj16/searchm_obj.gif on Luna

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.

Syntax highlight in java for android

I want to build an notepad-style application on android that will have syntax highlighting. But when I search around the web, I find the syntax highlighting can be done only through use of an awt class. How could I syntax highlight in maybe a custom EditText or TextView view? I know that the release of a syntax highlighter is sort of anticipated, so I want to add my syntax highlighter on the market.
Take a look at the android.text namespace. Specifically, you'll want either an Editable or a Spannable as your text format instead of strings. The android.text.style namespace has the various kinds of markup you can apply to spans of text.
If someone know Russian, you can read my article about this topic here. Anyway there picture and code snippets that can give you a direction. If you want to check out result, it can be found here

Is there a way to hide annotations in Netbeans or Eclipse?

Maybe a dumb question, but it would be nice if there was a way to hide or collapse Java annotations when viewing source in Netbeans (or Eclipse). I'm not finding an option and a quick search didn't turn anything up.
Is this one of those "you should never want to do that, code folding is a sin!" things?
Personally I'd find it useful for annotated entity classes. All the hibernate / etc annotations are just fluff that I never look at once my mapping is working fine. It's similar to imports, really.
(Yes, I can use XML instead of annotations, which I might start doing. But I was just wondering...)
Here's a good solution to how to "hide" #Annotations.
Make the color of the #Annotations a lighter color than the rest, such as light green.
How to:
Preferences: Java> Editor> Syntax Coloring
in the Element box, select Annotations.
Click Color button.
annotations: lighter green. I use RGB: 0, 240, 0
annotation element references: light green: RGB: 0, 170, 80
This way, the Annotations are visible, but they are much less distracting when you're trying to read and edit the functional code.
If you really want to be unaware of your #Annotations, you could make them the same or very close to the background color, such as white. Then only the =values will show.
Pero blanco? no es muy inteligente.
Juan Reza-Prieur
Having only used Eclipse or IDEA, I'm unaware of any IDE options to hide annotations, and in my opinion it's a good thing.
Your annotations affect the way your code compiles and often, how it runs. In my opinion hiding them is tantamount to hiding public/protected/private keywords in method signatures, or any other component of the language. Their exclusion changes the meaning of their surrounding context and therefore, a developer's expectations.

Categories

Resources