AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

OpenToolsAPI - Projektionfos

Ein Thema von himitsu · begonnen am 1. Jun 2011 · letzter Beitrag vom 2. Jun 2011
 
USchuster

Registriert seit: 12. Sep 2010
Ort: L.E.
120 Beiträge
 
Delphi XE3 Professional
 
#7

AW: OpenToolsAPI - Projektionfos

  Alt 1. Jun 2011, 22:51
Ist zufällig jemand da, der sich mit der OTA auskennt?
Auskennen wer übertrieben

Im Prinzip brauch ich nur recht "schnell" ein paar Tipps, wo man eine Notification herbekommt, wenn ein Projekt geladen wird und wie man an die Projekteinstellungen (Pfade) rankommt.
Nach dem Öffnen eines Projektes landet der Suchpfad der Basiskonfiguration im Meldungsfenster.

Delphi-Quellcode:
unit SimpleNotifierUnit;

interface

procedure Register;

implementation

uses
  SysUtils, ToolsAPI, DCCStrs;

type
  TSimpleNotifier = class(TNotifierObject, IOTAIDENotifier)
  public
    procedure AfterCompile(Succeeded: Boolean);
    procedure BeforeCompile(const Project: IOTAProject; var Cancel: Boolean);
    procedure FileNotification(NotifyCode: TOTAFileNotification;
      const FileName: string; var Cancel: Boolean);
  end;

var
  NotifierIndex: Integer = -1;

procedure Register;
begin
  NotifierIndex := (BorlandIDEServices as IOTAServices).AddNotifier(TSimpleNotifier.Create);
end;

{ TSimpleNotifier }

procedure TSimpleNotifier.AfterCompile(Succeeded: Boolean);
begin
//
end;

procedure TSimpleNotifier.BeforeCompile(const Project: IOTAProject;
  var Cancel: Boolean);
begin
//
end;

procedure TSimpleNotifier.FileNotification(NotifyCode: TOTAFileNotification;
  const FileName: string; var Cancel: Boolean);
var
  ProjModule: IOTAModule;
  Project: IOTAProject;
  BuildConfigs: IOTAProjectOptionsConfigurations;
  EnvOptions: IOTAEnvironmentOptions;
  Config: IOTABuildConfiguration;
  SearchPath, SearchPathConfig, SearchPathLib: string;
begin
  if (NotifyCode = ofnFileOpened) and
    {$IF COMPILERVERSION >= 22.0}
    (BorlandIDEServices as IOTAServices).IsProject(FileName)
    {$ELSE}
    SameText('.dproj', ExtractFileExt(FileName))
    {$IFEND}
  then
  begin
    ProjModule := (BorlandIDEServices as IOTAModuleServices).FindModule(FileName);
    if Supports(ProjModule, IOTAProject, Project) and
      Supports(Project.ProjectOptions, IOTAProjectOptionsConfigurations, BuildConfigs) then
    begin
      Config := BuildConfigs.BaseConfiguration;
      (BorlandIDEServices as IOTAMessageServices).AddTitleMessage(Format('Opened Project %s', [FileName]));
      SearchPathConfig := Config.Value[sUnitSearchPath];
      (BorlandIDEServices as IOTAMessageServices).AddTitleMessage(Format(' Base.SearchPath = %s', [SearchPathConfig]));
      EnvOptions := (BorlandIDEServices as IOTAServices).GetEnvironmentOptions;
      SearchPathLib := EnvOptions.Values['LibraryPath'];
      (BorlandIDEServices as IOTAMessageServices).AddTitleMessage(Format(' EnvironmentOptions.LibraryPath = %s', [SearchPathLib]));
      SearchPath := SearchPathConfig;
      if SearchPathLib <> 'then
      begin
        if SearchPath <> 'then
          SearchPath := SearchPath + ';';
        SearchPath := SearchPath + SearchPathLib;
      end;
      (BorlandIDEServices as IOTAMessageServices).AddTitleMessage(Format(' SearchPath = %s', [SearchPath]));
    end;
  end;
end;

initialization

finalization
  if NotifierIndex <> -1 then
    (BorlandIDEServices as IOTAServices).RemoveNotifier(NotifierIndex);

end.
Schön wäre es auch, wenn man die ToolsAPI.pas wieder kompilieren könnte, ohne rumgeeiere, wie fehlende Suchpfade und die blöde immernoch fehlende Unit DockForm.
Package Designide einbinden und spätestens wenn Du INTA Interfaces benutzen willst musst Du ohnehin mit Packages compilieren.

Ich glaub Emba will um jeden Preis verhindern, daß man Schwächen in der IDE selber ausbessert oder sonstwas darin veranstaltet.
Das schließt Du nochmal wo heraus?
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:56 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz