Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Running external tools with error parsing "org.eclipse.cdt.core.ErrorParser"

Thanks, Andrew,
that sounds like a good idea.
As I would like to keep the special menu as UI, I guess it is possible to create a Make Target View target on the fly and destroy it after usage?
As far as I can see, there is no way to tell such a make target which error parser to use. Does it always take the ones activated in the current build configuration? That could be a problem for me, as I have several special error parsers for the different tools, and they are not activated for the regular build.

-Achim

Andrew Gvozdev wrote on 2009-07-08 22:45:
Hi Achim,
You could try Make Target View targets, just replace "make" command with your own.

Thanks,
Andrew

On Wed, Jul 8, 2009 at 4:38 PM, Achim Bursian <abu.aud@xxxxxxxxxxx> wrote:
Hello everybody,
In my plugins I need to provide the ability to run several external tools on our C++ projects. They all analyze the code and return some information on stdout.

First, I added them all individually as CDT build configurations. That worked fine, the output showed in the console and could be analyzed by a CDT error parser (extension point="org.eclipse.cdt.core.ErrorParser") .
But it had a major disadvantage: The .cproject file grew huge, and the list of build configurations became quite cluttered. Logically these tools didn't belong there at all, these are no "builds", no new resources are generated.

So I added a new context menu for projects, from the actions I start the external tools like this (stripped down code):

      ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
      ILaunchConfigurationType programType = manager
             .getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE);
      ILaunchConfiguration cfg;
      try {
          cfg = programType.newInstance(null, title);
          ILaunchConfigurationWorkingCopy wc = cfg.getWorkingCopy();
          wc.setAttribute(IExternalToolConstants.ATTR_LOCATION,
                  "${eclipse_home}/wrap/tool.cmd");
          wc.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY,
                  workingdir);
          wc.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, cmd
                  + " " + params);
          cfg = wc.doSave();
          cfg.launch(ILaunchManager.RUN_MODE, null, false, true);
          cfg.delete();
      } catch (CoreException e) {
        ...

This works, but I have no possibility to add an error parser, which is what I need.
Is there a "canonical" way of achieving what I want:
Launching an external tool with some parameters, and feeding the output both to a console view AND to a CDT error parser?
Any hints?
Thanks in advance
 Achim
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


_______________________________________________ cdt-dev mailing list cdt-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/cdt-dev

Back to the top