Commit 8c82944b authored by Jucelino Fonseca's avatar Jucelino Fonseca

Teste e ajustes

parent 15cac967
...@@ -172,7 +172,7 @@ type ...@@ -172,7 +172,7 @@ type
function ContemPalavrasEspeciais (piTextoEntrada: string): boolean; function ContemPalavrasEspeciais (piTextoEntrada: string): boolean;
procedure AddAliasListas(piLinhas: string;piAlias : TStrings); procedure AddAliasListas(piLinhas: string;piAlias : TStrings);
function LoadAliasBlocoFROMOQLEdit(piTexto: string; piAlias: TStrings): string; function LoadAliasBlocoFROMOQLEdit(piTexto: string; piAlias: TStrings): string;
function GetClassTicketByNameRelation(piNameObjeto : string; out piNameAntObjeto : string) : acClassTicket; function GetClassTicketByNameRelation(piNameObjeto : string; out piNameAntObjeto : string;piRetonarClassAnterior : boolean = false) : acClassTicket;
function GetClassTicketByNameANDAlias(piNameObjeto : string) : acClassTicket; function GetClassTicketByNameANDAlias(piNameObjeto : string) : acClassTicket;
// //
function GetTextoAfterWord(piSynEdit: TSynEdit): string; function GetTextoAfterWord(piSynEdit: TSynEdit): string;
...@@ -493,7 +493,7 @@ end; ...@@ -493,7 +493,7 @@ end;
procedure TExplorerV2.SynEditOQLCommandProcessed(Sender: TObject; procedure TExplorerV2.SynEditOQLCommandProcessed(Sender: TObject;
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer); var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
begin begin
fhlt1.CloseCompletionWindow; //fhlt1.CloseCompletionWindow;
end; end;
procedure TExplorerV2.SynEditOQLKeyUp(Sender: TObject; var Key: Word; procedure TExplorerV2.SynEditOQLKeyUp(Sender: TObject; var Key: Word;
...@@ -807,7 +807,7 @@ begin ...@@ -807,7 +807,7 @@ begin
else else
begin begin
lClassTicketCurrent := self.GetClassTicketByNameRelation(piLinha,ls_ant_objeto); lClassTicketCurrent := self.GetClassTicketByNameRelation(piLinha,ls_ant_objeto,true);
if Assigned(lClassTicketCurrent) then if Assigned(lClassTicketCurrent) then
begin begin
//ShowMessage(ls_ant_objeto); //ShowMessage(ls_ant_objeto);
...@@ -992,6 +992,7 @@ var ls_texto, ...@@ -992,6 +992,7 @@ var ls_texto,
ls_Alias : string; ls_Alias : string;
ls_classe : string; ls_classe : string;
lClassTicketCurrent: acClassTicket; lClassTicketCurrent: acClassTicket;
liIndex : Integer;
begin begin
ls_Alias := ''; ls_Alias := '';
if (piLinhas <> '') and (not ContemPalavrasEspeciais(piLinhas)) then if (piLinhas <> '') and (not ContemPalavrasEspeciais(piLinhas)) then
...@@ -1023,9 +1024,14 @@ begin ...@@ -1023,9 +1024,14 @@ begin
lClassTicketCurrent := self.GetClassTicketByNameRelation(ls_classe,ls_name_ant_objeto); lClassTicketCurrent := self.GetClassTicketByNameRelation(ls_classe,ls_name_ant_objeto);
if Assigned(lClassTicketCurrent) then if Assigned(lClassTicketCurrent) then
begin begin
if piAlias.IndexOf(ls_Alias) < 0 then liIndex := piAlias.IndexOf(ls_Alias);
if liIndex < 0 then
begin begin
piAlias.AddObject(UpperCase(ls_Alias),lClassTicketCurrent); piAlias.AddObject(UpperCase(ls_Alias),lClassTicketCurrent);
end
else
begin
piAlias.Objects[liIndex] := lClassTicketCurrent;
end; end;
end; end;
end; end;
...@@ -1116,8 +1122,9 @@ begin ...@@ -1116,8 +1122,9 @@ begin
end; end;
function TExplorerV2.GetClassTicketByNameRelation(piNameObjeto: string; out piNameAntObjeto : string): acClassTicket; function TExplorerV2.GetClassTicketByNameRelation(piNameObjeto: string; out piNameAntObjeto : string;piRetonarClassAnterior : boolean = false): acClassTicket;
var lClassTicketCurrent, var lClassTicketCurrent,
lCassTicketAnterior,
lClassTicketAux: acClassTicket; lClassTicketAux: acClassTicket;
lEnumerator : acEnumerator; lEnumerator : acEnumerator;
li, li,
...@@ -1136,6 +1143,7 @@ begin ...@@ -1136,6 +1143,7 @@ begin
lClassTicketCurrent := Self.GetClassTicketByNameANDAlias(ls_Objeto); lClassTicketCurrent := Self.GetClassTicketByNameANDAlias(ls_Objeto);
while li_Pos > 0 do while li_Pos > 0 do
begin begin
lCassTicketAnterior := lClassTicketCurrent;
lClassTicketAux := nil; lClassTicketAux := nil;
ls_aux := trim(Copy(ls_aux,li_Pos +1,Length(ls_aux))); ls_aux := trim(Copy(ls_aux,li_Pos +1,Length(ls_aux)));
ls_ant_objeto := ls_aux; ls_ant_objeto := ls_aux;
...@@ -1175,10 +1183,19 @@ begin ...@@ -1175,10 +1183,19 @@ begin
end; end;
end; end;
end; end;
lClassTicketCurrent := lClassTicketAux;
lClassTicketCurrent := lClassTicketAux;
end; end;
end; end;
result := lClassTicketCurrent; result := lClassTicketCurrent;
if (trim(ls_ant_objeto) <> '') and (not Assigned(result)) then;
begin
if piRetonarClassAnterior then
begin
result := lCassTicketAnterior;
end;
end;
end end
else else
begin begin
...@@ -1227,15 +1244,14 @@ begin ...@@ -1227,15 +1244,14 @@ begin
if trim(result) <> '' then if trim(result) <> '' then
begin begin
piSynEdit.CaretX := Length(result); p2.Y := p1.Y;
piSynEdit.CaretY := p1.Y; p2.X := Length(result);
piSynEdit.CaretXY := p2;
p1 := piSynEdit.PrevWordPos; p1 := piSynEdit.PrevWordPos;
lWord := piSynEdit.GetWordAtRowCol(p1); lWord := piSynEdit.GetWordAtRowCol(p1);
p1.X := p1.X + Length(lWord); p1.X := p1.X + Length(lWord);
p2 := piSynEdit.CaretXY;
p2.X := Length(result);
result := piSynEdit.TextBetweenPoints[p1,p2]; result := piSynEdit.TextBetweenPoints[p1,p2];
piSynEdit.CaretXY := PointAtual;; piSynEdit.CaretXY := PointAtual;;
...@@ -1424,7 +1440,11 @@ begin ...@@ -1424,7 +1440,11 @@ begin
else else
begin begin
result := lTextAfterWord; result := lTextAfterWord;
if IsExepressaoValida(OpEve,trim(lTextAfterWord),lTemPalavra) then if Trim(lTextAfterWord) = Trim(result) then
begin
lTemPalavra := false;
end;
if IsExepressaoValida(OpEve,trim(lTextAfterWord),lTemPalavra) then
begin begin
result := ''; result := '';
end; end;
...@@ -1432,7 +1452,14 @@ begin ...@@ -1432,7 +1452,14 @@ begin
end end
else if trim(lTextAfterWord) = '' then else if trim(lTextAfterWord) = '' then
begin begin
result := result + lTextAfterWord; if IsExepressaoValida(opEve,trim(Result)) then
begin
result := '';
end
else
begin
result := result + lTextAfterWord;
end;
end; end;
end end
else if (lTextAfterWord <> '') then else if (lTextAfterWord <> '') then
...@@ -1689,16 +1716,16 @@ begin ...@@ -1689,16 +1716,16 @@ begin
lFromSec := fhlt1.AddSection(__FROM); lFromSec := fhlt1.AddSection(__FROM);
lWhereSec := fhlt1.AddSection(__WHERE); lWhereSec := fhlt1.AddSection(__WHERE);
fopEvenSearchSelect := fhlt1.AddOpenEvent('identifier','',fil_None); fopEvenSearchSelect := fhlt1.AddOpenEvent('identifier','',fil_LastIdentPart);
fopEvenSearchSelect.Action := pac_Rep_LastTok; //fopEvenSearchSelect.Action := pac_Rep_LastTok;
fopEvenSearchSelect.block := lSelectSec; fopEvenSearchSelect.block := lSelectSec;
fopEvenSearchFrom := fhlt1.AddOpenEvent('identifier','',fil_None); fopEvenSearchFrom := fhlt1.AddOpenEvent('identifier','',fil_LastIdentPart);
fopEvenSearchFrom.Action := pac_Rep_LastTok; //fopEvenSearchFrom.Action := pac_Rep_LastTok;
fopEvenSearchFrom.block := lFromSec; fopEvenSearchFrom.block := lFromSec;
fopEvenSearchWhere := fhlt1.AddOpenEvent('identifier','',fil_None); fopEvenSearchWhere := fhlt1.AddOpenEvent('identifier','',fil_LastIdentPart);
fopEvenSearchWhere.Action := pac_Rep_LastTok; //fopEvenSearchWhere.Action := pac_Rep_LastTok;
fopEvenSearchWhere.block := lWhereSec; fopEvenSearchWhere.block := lWhereSec;
fopEvenSelectAposPonto := fhlt1.AddOpenEvent('identifier,''.''','',fil_None); fopEvenSelectAposPonto := fhlt1.AddOpenEvent('identifier,''.''','',fil_None);
...@@ -1714,15 +1741,15 @@ begin ...@@ -1714,15 +1741,15 @@ begin
fopEvenWhereAposPonto.block := lWhereSec; fopEvenWhereAposPonto.block := lWhereSec;
fopEvenSelectCompleto := fhlt1.AddOpenEvent('','',fil_None); fopEvenSelectCompleto := fhlt1.AddOpenEvent('','',fil_None);
fopEvenselectCompleto.Action := pac_Insert; fopEvenselectCompleto.Action := pac_Insert;;
fopEvenSelectCompleto.block := lSelectSec; fopEvenSelectCompleto.block := lSelectSec;
fopEvenFromCompleto := fhlt1.AddOpenEvent('','',fil_None); fopEvenFromCompleto := fhlt1.AddOpenEvent('','',fil_None);
fopEvenFromCompleto.Action := pac_Insert; fopEvenFromCompleto.Action := pac_Insert;;
fopEvenFromCompleto.block := lFromSec; fopEvenFromCompleto.block := lFromSec;
fopEvenWhereCompleto := fhlt1.AddOpenEvent('','',fil_None); fopEvenWhereCompleto := fhlt1.AddOpenEvent('','',fil_None);
fopEvenWhereCompleto.Action := pac_Insert ; fopEvenWhereCompleto.Action := pac_Insert;;
fopEvenWhereCompleto.block := lWhereSec; fopEvenWhereCompleto.block := lWhereSec;
fopEvenFromAposPonto.OnLoadItems :=opEveLoadItems; fopEvenFromAposPonto.OnLoadItems :=opEveLoadItems;
...@@ -1731,6 +1758,7 @@ begin ...@@ -1731,6 +1758,7 @@ begin
fopEvenselectCompleto.OnLoadItems :=opEveLoadItems; fopEvenselectCompleto.OnLoadItems :=opEveLoadItems;
fopEvenFromCompleto.OnLoadItems :=opEveLoadItems; fopEvenFromCompleto.OnLoadItems :=opEveLoadItems;
fopEvenWhereCompleto.OnLoadItems :=opEveLoadItems; fopEvenWhereCompleto.OnLoadItems :=opEveLoadItems;
fopEvenSearchSelect.OnLoadItems :=opEveLoadItems; fopEvenSearchSelect.OnLoadItems :=opEveLoadItems;
fopEvenSearchFrom.OnLoadItems :=opEveLoadItems; fopEvenSearchFrom.OnLoadItems :=opEveLoadItems;
fopEvenSearchWhere.OnLoadItems :=opEveLoadItems; fopEvenSearchWhere.OnLoadItems :=opEveLoadItems;
...@@ -1756,22 +1784,32 @@ var lLista : TStrings; ...@@ -1756,22 +1784,32 @@ var lLista : TStrings;
lAceitaAtributo : boolean; lAceitaAtributo : boolean;
li : integer; li : integer;
begin begin
opEve.ClearAvails; opEve.ClearAvails;
lAceitaAtributo := false; lAceitaAtributo := false;
ls_Texto := SynEditOQL.GetWordAtRowCol(SynEditOQL.CaretXY); ls_Texto := SynEditOQL.GetWordAtRowCol(SynEditOQL.CaretXY);
if not IsKeyword(ls_Texto) then if not IsKeyword(ls_Texto) then
begin begin
if (opEve = fopEvenSelectAposPonto) or if (opEve = fopEvenSelectAposPonto) or
(opEve = fopEvenWhereAposPonto) or (opEve = fopEvenWhereAposPonto) or
(opEve = fopEvenFromAposPonto) (opEve = fopEvenFromAposPonto) or
(opEve = fopEvenWhereCompleto) or
(opEve = fopEvenSearchWhere) or
(opEve = fopEvenSearchSelect) or
(opEve = fopEvenselectCompleto)
then then
begin begin
LoadAliasOQLEdit(SynEditOQL.Text,fAlias); LoadAliasOQLEdit(SynEditOQL.Text,fAlias);
if opEve = fopEvenWhereAposPonto then if (opEve = fopEvenWhereCompleto) or
(opEve = fopEvenSearchWhere) or
(opEve = fopEvenWhereAposPonto)
then
begin begin
lAceitaAtributo := true; lAceitaAtributo := true;
end end
else if opEve = fopEvenSelectAposPonto then else if (opEve = fopEvenSelectAposPonto) or
(opEve = fopEvenSearchSelect) or
(opEve = fopEvenselectCompleto)
then
begin begin
if XMLQuery.Checked then if XMLQuery.Checked then
begin begin
...@@ -1783,7 +1821,11 @@ begin ...@@ -1783,7 +1821,11 @@ begin
try try
lLinha := RetirarPalavraChaveOLQ(SynEditOQL,opEve); lLinha := RetirarPalavraChaveOLQ(SynEditOQL,opEve);
LoadListCompletion(lLinha,lAceitaAtributo,lLista); LoadListCompletion(lLinha,lAceitaAtributo,lLista);
for li := 0 to lLista.Count - 1 do if lLista.Count > 0 then
begin
opEve.AddAvail('');
end;
for li := 0 to lLista.Count - 1 do
begin begin
opEve.AddAvail(lLista.Strings[li]); opEve.AddAvail(lLista.Strings[li]);
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment