mirror of https://gitlab.com/basile.b/dexed.git
fix #479 - prevent the creation of a DUB property if laready present
This commit is contained in:
parent
54f27d0f3f
commit
329c3adda4
|
@ -412,13 +412,26 @@ end;
|
||||||
|
|
||||||
procedure TDubProjectEditorWidget.addProp(const propName: string;
|
procedure TDubProjectEditorWidget.addProp(const propName: string;
|
||||||
tpe: TJSONtype);
|
tpe: TJSONtype);
|
||||||
|
const
|
||||||
|
w: string = 'The property %s is already present';
|
||||||
var
|
var
|
||||||
|
dat: TJSONData;
|
||||||
arr: TJSONArray;
|
arr: TJSONArray;
|
||||||
obj: TJSONObject;
|
obj: TJSONObject;
|
||||||
nod: TTreeNode;
|
nod: TTreeNode;
|
||||||
begin
|
begin
|
||||||
if fSelectedNode.isNil then
|
if fSelectedNode.isNil then
|
||||||
exit;
|
exit;
|
||||||
|
dat := TJSONData(fSelectedNode.Data);
|
||||||
|
if dat.JSONType = jtObject then
|
||||||
|
begin
|
||||||
|
obj := TJSONObject(dat);
|
||||||
|
if obj.findAny(propName, dat) then
|
||||||
|
begin
|
||||||
|
dlgOkInfo(format(w, [propName]));
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
fProj.beginModification;
|
fProj.beginModification;
|
||||||
if TJSONData(fSelectedNode.Data).JSONType = jtArray then
|
if TJSONData(fSelectedNode.Data).JSONType = jtArray then
|
||||||
begin
|
begin
|
||||||
|
@ -459,7 +472,7 @@ begin
|
||||||
exit;
|
exit;
|
||||||
if fSelectedNode.Level = 0 then
|
if fSelectedNode.Level = 0 then
|
||||||
exit;
|
exit;
|
||||||
if fSelectedNode.Text = 'name' then
|
if (fSelectedNode.Text = 'name') and (fSelectedNode.Level = 0) then
|
||||||
exit;
|
exit;
|
||||||
if fSelectedNode.Data.isNil then
|
if fSelectedNode.Data.isNil then
|
||||||
exit;
|
exit;
|
||||||
|
|
Loading…
Reference in New Issue