procedure TFormSsFWEditor.CornerButton1Click(Sender: TObject);
var
PackageTest: IOTAPackageServices;
I: Integer;
ProjectCreator: TGxProjectCreator;
F: Boolean;
begin
ssFWPM.ssFWP.CreateUnits;
F := False;
PackageTest := (BorlandIDEServices
as IOTAPackageServices);
for I := 0
to PackageTest.GetPackageCount - 1
do
if PackageTest.GetPackageName(I) = '
TestBL'
then // alternate: 'TestBL.bpl'
begin
F := True;
Break;
end;
if not F
then
(BorlandIDEServices
as IOTAModuleServices).CreateModule(TGxProjectCreator.Create)
else
Beep;
exit;
PackageTest := (BorlandIDEServices
as IOTAPackageServices);
for I := 0
to PackageTest.GetPackageCount - 1
do
if PackageTest.GetPackageName(I) = '
ssPackage'
then
exit;
PackageTest.InstallPackage('
ssPackage');
end;
////////////////////////////////////////////
unit ssFWProjectCreator;
interface
uses Windows, ToolsApi;
type
// TProjectWizard = class(TNotifierObject, IOTAMenuWizard, IOTAWizard)
// public
// procedure Execute;
// function GetIDString: string;
// function GetMenuText: string;
// function GetName: string;
// function GetState: TWizardState;
// end;
TGxProjectCreator =
class(TInterfacedObject, IOTACreator, IOTAProjectCreator)
public
// IOTACreator
function GetCreatorType:
string;
function GetExisting: Boolean;
function GetFileSystem:
string;
function GetOwner: IOTAModule;
function GetUnnamed: Boolean;
// IOTAProjectCreator
function GetFileName:
string;
function GetOptionFileName:
string;
function GetShowSource: Boolean;
procedure NewDefaultModule;
function NewOptionSource(
const ProjectName:
string): IOTAFile;
procedure NewProjectResource(
const Project: IOTAProject);
function NewProjectSource(
const ProjectName:
string): IOTAFile;
end;
// procedure Register;
implementation
// procedure Register;
// begin
// RegisterPackageWizard(TProjectWizard.Create);
// end;
// procedure TProjectWizard.Execute;
// begin
// (BorlandIDEServices as IOTAModuleServices).CreateModule(TGxProjectCreator.Create);
// end;
//
// function TProjectWizard.GetIDString: string;
// begin
// Result := 'GX.ProjectCreator';
// end;
//
// function TProjectWizard.GetMenuText: string;
// begin
// Result := '&GX Project Creator';
// end;
//
// function TProjectWizard.GetName: string;
// begin
// Result := 'GX Project Creator';
// end;
//
// function TProjectWizard.GetState: TWizardState;
// begin
// Result := [wsEnabled];
// end;
{ TGxProjectCreator }
function TGxProjectCreator.GetCreatorType:
string;
begin
Result := sPackage;
// Create an application project
end;
function TGxProjectCreator.GetExisting: Boolean;
begin
Result := False;
// Create a new project
end;
function TGxProjectCreator.GetFileName:
string;
begin
Result := '
C:\users\as\Documents\RAD Studio\Projekte\TestBL\' + '
TestBL.dpk';
// Default const
end;
function TGxProjectCreator.GetFileSystem:
string;
begin
Result := '
';
// Default
end;
function TGxProjectCreator.GetOptionFileName:
string;
begin
Result := '
';
// Default
end;
function GetCurrentProjectGroup: IOTAProjectGroup;
var
IModuleServices: IOTAModuleServices;
IModule: IOTAModule;
IProjectGroup: IOTAProjectGroup;
i: Integer;
begin
Result :=
nil;
IModuleServices := BorlandIDEServices
as IOTAModuleServices;
for i := 0
to IModuleServices.ModuleCount - 1
do
begin
IModule := IModuleServices.Modules[i];
if IModule.QueryInterface(IOTAProjectGroup, IProjectGroup) = S_OK
then
begin
Result := IProjectGroup;
Break;
end;
end;
end;
function TGxProjectCreator.GetOwner: IOTAModule;
begin
Result := GetCurrentProjectGroup;
// Owned by current project group
end;
function TGxProjectCreator.GetShowSource: Boolean;
begin
Result := False;
// Show the source in the editor
end;
function TGxProjectCreator.GetUnnamed: Boolean;
begin
Result := False;
// Project needs to be named/saved
end;
procedure TGxProjectCreator.NewDefaultModule;
begin
// No default modules are created
end;
function TGxProjectCreator.NewOptionSource(
const ProjectName:
string): IOTAFile;
begin
Result :=
nil;
// For BCB only
end;
procedure TGxProjectCreator.NewProjectResource(
const Project: IOTAProject);
begin
// No resources needed
end;
function TGxProjectCreator.NewProjectSource(
const ProjectName:
string): IOTAFile;
begin
// Create the default source code for a new application
Result :=
nil;
end;
end.