2020-05-28 22:35:45 +02:00
|
|
|
// ***************************************************************************
|
|
|
|
//
|
|
|
|
// Delphi MVC Framework
|
|
|
|
//
|
2022-01-04 15:44:47 +01:00
|
|
|
// Copyright (c) 2010-2022 Daniele Teti and the DMVCFramework Team
|
2020-05-28 22:35:45 +02:00
|
|
|
//
|
|
|
|
// https://github.com/danieleteti/delphimvcframework
|
|
|
|
//
|
|
|
|
// ***************************************************************************
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
//
|
|
|
|
// ***************************************************************************
|
|
|
|
//
|
|
|
|
// This IDE expert is based off of the one included with the DUnitX
|
|
|
|
// project. Original source by Robert Love. Adapted by Nick Hodges.
|
|
|
|
//
|
|
|
|
// The DUnitX project is run by Vincent Parrett and can be found at:
|
|
|
|
//
|
|
|
|
// https://github.com/VSoftTechnologies/DUnitX
|
|
|
|
// ***************************************************************************
|
2016-02-23 01:41:13 +01:00
|
|
|
|
|
|
|
unit DMVC.Expert.NewUnitWizardEx;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
ToolsApi,
|
|
|
|
VCL.Graphics,
|
|
|
|
PlatformAPI;
|
|
|
|
|
|
|
|
type
|
|
|
|
TDMVCNewUnitWizard = class
|
|
|
|
public
|
|
|
|
class procedure RegisterDMVCNewUnitWizard(const APersonality: string);
|
|
|
|
end;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
uses
|
|
|
|
DMVC.Expert.Forms.NewUnitWizard,
|
|
|
|
DMVC.Expert.CodeGen.NewControllerUnit,
|
2022-07-25 10:36:30 +02:00
|
|
|
VCL.Controls,
|
|
|
|
VCL.Forms,
|
2017-05-19 00:47:03 +02:00
|
|
|
WinApi.Windows,
|
2016-02-23 01:41:13 +01:00
|
|
|
ExpertsRepository;
|
|
|
|
|
|
|
|
resourcestring
|
2022-07-25 10:36:30 +02:00
|
|
|
sNewDMVCUnitCaption = 'DelphiMVCFramework Controller';
|
|
|
|
sNewDMVCProjectHint = 'Create New DelphiMVCFramework Controller Unit';
|
2016-02-23 01:41:13 +01:00
|
|
|
|
2022-07-25 10:36:30 +02:00
|
|
|
class procedure TDMVCNewUnitWizard.RegisterDMVCNewUnitWizard(const APersonality: string);
|
2016-02-23 01:41:13 +01:00
|
|
|
begin
|
2022-07-25 10:36:30 +02:00
|
|
|
RegisterPackageWizard(TExpertsRepositoryProjectWizardWithProc.Create(APersonality, sNewDMVCProjectHint,
|
|
|
|
sNewDMVCUnitCaption, 'DMVC.Wizard.NewUnitWizard', // do not localize
|
|
|
|
'DMVCFramework', 'DMVCFramework Team - https://github.com/danieleteti/delphimvcframework', // do not localize
|
2016-02-23 01:41:13 +01:00
|
|
|
procedure
|
|
|
|
var
|
2022-07-25 10:36:30 +02:00
|
|
|
WizardForm: TfrmDMVCNewUnit;
|
|
|
|
ModuleServices: IOTAModuleServices;
|
|
|
|
Project: IOTAProject;
|
|
|
|
ControllerUnit: IOTAModule;
|
2016-02-23 01:41:13 +01:00
|
|
|
begin
|
|
|
|
WizardForm := TfrmDMVCNewUnit.Create(Application);
|
|
|
|
try
|
|
|
|
if WizardForm.ShowModal = mrOk then
|
|
|
|
begin
|
|
|
|
ModuleServices := (BorlandIDEServices as IOTAModuleServices);
|
2022-07-25 10:36:30 +02:00
|
|
|
Project := GetActiveProject;
|
2016-02-23 01:41:13 +01:00
|
|
|
ControllerUnit := ModuleServices.CreateModule(
|
2022-07-25 10:36:30 +02:00
|
|
|
TNewControllerUnitEx.Create(
|
|
|
|
WizardForm.CreateIndexMethod,
|
|
|
|
WizardForm.CreateCRUDMethods,
|
|
|
|
WizardForm.CreateActionFiltersMethods,
|
|
|
|
WizardForm.ControllerClassName,
|
|
|
|
APersonality));
|
2016-02-23 01:41:13 +01:00
|
|
|
if Project <> nil then
|
|
|
|
begin
|
2022-07-25 10:36:30 +02:00
|
|
|
Project.AddFile(ControllerUnit.FileName, true);
|
2016-02-23 01:41:13 +01:00
|
|
|
end;
|
|
|
|
end;
|
|
|
|
finally
|
|
|
|
WizardForm.Free;
|
|
|
|
end;
|
|
|
|
end,
|
2022-07-25 10:36:30 +02:00
|
|
|
function: Cardinal
|
|
|
|
begin
|
|
|
|
Result := LoadIcon(HInstance, 'DMVCNewUnitIcon');
|
|
|
|
end, TArray<string>.Create(cWin32Platform, cWin64Platform), nil));
|
|
|
|
end;
|
2016-02-23 01:41:13 +01:00
|
|
|
|
|
|
|
end.
|