How to make my own warnings appear in the Eclipse Problems view? - java

I am developing a CDT plug-in for Eclipse IDE. I want my own warning to appear in the Problems view.
Furthermore, my warning message is very important and must be seen by user, but Problems view may be even not shown, so I show a message box.
How can I add my warning to the Problems view and what is the preferred way to deal with warnings that must be seen in Eclipse IDE?

preferred way to deal with warnings that must be seen in Eclipse IDE?
Make them errors instead of warnings.
Then, when the next state in the workflow needs the output of the problematic code, that is when it is appropriate to do a pop-up. When you are coding and making changes, it is perfectly normal to have "temporary" errors/warning in your code. Pop-ups at that time would be very inconvenient. But when I proceed to launch my code or similar then I want to be warned off.
Consider the case of doing a Java launch. If there are errors in the code there is a pop-up like this:

Related

How do blind users interact with error indicators in Eclipse?

I am currently helping a blind person to learn Java using Eclipse as their IDE. However, when there are errors, e.g. a typo, the red underlines indicating an error are not useful/apparent.
How can blind users be made aware of errors or other visual indicators within Eclipse?
In eclipse you can use Ctrl+. and Ctrl+, to navigate forwards and backwards through underlined sections.
When the cursor is in an underlined section, the error is shown in the status bar which your screen reader may be able to read (with JAWS use Insert+PgDn or CapsLock+PgDn).
There are some more tips for Eclipse's accessibility features in the Eclipse Help pages.
Jaws normally says "invalid" before each invalid part of code in the code editor as you navigate with arrow keys.
You have nothing specific to configure for this. At least for me, it worked out of the box from day 1.
IN case of doubt or if it doesn't work out of the box, you can customize the way Jaws behaves by going to the setting center.
More specifically, in the speech and sound scheme, you might pick a modern scheme different than classic, or want to customize the way the "invalid" font style is announced.
You will also certainly need to pay triple attention to things that eclipse automatically insert for you as you type, like closing parens and braces, as they aren't announced at all by Jaws when they are automatically inserted. They can easily make you enter unwanted extra characters.
As a blind user I prefer to completely disable all autocompletes like this and only keep it on demand with shortcuts like F2, but that's a personal choice.
Unfortunately, I can't help if you are using NVDA, but there certainly are solutions as well.

Disable the Refreshed Selected Content Root Pop-up in IntelliJ gradle project

In IntelliJ it seems like whenever I save a file there is this annoying green pop-up notifier at the very bottom that obscures my bottom toolbar, i.e. where terminal, messages, debug usually are.
It's usually "Refreshed selected content roots" which I believe is a gradle thing. There is no obvious way to dismiss it and it just trips me up every time.
As I often make a change and then want to switch to SonarLint or Terminal or whatever and it's blocking the button.
I know obvious workarounds like moving buttons around, but I kind of don't understand what that notifier is even called to configure it or even google it.
As #CrazyCoder would know what he's talking about, I found that the alert is caused by the (hasn't been updated in years with no configurable settings) AccuRev Plugin.
You can search this PDF for "Selected Content Roots" and you'll find it:
https://supportline.microfocus.com/Documentation/books/AccuRev/Plugins/IntelliJ/2014.2/intellij-2014.2-users_guide-en.pdf
This means if I don't plan on moving files around I can logout or disable the plugin then run accurev stat -mO when I'm done. There have been plenty of other reasons to do that, so this just added to the heap.

How to show all errors in one place? A navigation window for "x error found"?

On the right, we can see something going on, and after it is done, it shows "x error found".
What is this exactly? Java compiler? Lint tool? Build-in analysis?
The problem is, when file gets large, it is hard to find out where the error is.
I know we can use F2 to navigate, but it also navigates to warnings. It would be nice to have a window showing all the errors in one place. Where is the navigation window for "x error found"?
Thanks for Vucko's answer. I didn't know it is clickable. Really appreciate it. But, I have to click that, hover my mouse over the codes, then wait for the error details to pop up, which costs lots of time. Also, warning is clickable, which is annoying. I still prefer a window.
Just Figured it out by myself.
After we Build > Make Project, Messages window pops up. All the errors show up here. We can click on each error to navigate to the corresponding file and location, or copy it to search on Google.
It is most likely Java compiler. Somehow it compiles on the fly. But, sometimes it is not reliable just like Instant Run is not reliable. If it becomes inconsistent with Messages window, try to restart Android Studio.
Never mind how big the file is, you can simply find the error by clicking the horizontal red line below. Every error will have it's own line and by clicking on it, you will be taken to that line immediately.
See the image for better understanding of what I mean:
Note: This is quite a useful tool for some other stuff as well, for example warnings will be shown and colored in orange (every color is customizable of course), and if you're using version control, e.g. Git, your changes will be colored in blue/green for edits/additions respectively.
I know we can use F2 to navigate, but it also navigates to warnings.
You can right-click on the scrollbar and select this option.
Go to high priority problems only
Have you tried filtering Logcat to Error? Like this:
Try Analyze --> Inspect code this will give you all your error with line number. it will even show typo

How to specify a custom action on Java exception in Eclipse IDE?

I'm working in Java with Eclipse (Luna) and I would like to specify what action happens whenever my project throws an exception. In other words, anytime an error happens and Eclipse prints a stack trace to the console, I would like to run my own code to print the stack trace in my own debug window or save to a text file, for example.
I'm not sure if this is a problem for my java project (maybe by overriding printStackTrace()?) or for the IDE itself (through some setting, etc.) Either way it doesn't really matter since its just a debug feature and would be removed before I export anything public.
Thanks for your help
EDIT: To clarify, I'm not talking about exceptions only from a specific line/class. I'm familiar with try-catch blocks. What I want is to preform an action any time any exception or error happens anywhere in my code, even if there is a typo and my project wont compile.
NOTE: You cannot have your own debug window in IDE
If you want to log some of your exceptions to some file wherein latter on you can see, so its time you use log4j.
Start with this simple example.
You will find ample on google :)

Real-time compilation in IntelliJ IDEA

I have recently switched from IntelliJ IDEA Community Edition version 12, to version 13 (updated to 13.0.1) and apparently the real-time ("on-the-fly") compilation of code does not work, at least not as found in other major IDEs (e.g., Eclipse).
A similar issue has been brought up in an earlier StackOverflow question and the answer was to check the corresponding option in File -> Settings -> Compiler, which I have of course done, but nothing changed.
The way it currently is, I can type whatever text in the Java code and there is no error highlighting, not even when the file is saved, let alone in real time.
Is there another setting or configuration that needs to be applied?
IntelliJ does something a lot better than compiling your files on the fly. It dynamically parses what you're typing, offering many more warnings than the java compiler produces. In comparison, compiling on the fly is a bad idea. Having said that, it sounds like you're having other problems, because you should have errors and other problems highlighted. At the top right of each editor window is a small coloured square. On good code it's green. It's yellow when there are warnings, and red when there are errors. If it's grey then Idea is analyzing your files. If you hover your mouse over the square it'll give you an idea about what Idea is doing, and how it's progressing. Try that before you try anything else. Idea never gets stuck, but it can run out of memory, if the analysis isn't progressing, then perhaps you've run out of memory, or have other issues, check this in the event log, which is at the bottom right of the window.
I've just been pulling my hair out over this working on my Mac in a coffeeshop running on battery power. Try File | Power Save Mode and make sure it's un-checked.

Categories

Resources