From e1e86c258f132800f0f608efb7d830e0bf0eaf28 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Fri, 18 Sep 2015 00:01:47 +0200 Subject: [PATCH] menu, add source to project, emit hint when proj kind is dub --- src/ce_main.pas | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/ce_main.pas b/src/ce_main.pas index 9b4f596e..282eaf56 100644 --- a/src/ce_main.pas +++ b/src/ce_main.pas @@ -1425,14 +1425,18 @@ end; procedure TCEMainForm.actFileAddToProjExecute(Sender: TObject); begin - //TODO-cDUB: update 'add file to project' for a DUB project if fDoc = nil then exit; - if fDoc.isProjectSource then exit; - if fNativeProject = nil then exit; + if fDoc.isProjectSource then exit; // TODO: rename this abiguous property name to 'isProjectFile' + if fProjectInterface = nil then exit; // - if fileExists(fDoc.fileName) and (not fDoc.isTemporary) then - fNativeProject.addSource(fDoc.fileName) - else dlgOkInfo('the file has not been added to the project because it does not exist'); + if fProjectInterface.getFormat = pfNative then + begin + if fileExists(fDoc.fileName) and (not fDoc.isTemporary) then + fNativeProject.addSource(fDoc.fileName) + else dlgOkInfo('the file has not been added to the project because it does not exist'); + end else + getMessageDisplay.message('use the DUB project editor to add a source to a DUB project', + nil, amcApp, amkHint); end; procedure TCEMainForm.actFileCloseExecute(Sender: TObject);