Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Codan launch modes

Hello,

I've created a checker plug-in based on CodAn and try to set up launch modes.

Checker inherits org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker and overrides initPreferences because I haven't found any extension point dedicated to this usage.

  @Override
  public void initPreferences( IProblemWorkingCopy problem ) {
      final LaunchModeProblemPreference lmpp =
          getLaunchModePreference( problem );
      lmpp.addLaunchMode( CheckerLaunchMode.RUN_ON_FULL_BUILD,
          Boolean.FALSE );
      lmpp.addLaunchMode( CheckerLaunchMode.RUN_ON_INC_BUILD ,
          Boolean.FALSE );
      lmpp.addLaunchMode( CheckerLaunchMode.RUN_ON_DEMAND    ,
          Boolean.TRUE  );
      lmpp.addLaunchMode( CheckerLaunchMode.RUN_ON_FILE_OPEN ,
          Boolean.FALSE );
      lmpp.addLaunchMode( CheckerLaunchMode.RUN_AS_YOU_TYPE  ,
          Boolean.TRUE  );
      lmpp.addLaunchMode( CheckerLaunchMode.RUN_ON_FILE_SAVE ,
          Boolean.FALSE );
      System.out.println( problem.getName() + ": "
          + problem.getPreference());
  }

At runtime, console shows success of initialization:

    ...
RAF-LNG-020: [org.eclipse.cdt.codan.core.param.FileScopeProblemPreference@4eddffcf, [(boolean)RUN_ON_FULL_BUILD=false, (boolean)RUN_ON_INC_BUILD=false, (boolean)RUN_ON_DEMAND=true, (boolean)RUN_ON_FILE_OPEN=false, (boolean)RUN_AS_YOU_TYPE=true, (boolean)RUN_ON_FILE_SAVE=false], (string)suppression_comment] RAF-LNG-030: [org.eclipse.cdt.codan.core.param.FileScopeProblemPreference@25264061, [(boolean)RUN_ON_FULL_BUILD=false, (boolean)RUN_ON_INC_BUILD=false, (boolean)RUN_ON_DEMAND=true, (boolean)RUN_ON_FILE_OPEN=false, (boolean)RUN_AS_YOU_TYPE=true, (boolean)RUN_ON_FILE_SAVE=false], (string)suppression_comment]
    ...

First problem:

Window -> Preferences -> C/C++ -> Code Analysis -> Customize Selected (button) -> Launching (tab) shows

    [X] Run as you type
    [ ] Run on file open
    [ ] Run as file save
    [X] Run on incremental build
    [X] Run on full build
    [X] Run on demand

Second problem:

    When a file is opened my checker is called and report errors.

How can I really tune launch modes?


Back to the top