![]() |
OpenToolsAPI - Projektionfos
Moin,
Ist zufällig jemand da, der sich mit der OTA auskennt? (möglichst ohne Fremdkomponenten, da ich den Firmenserver nicht all zu sehr vollmüllen möchte) 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. *liebschau* |
AW: OpenToolsAPI - Projektionfos
Moin, Moin,
schau mal hier ![]() Ist vielleicht das was Du suchst.... Cu Michael |
AW: OpenToolsAPI - Projektionfos
Diese Ecke kenn ich schon, dennoch danke :)
Ich versuche mich aktuell über ein PreCompileEvent reinzuhacken (zwar'n bissl spät, aber hoffentlich noch rechtzeitig, um die Projektoptionen notfalls noch anzupassen). 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. Ich glaub Emba will um jeden Preis verhindern, daß man Schwächen in der IDE selber ausbessert oder sonstwas darin veranstaltet. :wall: |
AW: OpenToolsAPI - Projektionfos
Hallo Himitsu,
vielleicht hilft Dir das weiter :
Delphi-Quellcode:
// Den aktuellen Pfad und den Projektnamen ermitteln
(BorlandIDEServices as IOTAModuleServices).GetActiveProject.FileName:string; // Den Zielnamen und den Zielpfad ermitteln (BorlandIDEServices as IOTAModuleServices).GetActiveProject.ProjectOptions.TargetName:string; |
AW: OpenToolsAPI - Projektionfos
Und wann ein Projekt geöffnet wird, erfährt man via
![]() |
AW: OpenToolsAPI - Projektionfos
Ich hab jetzt erstmal das zusammen und es Meldet mir auch fleißig etwas.
Nur ob ich da noch was an den Optionen eändern kann, weiß ich noch nicht.
Delphi-Quellcode:
Witzig finde ich die neue MessageBox der XE-IDE ... so cool mit ScrollBar, wenn zuviel Text angezeigt werden soll. :shock:
unit Unit1;
interface uses ToolsAPI, Dialogs; implementation type TCompileNotifier = class(TInterfacedObject, IOTACompileNotifier) protected procedure ProjectCompileStarted(const Project: IOTAProject; Mode: TOTACompileMode); procedure ProjectCompileFinished(const Project: IOTAProject; Result: TOTACompileResult); procedure ProjectGroupCompileStarted(Mode: TOTACompileMode); procedure ProjectGroupCompileFinished(Result: TOTACompileResult); end; var CompileNotifier: Integer; procedure TCompileNotifier.ProjectCompileStarted(const Project: IOTAProject; Mode: TOTACompileMode); var S, S2: String; N: TOTAOptionName; begin S := ''; for N in Project.ProjectOptions.GetOptionNames do begin try S2 := '"' + String(Project.ProjectOptions.Values[N.Name]) + '"'; except S2 := 'error'; end; S := S + N.Name + ' = ' + S2 + sLineBreak; end; ShowMessage(S + '"' + Project.ProjectType + '"'); end; procedure TCompileNotifier.ProjectCompileFinished(const Project: IOTAProject; Result: TOTACompileResult); begin end; procedure TCompileNotifier.ProjectGroupCompileStarted(Mode: TOTACompileMode); begin end; procedure TCompileNotifier.ProjectGroupCompileFinished(Result: TOTACompileResult); begin end; initialization CompileNotifier := (BorlandIDEServices as IOTACompileServices).AddNotifier(TCompileNotifier.Create); finalization (BorlandIDEServices as IOTACompileServices).RemoveNotifier(CompileNotifier); end. Im Prinzip hätte ich gerne ein Tool, welches die Projektoptionen prüft und falls da etwas nicht stimmt, fragt es einen, so daß man eventuell aus einem Set von vorgefertigten Optionen eoine auswählen kann. Damit endlich mal das Chaos, mit den unzähligen Speicher- und Suchpfaden, ein Ende findet. Wenn ich es mir jetzt recht überlege, ist es vor dem Kompilieren eh schöner, da dann nicht gleich jedes Projekt angemeckert wird, sondern erst wenn man kompiliert, also da wo es wichtig wird. Die Pfade der IDE-Optionen laß ich nun schon über den FinalBuilder abgleichen, also mit dessen aktuellen Pfaden. |
AW: OpenToolsAPI - Projektionfos
Zitat:
Zitat:
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. Zitat:
Zitat:
|
AW: OpenToolsAPI - Projektionfos
Zitat:
Warum fehlen diese Units überhaupt? Und weshalb steht nirgends in den ToolsAPI-Units, daß man diese nicht direkt nutzen kann, sonstern dieses Package einbinden muß? und weil es von Emba doch eigentlich keine ordentliche Doku dazu gibt? (mir kommt es so vor, als wenn die meisten Infos von irgendwelchen Läuten durch Probieren rausgefunden wurden) |
AW: OpenToolsAPI - Projektionfos
Zitat:
![]() |
AW: OpenToolsAPI - Projektionfos
Zitat:
Zitat:
Zitat:
![]() Zitat:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:08 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 by Thomas Breitkreuz