2

I'm trying to get rid of some hints(*) the Delphi compiler emits. Browsing through the ToolsAPI I see a IOTAToolsFilter that looks like it might help me accomplish this through it's Notifier, but I'm not sure how to invoke this (through what xxxServices I can access the filter).

Can anyone tell me if I´m on the right track here? Thanks!

(*) In particular, H2365 about overridden methods not matching the case of the parent. Not so nice when you have about 5 million lines of active code with a slightly different code convention than Embarcadero's. We've been working without hints for months now, and we kinda miss 'm. :-)

Sertac Akyuz
  • 54,131
  • 4
  • 102
  • 169
Paul-Jan
  • 16,746
  • 1
  • 63
  • 95
  • Notify me if you have a solution :-) – Marco van de Voort Jun 08 '10 at 11:28
  • Have you tried using Refactoring to fix the method names? – Ondrej Kelle Jun 08 '10 at 11:54
  • 1
    Nah, we are a bunch of stubborn developers and really like our own code convention. We much rather loose hints than give up on that. Also, we tend to use includes a lot, which breaks Refactoring into oblivion ... cygwin replace scripts for the win. :D – Paul-Jan Jun 08 '10 at 12:02
  • 5
    Shouldn't the naming convention for virtual method overrides be dictated by the author of the base class, not the author of the override? You can't change the method name, so why should you change its case? For me, the case is part of the contract established by inheriting from the base class. – Uli Gerhardt Jun 08 '10 at 12:02
  • 1
    Man, I knew that p.s. would draw flame. I'd say the whole point of having a code convention of your own is that you get to make such rules up yourself, and not have them shoved down your throats by the tool builder. Case in situ is "destroy" (we use lowerCamelCase), in case that wasn't blatantly clear. But regardless the whole "adapt your code convention" issue, I'd still like to know the answer to my question. – Paul-Jan Jun 08 '10 at 12:12
  • No flame intended. My point is that `Destroy` isn't a name you choose - it's a name chosen by the Delphi team. If you want to override the method, you can't name it `Destruct` or `MakeItGoAway`. And likewise IMHO one shouldn't rename it to `destroy`, even if Pascal allows it. – Uli Gerhardt Jun 08 '10 at 15:29
  • 1
    Yeah, you make a valid point, but I kinda question the "likewise". Changing case is _not_(!) changing the name. It´s just not something Pascal `allows´, it´s a fundamental right in this language. Just kidding of course, our own code convention dictates case as well, it's just a different case. It also predates Delphi by a couple of years IIRC, so changing it might cause the universe to collapse (that, or some of the older developers). – Paul-Jan Jun 08 '10 at 16:00
  • Agree with Paul-Jan. I understand BCB users point, but please don't force that upon Delphi users. – Marco van de Voort Jun 10 '10 at 13:57

2 Answers2

4

Even if you could query BorlandIDEServices for IOTAToolsFilter, that interface isn't going to help you do what you're asking. That interface was introduced as part of a mechanism for adding additional build tools (compilers, etc.) to the IDE (before the IDE used MSBuild). It allowed you to write a custom "filter" to handle output from a particular build tool, but it would not let you apply a filter to one of the built-in tools (like the delphi compiler).

The reason the Supports(BorlandIDEServices, IOTAToolsFilter, OTAToolsFilter) call fails in Delphi2010 is that once MSBuild support was added to the IDE, the old way of adding build tools to the IDE was disabled, and the BorlandIDEServices interface no longer supported IOTAToolsFilter.

The declaration of IOTAToolsFilter should probably have been marked deprecated in ToolsAPI.pas (or least it should have been mentioned in the source code comment that it is no longer supported).

As far as your desire to filter a particular hint, I'm not aware of a way to do that via the ToolsAPI. It seems like a reasonable thing that can be added to IOTAMessageServices (the ability to enumerate, filter, and possibly change the messages in the IDE's Message View). I would enter a request in QualityCentral for that.

Also, please vote for QC #35774 (http://qc.embarcadero.com/wc/qcmain.aspx?d=35774), as if that were implemented, you would not need to use the ToolsAPI for this sort of thing.

Chris Hesik
  • 481
  • 4
  • 7
  • Note that [QualityCentral has now been shut down](https://community.embarcadero.com/blogs/entry/quality-keeps-moving-forward), so you can't access `qc.embarcadero.com` links anymore. If you need access to old QC data, look at [QCScraper](http://www.uweraabe.de/Blog/2017/06/09/how-to-save-qualitycentral/). – Remy Lebeau Jun 09 '17 at 18:03
1

According to http://docwiki.embarcadero.com/RADStudio/en/Obtaining_Tools_API_Services it should be possible to access it directly using BorlandIDEServices, eg:

var
  OTAToolsFilter: IOTAToolsFilter;
begin    
if Supports(BorlandIDEServices, IOTAToolsFilter, OTAToolsFilter) then
  ShowMessage('supports IOTAToolsFilter')
else
  ShowMessage('IOTAToolsFilter NOT supported');
end;

However this doesn't return the desired interface in Delphi 2010 (you'll get the not supported message), so there's either an error in the documentation, or an error in BorlandIDEServices not returning the correct interface.

Dan Bartlett
  • 826
  • 7
  • 8
  • +1 for pointing me to the docs specifying that it _is_ indeed one of the xxxServices. I might fiddle around a bit with older Delphi versions to confirm whether this approach used to work. – Paul-Jan Jun 08 '10 at 14:31