mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-04 16:58:14 +02:00
SqlDb: In registersqldb, auto declare unit in uses section. Issue #23045, patch from Silvio Clécio
git-svn-id: trunk@40927 -
This commit is contained in:
parent
6f40ba2c6f
commit
a505823935
@ -102,7 +102,9 @@ uses
|
||||
lazideintf,
|
||||
srceditorintf,
|
||||
ProjectIntf,
|
||||
idemsgintf;
|
||||
idemsgintf,
|
||||
CodeCache,
|
||||
CodeToolManager;
|
||||
|
||||
Type
|
||||
{ TSQLStringsPropertyEditor }
|
||||
@ -140,6 +142,7 @@ Type
|
||||
public
|
||||
function GetAttributes: TPropertyAttributes; override;
|
||||
procedure GetValues(Proc: TGetStrProc); override;
|
||||
procedure SetValue(const NewValue: ansistring); override;
|
||||
end;
|
||||
|
||||
{$IFDEF HASLIBLOADER}
|
||||
@ -256,6 +259,30 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSQLDBConnectorTypePropertyEditor.SetValue(const NewValue: ansistring);
|
||||
var
|
||||
Comp: TPersistent;
|
||||
Code: TCodeBuffer;
|
||||
ConnDef: TConnectionDef;
|
||||
SrcEdit: TSourceEditorInterface;
|
||||
begin
|
||||
if not LazarusIDE.BeginCodeTools then
|
||||
Exit;
|
||||
SrcEdit := SourceEditorManagerIntf.ActiveEditor;
|
||||
if Assigned(SrcEdit) then
|
||||
Code := TCodeBuffer(SrcEdit.CodeToolsBuffer);
|
||||
if Code = nil then
|
||||
Exit;
|
||||
Comp := GetComponent(0);
|
||||
if Comp is TSQLConnector then
|
||||
begin
|
||||
ConnDef := GetConnectionDef(NewValue);
|
||||
if Assigned(ConnDef) then
|
||||
CodeToolBoss.AddUnitToMainUsesSection(Code, ConnDef.UnitName, '');
|
||||
end;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
{$IFDEF HASLIBLOADER}
|
||||
{ TSQLDBLibraryLoaderLibraryNamePropertyEditor }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user