Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] CODAN-Auto checking after quickfix

Alena Laskavaia <elaskavaia.cdt@xxxxxxxxx> a écrit :

On Tue, Apr 12, 2011 at 12:41 PM,  <maximed@xxxxxxxxxxxxxxxxxxx> wrote:

Alena Laskavaia <elaskavaia.cdt@xxxxxxxxx> a écrit :

On Tue, Apr 12, 2011 at 10:08 AM,  <maximed@xxxxxxxxxxxxxxxxxxx> wrote:


I noticed that whe I used a quickfix on my code, checkers were called
automatically to refresh errors and warnings. I'd like to know if there
is a
way to do it without modifying my file or my AST (I am in my
thing again).

I don't understand the question

    When a codan problem is reproted on CDT IDE, and when I use the
suggested quick fix (such as create local variable for example), the
error/warning disappears, which is the expected comportment. Indeed, in the
existing quickfixes, the source file is modified, so I think the warning
disappears because of the modification (as I am in run as you type mode).
The quickfix I developed does'nt modify the source to change the problem, it
only flags it in an other way. My problem is that I need to add/suppress a
character (in run as you type mode), or launch a manual checking to make
this modification visible (ie re-call checking on the file). So I wanted to
know what was the way (the class/method) to explicitly call checking of all
my checkers on the displayed file.

Check where code removes the error for quick fix, contribute the API
extension which would allow to suppress it

The apply(...) method is just the implementation of a empty signature function in the AbstractCodanCMarkerResolution. But just the fact of reading you makes me think that I didn't check what was called after it. I tried to use, but it is showed restricted by eclipse and sent me a red exception.

Anyways, don't worry, once the job's done and over, I'll submit this "justification framework" and all the checkers which code does not reveal industrial advantage.

My second question concerns the fact that when I use a quickfix, a new
is opened in the editor, and sometimes eclipse asks me to save something.
it because I used "run as eclipse application" (and then it will not be
case when I'll run it it production mode), or because something is wrong
my installation?

It should not open tab. It will ask to save the file because it cannot
work on unsaved file for some reason.
Check the code of existing quick fixes to see what is different.

The fact is that my code is based on a copy/paste of what was done on
previous quickfixes (I don't pretend being smart enough to guess what API
does without an example =) ). Even with an empty apply method, the problem
is present. Maybe it comes from my build, as I had to manually copy a class
from cdt.core into codan.checkers.ui, since I wasn't able to find it in the
cdt.core.jar which was in my eclipse/plugin directory (don't remember at the
moment the name of the class). The weird thing is that it asks to save the
file, saves it indeed, but the result file is empty...

Sorry I don't know how this works really. Mine does not open another tab...

Ok ok. I'll try to redeploy a PDE environment with Indigo and CDT8. Surely my problem is that the version of Codan sources I work with do not match the milestone of my CDT version. Thanks anyways.

Here is my code for sample:

        * Handles the quick fix
       public void apply(IMarker pMarker, IDocument pDocument) {
               try {
                       /* We get the beginning and the ending of the
                       int lStart=(Integer)
                       int lEnd=(Integer)
                       /* We get the AST of the program, so as to get its
filename */
                       IASTTranslationUnit lAst = lUnit.getAST();
                       String lFilename=lAst.getContainingFilename();
                       /* We get the id of the problem, so as to get its
checker's id */
                       String lProblemID=getProblemId(pMarker);
                       /* If the problem is an error or a warning, it is
justified yet */
                       int lLength=lEnd-lStart;
                       IASTNode lNode=lSelector.findEnclosingNode(lStart,
                       String lExpression=lNode.getRawSignature();
                       if(lSeverity==IMarker.SEVERITY_ERROR ||
                               /* Ables to enter justification */
                               InputDialog lDialog = new
                                               "Please enter the
justification", "Default", null);
                               String lReason = lDialog.getValue();

lProblemID, lStart, lEnd, lExpression, lReason);
                       /* Else, if it is an info, it is already justified

lProblemID, lStart, lEnd, lExpression);
               } catch (CoreException e) {

Thank in advance.


cdt-dev mailing list

cdt-dev mailing list

Back to the top