|
|
@ -21,27 +21,24 @@ class ACommandFeature extends Command |
|
|
|
dependson(PendingConfigsTool); |
|
|
|
dependson(PendingConfigsTool); |
|
|
|
|
|
|
|
|
|
|
|
var private class<Feature> selectedFeatureClass; |
|
|
|
var private class<Feature> selectedFeatureClass; |
|
|
|
|
|
|
|
var private Text selectedFeatureName; |
|
|
|
var private Text selectedConfigName; |
|
|
|
var private Text selectedConfigName; |
|
|
|
|
|
|
|
|
|
|
|
var private PendingConfigsTool pendingConfigs; |
|
|
|
var private PendingConfigsTool pendingConfigs; |
|
|
|
var private ACommandFeature_Announcer announcer; |
|
|
|
var private ACommandFeature_Announcer announcer; |
|
|
|
|
|
|
|
|
|
|
|
protected function Constructor() |
|
|
|
protected function Constructor() { |
|
|
|
{ |
|
|
|
pendingConfigs = PendingConfigsTool(_.memory.Allocate(class'PendingConfigsTool')); |
|
|
|
pendingConfigs = |
|
|
|
|
|
|
|
PendingConfigsTool(_.memory.Allocate(class'PendingConfigsTool')); |
|
|
|
|
|
|
|
super.Constructor(); |
|
|
|
super.Constructor(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function Finalizer() |
|
|
|
protected function Finalizer() { |
|
|
|
{ |
|
|
|
|
|
|
|
_.memory.Free(announcer); |
|
|
|
_.memory.Free(announcer); |
|
|
|
_.memory.Free(pendingConfigs); |
|
|
|
_.memory.Free(pendingConfigs); |
|
|
|
super.Finalizer(); |
|
|
|
super.Finalizer(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function BuildData(CommandDataBuilder builder) |
|
|
|
protected function BuildData(CommandDataBuilder builder) { |
|
|
|
{ |
|
|
|
|
|
|
|
builder.Group(P("admin")); |
|
|
|
builder.Group(P("admin")); |
|
|
|
builder.Summary(P("Managing features.")); |
|
|
|
builder.Summary(P("Managing features.")); |
|
|
|
builder.Describe(P("Command for managing features and their configs.")); |
|
|
|
builder.Describe(P("Command for managing features and their configs.")); |
|
|
@ -113,60 +110,52 @@ protected function Executed( |
|
|
|
SelectFeatureAndConfig(arguments); |
|
|
|
SelectFeatureAndConfig(arguments); |
|
|
|
if (arguments.subCommandName.IsEmpty()) { |
|
|
|
if (arguments.subCommandName.IsEmpty()) { |
|
|
|
ShowAllFeatures(); |
|
|
|
ShowAllFeatures(); |
|
|
|
} |
|
|
|
} else if (arguments.subCommandName.Compare(P("enable"))) { |
|
|
|
else if (arguments.subCommandName.Compare(P("enable"))) { |
|
|
|
|
|
|
|
EnableFeature(); |
|
|
|
EnableFeature(); |
|
|
|
} |
|
|
|
} else if (arguments.subCommandName.Compare(P("disable"))) { |
|
|
|
else if (arguments.subCommandName.Compare(P("disable"))) { |
|
|
|
|
|
|
|
DisableFeature(); |
|
|
|
DisableFeature(); |
|
|
|
} |
|
|
|
} else if (arguments.subCommandName.Compare(P("showconf"))) { |
|
|
|
else if (arguments.subCommandName.Compare(P("showconf"))) { |
|
|
|
|
|
|
|
ShowSelectedConfigs(allFlag); |
|
|
|
ShowSelectedConfigs(allFlag); |
|
|
|
} |
|
|
|
} else if (arguments.subCommandName.Compare(P("editconf"))) { |
|
|
|
else if (arguments.subCommandName.Compare(P("editconf"))) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
EditFeatureConfig( |
|
|
|
EditFeatureConfig( |
|
|
|
arguments.parameters.GetText(P("variable_path")), |
|
|
|
arguments.parameters.GetText(P("variable_path")), |
|
|
|
arguments.parameters.GetItem(P("value")), |
|
|
|
arguments.parameters.GetItem(P("value")), |
|
|
|
saveFlag); |
|
|
|
saveFlag); |
|
|
|
} |
|
|
|
} else if (arguments.subCommandName.Compare(P("saveconf"))) { |
|
|
|
else if (arguments.subCommandName.Compare(P("saveconf"))) { |
|
|
|
|
|
|
|
SaveFeatureConfig(); |
|
|
|
SaveFeatureConfig(); |
|
|
|
} |
|
|
|
} else if (arguments.subCommandName.Compare(P("newconf"))) { |
|
|
|
else if (arguments.subCommandName.Compare(P("newconf"))) { |
|
|
|
|
|
|
|
NewFeatureConfig(); |
|
|
|
NewFeatureConfig(); |
|
|
|
} |
|
|
|
} else if (arguments.subCommandName.Compare(P("removeconf"))) { |
|
|
|
else if (arguments.subCommandName.Compare(P("removeconf"))) { |
|
|
|
|
|
|
|
RemoveFeatureConfig(); |
|
|
|
RemoveFeatureConfig(); |
|
|
|
} |
|
|
|
} else if (arguments.subCommandName.Compare(P("autoconf"))) { |
|
|
|
else if (arguments.subCommandName.Compare(P("autoconf"))) { |
|
|
|
|
|
|
|
SetAutoFeatureConfig(); |
|
|
|
SetAutoFeatureConfig(); |
|
|
|
} |
|
|
|
} |
|
|
|
_.memory.Free(selectedConfigName); |
|
|
|
_.memory.Free2(selectedConfigName, selectedFeatureName); |
|
|
|
selectedConfigName = none; |
|
|
|
selectedConfigName = none; |
|
|
|
|
|
|
|
selectedFeatureName = none; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function SelectFeatureAndConfig(CallData arguments) |
|
|
|
protected function SelectFeatureAndConfig(CallData arguments) { |
|
|
|
{ |
|
|
|
|
|
|
|
local Text featureClassName, userGivenConfigName; |
|
|
|
local Text featureClassName, userGivenConfigName; |
|
|
|
|
|
|
|
|
|
|
|
featureClassName = arguments.parameters.GetText(P("feature")); |
|
|
|
selectedFeatureName = arguments.parameters.GetTextBy(P("/feature/alias")); |
|
|
|
|
|
|
|
featureClassName = arguments.parameters.GetTextBy(P("/feature/value")); |
|
|
|
selectedFeatureClass = LoadFeatureClass(featureClassName); |
|
|
|
selectedFeatureClass = LoadFeatureClass(featureClassName); |
|
|
|
if (selectedFeatureClass == none && !arguments.subCommandName.IsEmpty()) { |
|
|
|
if (selectedFeatureClass == none && !arguments.subCommandName.IsEmpty()) { |
|
|
|
|
|
|
|
_.memory.Free(selectedFeatureName); |
|
|
|
|
|
|
|
selectedFeatureName = none; |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
_.memory.Free(featureClassName); |
|
|
|
_.memory.Free(featureClassName); |
|
|
|
userGivenConfigName = arguments.parameters.GetText(P("config")); |
|
|
|
userGivenConfigName = arguments.parameters.GetText(P("config")); |
|
|
|
if (userGivenConfigName != none) |
|
|
|
if (userGivenConfigName != none) { |
|
|
|
{ |
|
|
|
|
|
|
|
selectedConfigName = userGivenConfigName.LowerCopy(); |
|
|
|
selectedConfigName = userGivenConfigName.LowerCopy(); |
|
|
|
userGivenConfigName.FreeSelf(); |
|
|
|
userGivenConfigName.FreeSelf(); |
|
|
|
} |
|
|
|
} |
|
|
|
pendingConfigs.SelectConfig(selectedFeatureClass, selectedConfigName); |
|
|
|
pendingConfigs.SelectConfig(selectedFeatureClass, selectedConfigName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function EnableFeature() |
|
|
|
protected function EnableFeature() { |
|
|
|
{ |
|
|
|
|
|
|
|
local bool wasEnabled; |
|
|
|
local bool wasEnabled; |
|
|
|
local Text oldConfig, newConfig; |
|
|
|
local Text oldConfig, newConfig; |
|
|
|
local Feature instance; |
|
|
|
local Feature instance; |
|
|
@ -175,59 +164,50 @@ protected function EnableFeature() |
|
|
|
oldConfig = selectedFeatureClass.static.GetCurrentConfig(); |
|
|
|
oldConfig = selectedFeatureClass.static.GetCurrentConfig(); |
|
|
|
newConfig = PickConfigBasedOnParameter(); |
|
|
|
newConfig = PickConfigBasedOnParameter(); |
|
|
|
// Already enabled with the same config! |
|
|
|
// Already enabled with the same config! |
|
|
|
if (oldConfig != none && oldConfig.Compare(newConfig, SCASE_INSENSITIVE)) |
|
|
|
if (oldConfig != none && oldConfig.Compare(newConfig, SCASE_INSENSITIVE)) { |
|
|
|
{ |
|
|
|
announcer.AnnounceFailedAlreadyEnabled(selectedFeatureName, newConfig); |
|
|
|
announcer.AnnounceFailedAlreadyEnabled(selectedFeatureClass, newConfig); |
|
|
|
|
|
|
|
_.memory.Free(newConfig); |
|
|
|
_.memory.Free(newConfig); |
|
|
|
_.memory.Free(oldConfig); |
|
|
|
_.memory.Free(oldConfig); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
// Try enabling and report the result |
|
|
|
// Try enabling and report the result |
|
|
|
instance = selectedFeatureClass.static.EnableMe(newConfig); |
|
|
|
instance = selectedFeatureClass.static.EnableMe(newConfig); |
|
|
|
if (instance == none) |
|
|
|
if (instance == none) { |
|
|
|
{ |
|
|
|
|
|
|
|
announcer.AnnounceFailedCannotEnableFeature( |
|
|
|
announcer.AnnounceFailedCannotEnableFeature( |
|
|
|
selectedFeatureClass, |
|
|
|
selectedFeatureName, |
|
|
|
newConfig); |
|
|
|
newConfig); |
|
|
|
} |
|
|
|
} else if (wasEnabled) { |
|
|
|
else if (wasEnabled) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
announcer.AnnounceSwappedConfig( |
|
|
|
announcer.AnnounceSwappedConfig( |
|
|
|
selectedFeatureClass, |
|
|
|
selectedFeatureName, |
|
|
|
oldConfig, |
|
|
|
oldConfig, |
|
|
|
newConfig); |
|
|
|
newConfig); |
|
|
|
} |
|
|
|
} else { |
|
|
|
else { |
|
|
|
announcer.AnnounceEnabledFeature(selectedFeatureName, newConfig); |
|
|
|
announcer.AnnounceEnabledFeature(selectedFeatureClass, newConfig); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
_.memory.Free(newConfig); |
|
|
|
_.memory.Free(newConfig); |
|
|
|
_.memory.Free(oldConfig); |
|
|
|
_.memory.Free(oldConfig); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function DisableFeature() |
|
|
|
protected function DisableFeature() { |
|
|
|
{ |
|
|
|
if (!selectedFeatureClass.static.IsEnabled()) { |
|
|
|
if (!selectedFeatureClass.static.IsEnabled()) |
|
|
|
announcer.AnnounceFailedAlreadyDisabled(selectedFeatureName); |
|
|
|
{ |
|
|
|
|
|
|
|
announcer.AnnounceFailedAlreadyDisabled(selectedFeatureClass); |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
selectedFeatureClass.static.DisableMe(); |
|
|
|
selectedFeatureClass.static.DisableMe(); |
|
|
|
// It is possible that this command itself is destroyed after above command |
|
|
|
// It is possible that this command itself is destroyed after above command |
|
|
|
// so do the check just in case |
|
|
|
// so do the check just in case |
|
|
|
if (IsAllocated()) { |
|
|
|
if (IsAllocated()) { |
|
|
|
announcer.AnnounceDisabledFeature(selectedFeatureClass); |
|
|
|
announcer.AnnounceDisabledFeature(selectedFeatureName); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function ShowSelectedConfigs(bool showAllFeatures) |
|
|
|
protected function ShowSelectedConfigs(bool showAllFeatures) { |
|
|
|
{ |
|
|
|
|
|
|
|
local int i; |
|
|
|
local int i; |
|
|
|
local array<Text> availableConfigs; |
|
|
|
local array<Text> availableConfigs; |
|
|
|
local MutableText configList; |
|
|
|
local MutableText configList; |
|
|
|
local class<FeatureConfig> configClass; |
|
|
|
local class<FeatureConfig> configClass; |
|
|
|
|
|
|
|
|
|
|
|
if (showAllFeatures) |
|
|
|
if (showAllFeatures) { |
|
|
|
{ |
|
|
|
|
|
|
|
configClass = selectedFeatureClass.default.configClass; |
|
|
|
configClass = selectedFeatureClass.default.configClass; |
|
|
|
if (configClass != none) { |
|
|
|
if (configClass != none) { |
|
|
|
availableConfigs = configClass.static.AvailableConfigs(); |
|
|
|
availableConfigs = configClass.static.AvailableConfigs(); |
|
|
@ -238,8 +218,7 @@ protected function ShowSelectedConfigs(bool showAllFeatures) |
|
|
|
_.memory.FreeMany(availableConfigs); |
|
|
|
_.memory.FreeMany(availableConfigs); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (selectedConfigName != none) |
|
|
|
if (selectedConfigName != none) { |
|
|
|
{ |
|
|
|
|
|
|
|
ShowFeatureConfig(selectedConfigName); |
|
|
|
ShowFeatureConfig(selectedConfigName); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -251,8 +230,7 @@ protected function ShowSelectedConfigs(bool showAllFeatures) |
|
|
|
_.memory.Free(configList); |
|
|
|
_.memory.Free(configList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function ShowFeatureConfig(BaseText configName) |
|
|
|
protected function ShowFeatureConfig(BaseText configName) { |
|
|
|
{ |
|
|
|
|
|
|
|
local MutableText dataAsJSON; |
|
|
|
local MutableText dataAsJSON; |
|
|
|
local HashTable currentData, pendingData; |
|
|
|
local HashTable currentData, pendingData; |
|
|
|
|
|
|
|
|
|
|
@ -260,26 +238,24 @@ protected function ShowFeatureConfig(BaseText configName) |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
currentData = GetCurrentConfigData(configName); |
|
|
|
currentData = GetCurrentConfigData(configName); |
|
|
|
if (currentData == none) |
|
|
|
if (currentData == none) { |
|
|
|
{ |
|
|
|
|
|
|
|
announcer.AnnounceFailedNoDataForConfig( |
|
|
|
announcer.AnnounceFailedNoDataForConfig( |
|
|
|
selectedFeatureClass, |
|
|
|
selectedFeatureName, |
|
|
|
configName); |
|
|
|
configName); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
// Display current data |
|
|
|
// Display current data |
|
|
|
dataAsJSON = _.json.PrettyPrint(currentData); |
|
|
|
dataAsJSON = _.json.PrettyPrint(currentData); |
|
|
|
announcer.AnnounceCurrentConfig(selectedFeatureClass, configName); |
|
|
|
announcer.AnnounceCurrentConfig(selectedFeatureName, configName); |
|
|
|
callerConsole.Flush().WriteLine(dataAsJSON); |
|
|
|
callerConsole.Flush().WriteLine(dataAsJSON); |
|
|
|
_.memory.Free(dataAsJSON); |
|
|
|
_.memory.Free(dataAsJSON); |
|
|
|
// Display pending data |
|
|
|
// Display pending data |
|
|
|
pendingConfigs.SelectConfig(selectedFeatureClass, configName); |
|
|
|
pendingConfigs.SelectConfig(selectedFeatureClass, configName); |
|
|
|
pendingData = pendingConfigs.GetPendingConfigData(); |
|
|
|
pendingData = pendingConfigs.GetPendingConfigData(); |
|
|
|
if (pendingData != none) |
|
|
|
if (pendingData != none) { |
|
|
|
{ |
|
|
|
|
|
|
|
dataAsJSON = _.json.PrettyPrint(pendingData); |
|
|
|
dataAsJSON = _.json.PrettyPrint(pendingData); |
|
|
|
announcer.AnnouncePendingConfig( |
|
|
|
announcer.AnnouncePendingConfig( |
|
|
|
selectedFeatureClass, |
|
|
|
selectedFeatureName, |
|
|
|
configName); |
|
|
|
configName); |
|
|
|
callerConsole.Flush().WriteLine(dataAsJSON); |
|
|
|
callerConsole.Flush().WriteLine(dataAsJSON); |
|
|
|
_.memory.Free(dataAsJSON); |
|
|
|
_.memory.Free(dataAsJSON); |
|
|
@ -288,20 +264,17 @@ protected function ShowFeatureConfig(BaseText configName) |
|
|
|
_.memory.Free(currentData); |
|
|
|
_.memory.Free(currentData); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function Text PickConfigBasedOnParameter() |
|
|
|
protected function Text PickConfigBasedOnParameter() { |
|
|
|
{ |
|
|
|
|
|
|
|
local Text resolvedConfig; |
|
|
|
local Text resolvedConfig; |
|
|
|
local class<FeatureConfig> configClass; |
|
|
|
local class<FeatureConfig> configClass; |
|
|
|
|
|
|
|
|
|
|
|
configClass = selectedFeatureClass.default.configClass; |
|
|
|
configClass = selectedFeatureClass.default.configClass; |
|
|
|
if (configClass == none) |
|
|
|
if (configClass == none) { |
|
|
|
{ |
|
|
|
announcer.AnnounceFailedNoConfigClass(selectedFeatureName); |
|
|
|
announcer.AnnounceFailedNoConfigClass(selectedFeatureClass); |
|
|
|
|
|
|
|
return none; |
|
|
|
return none; |
|
|
|
} |
|
|
|
} |
|
|
|
// If config was specified - simply check that it exists |
|
|
|
// If config was specified - simply check that it exists |
|
|
|
if (selectedConfigName != none) |
|
|
|
if (selectedConfigName != none) { |
|
|
|
{ |
|
|
|
|
|
|
|
if (configClass.static.Exists(selectedConfigName)) { |
|
|
|
if (configClass.static.Exists(selectedConfigName)) { |
|
|
|
return selectedConfigName.Copy(); |
|
|
|
return selectedConfigName.Copy(); |
|
|
|
} |
|
|
|
} |
|
|
@ -311,13 +284,12 @@ protected function Text PickConfigBasedOnParameter() |
|
|
|
// If it wasn't specified - try auto config instead |
|
|
|
// If it wasn't specified - try auto config instead |
|
|
|
resolvedConfig = configClass.static.GetAutoEnabledConfig(); |
|
|
|
resolvedConfig = configClass.static.GetAutoEnabledConfig(); |
|
|
|
if (resolvedConfig == none) { |
|
|
|
if (resolvedConfig == none) { |
|
|
|
announcer.AnnounceFailedNoConfigProvided(selectedFeatureClass); |
|
|
|
announcer.AnnounceFailedNoConfigProvided(selectedFeatureName); |
|
|
|
} |
|
|
|
} |
|
|
|
return resolvedConfig; |
|
|
|
return resolvedConfig; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function class<Feature> LoadFeatureClass(BaseText featureClassName) |
|
|
|
protected function class<Feature> LoadFeatureClass(BaseText featureClassName) { |
|
|
|
{ |
|
|
|
|
|
|
|
local class<Feature> featureClass; |
|
|
|
local class<Feature> featureClass; |
|
|
|
|
|
|
|
|
|
|
|
if (featureClassName == none) { |
|
|
|
if (featureClassName == none) { |
|
|
@ -330,10 +302,10 @@ protected function class<Feature> LoadFeatureClass(BaseText featureClassName) |
|
|
|
return featureClass; |
|
|
|
return featureClass; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function ShowAllFeatures() |
|
|
|
protected function ShowAllFeatures() { |
|
|
|
{ |
|
|
|
|
|
|
|
local int i; |
|
|
|
local int i; |
|
|
|
local array< class<Feature> > availableFeatures; |
|
|
|
local array< class<Feature> > availableFeatures; |
|
|
|
|
|
|
|
|
|
|
|
availableFeatures = _.environment.GetAvailableFeatures(); |
|
|
|
availableFeatures = _.environment.GetAvailableFeatures(); |
|
|
|
for (i = 0; i < availableFeatures.length; i ++) { |
|
|
|
for (i = 0; i < availableFeatures.length; i ++) { |
|
|
|
ShowFeature(availableFeatures[i]); |
|
|
|
ShowFeature(availableFeatures[i]); |
|
|
@ -366,10 +338,9 @@ protected function ShowFeature(class<Feature> featureClass) |
|
|
|
_.memory.Free(configList); |
|
|
|
_.memory.Free(configList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function MutableText PrintConfigList(class<Feature> featureClass) |
|
|
|
protected function MutableText PrintConfigList(class<Feature> featureClass) { |
|
|
|
{ |
|
|
|
|
|
|
|
local int i; |
|
|
|
local int i; |
|
|
|
local Text autoConfig; |
|
|
|
local Text autoConfig, enabledConfig; |
|
|
|
local ListBuilder configList; |
|
|
|
local ListBuilder configList; |
|
|
|
local MutableText result, nextConfig; |
|
|
|
local MutableText result, nextConfig; |
|
|
|
local array<Text> availableConfigs; |
|
|
|
local array<Text> availableConfigs; |
|
|
@ -380,31 +351,34 @@ protected function MutableText PrintConfigList(class<Feature> featureClass) |
|
|
|
if (configClass == none) return none; |
|
|
|
if (configClass == none) return none; |
|
|
|
|
|
|
|
|
|
|
|
availableConfigs = configClass.static.AvailableConfigs(); |
|
|
|
availableConfigs = configClass.static.AvailableConfigs(); |
|
|
|
|
|
|
|
enabledConfig = featureClass.static.GetCurrentConfig(); |
|
|
|
autoConfig = configClass.static.GetAutoEnabledConfig(); |
|
|
|
autoConfig = configClass.static.GetAutoEnabledConfig(); |
|
|
|
configList = ListBuilder(_.memory.Allocate(class'ListBuilder')); |
|
|
|
configList = ListBuilder(_.memory.Allocate(class'ListBuilder')); |
|
|
|
for (i = 0; i < availableConfigs.length; i += 1) |
|
|
|
for (i = 0; i < availableConfigs.length; i += 1) { |
|
|
|
{ |
|
|
|
|
|
|
|
nextConfig = availableConfigs[i].MutableCopy(); |
|
|
|
nextConfig = availableConfigs[i].MutableCopy(); |
|
|
|
|
|
|
|
if (enabledConfig != none && enabledConfig.Compare(nextConfig, SCASE_INSENSITIVE)) { |
|
|
|
|
|
|
|
nextConfig.ChangeDefaultColor(_.color.TextPositive); |
|
|
|
|
|
|
|
} |
|
|
|
if (pendingConfigs.HasPendingConfigFor(featureClass, nextConfig)) { |
|
|
|
if (pendingConfigs.HasPendingConfigFor(featureClass, nextConfig)) { |
|
|
|
nextConfig.Append(F("{$TextEmphasis *}")); |
|
|
|
nextConfig.Append(F("{$TextEmphasis *}")); |
|
|
|
} |
|
|
|
} |
|
|
|
configList.Item(nextConfig); |
|
|
|
configList.Item(nextConfig); |
|
|
|
_.memory.Free(nextConfig); |
|
|
|
_.memory.Free(nextConfig); |
|
|
|
if ( autoConfig != none |
|
|
|
if (autoConfig != none && autoConfig.Compare(availableConfigs[i], SCASE_INSENSITIVE)) { |
|
|
|
&& autoConfig.Compare(availableConfigs[i], SCASE_INSENSITIVE)) |
|
|
|
if (autoConfig.Compare(enabledConfig, SCASE_INSENSITIVE)) { |
|
|
|
{ |
|
|
|
|
|
|
|
configList.Comment(F("{$TextPositive auto enabled}")); |
|
|
|
configList.Comment(F("{$TextPositive auto enabled}")); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
configList.Comment(F("{$TextNegative auto enabled}")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
result = configList.GetMutable(); |
|
|
|
result = configList.GetMutable(); |
|
|
|
_.memory.Free(configList); |
|
|
|
_.memory.Free3(configList, autoConfig, enabledConfig); |
|
|
|
_.memory.Free(autoConfig); |
|
|
|
|
|
|
|
_.memory.FreeMany(availableConfigs); |
|
|
|
_.memory.FreeMany(availableConfigs); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function MutableText PrettyPrintValueAt(BaseText pathToValue) |
|
|
|
protected function MutableText PrettyPrintValueAt(BaseText pathToValue) { |
|
|
|
{ |
|
|
|
|
|
|
|
local MutableText printedValue; |
|
|
|
local MutableText printedValue; |
|
|
|
local AcediaObject value; |
|
|
|
local AcediaObject value; |
|
|
|
local HashTable relevantData; |
|
|
|
local HashTable relevantData; |
|
|
@ -416,8 +390,7 @@ protected function MutableText PrettyPrintValueAt(BaseText pathToValue) |
|
|
|
if (relevantData != none) { |
|
|
|
if (relevantData != none) { |
|
|
|
value = relevantData.GetItemBy(pathToValue); |
|
|
|
value = relevantData.GetItemBy(pathToValue); |
|
|
|
} |
|
|
|
} |
|
|
|
if (value != none) |
|
|
|
if (value != none) { |
|
|
|
{ |
|
|
|
|
|
|
|
printedValue = _.json.PrettyPrint(value); |
|
|
|
printedValue = _.json.PrettyPrint(value); |
|
|
|
_.memory.Free(value); |
|
|
|
_.memory.Free(value); |
|
|
|
} |
|
|
|
} |
|
|
@ -425,11 +398,7 @@ protected function MutableText PrettyPrintValueAt(BaseText pathToValue) |
|
|
|
return printedValue; |
|
|
|
return printedValue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function EditFeatureConfig( |
|
|
|
protected function EditFeatureConfig(BaseText pathToValue, AcediaObject newValue, bool saveConfig) { |
|
|
|
BaseText pathToValue, |
|
|
|
|
|
|
|
AcediaObject newValue, |
|
|
|
|
|
|
|
bool saveConfig) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
local MutableText printedOldValue; |
|
|
|
local MutableText printedOldValue; |
|
|
|
local MutableText printedNewValue; |
|
|
|
local MutableText printedNewValue; |
|
|
|
local PendingConfigsTool.PendingConfigToolResult error; |
|
|
|
local PendingConfigsTool.PendingConfigToolResult error; |
|
|
@ -447,26 +416,20 @@ protected function EditFeatureConfig( |
|
|
|
} |
|
|
|
} |
|
|
|
else if (error == PCTE_ExpectedObject) { |
|
|
|
else if (error == PCTE_ExpectedObject) { |
|
|
|
announcer.AnnounceFailedExpectedObject(); |
|
|
|
announcer.AnnounceFailedExpectedObject(); |
|
|
|
} |
|
|
|
} else if (error == PCTE_BadPointer) { |
|
|
|
else if (error == PCTE_BadPointer) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
announcer.AnnounceFailedBadPointer( |
|
|
|
announcer.AnnounceFailedBadPointer( |
|
|
|
selectedFeatureClass, |
|
|
|
selectedFeatureName, |
|
|
|
selectedConfigName, |
|
|
|
selectedConfigName, |
|
|
|
pathToValue); |
|
|
|
pathToValue); |
|
|
|
} |
|
|
|
} else if (printedOldValue == none) { |
|
|
|
else if (printedOldValue == none) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
announcer.AnnounceConfigNewValue( |
|
|
|
announcer.AnnounceConfigNewValue( |
|
|
|
selectedFeatureClass, |
|
|
|
selectedFeatureName, |
|
|
|
selectedConfigName, |
|
|
|
selectedConfigName, |
|
|
|
pathToValue, |
|
|
|
pathToValue, |
|
|
|
printedNewValue); |
|
|
|
printedNewValue); |
|
|
|
} |
|
|
|
} else { |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
announcer.AnnounceConfigEdited( |
|
|
|
announcer.AnnounceConfigEdited( |
|
|
|
selectedFeatureClass, |
|
|
|
selectedFeatureName, |
|
|
|
selectedConfigName, |
|
|
|
selectedConfigName, |
|
|
|
pathToValue, |
|
|
|
pathToValue, |
|
|
|
printedOldValue, |
|
|
|
printedOldValue, |
|
|
@ -481,21 +444,18 @@ protected function EditFeatureConfig( |
|
|
|
_.memory.Free(newValue); |
|
|
|
_.memory.Free(newValue); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function SaveFeatureConfig() |
|
|
|
protected function SaveFeatureConfig() { |
|
|
|
{ |
|
|
|
|
|
|
|
local BaseText enabledConfigName; |
|
|
|
local BaseText enabledConfigName; |
|
|
|
local HashTable pendingData; |
|
|
|
local HashTable pendingData; |
|
|
|
local class<FeatureConfig> configClass; |
|
|
|
local class<FeatureConfig> configClass; |
|
|
|
|
|
|
|
|
|
|
|
configClass = selectedFeatureClass.default.configClass; |
|
|
|
configClass = selectedFeatureClass.default.configClass; |
|
|
|
if (configClass == none) |
|
|
|
if (configClass == none) { |
|
|
|
{ |
|
|
|
announcer.AnnounceFailedNoConfigClass(selectedFeatureName); |
|
|
|
announcer.AnnounceFailedNoConfigClass(selectedFeatureClass); |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
pendingData = pendingConfigs.GetPendingConfigData(); |
|
|
|
pendingData = pendingConfigs.GetPendingConfigData(); |
|
|
|
if (pendingData == none) |
|
|
|
if (pendingData == none) { |
|
|
|
{ |
|
|
|
|
|
|
|
announcer.AnnounceFailedPendingConfigMissing(selectedConfigName); |
|
|
|
announcer.AnnounceFailedPendingConfigMissing(selectedConfigName); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -504,13 +464,11 @@ protected function SaveFeatureConfig() |
|
|
|
configClass.static.SaveData(selectedConfigName, pendingData); |
|
|
|
configClass.static.SaveData(selectedConfigName, pendingData); |
|
|
|
// Re-apply config if it is active? |
|
|
|
// Re-apply config if it is active? |
|
|
|
enabledConfigName = selectedFeatureClass.static.GetCurrentConfig(); |
|
|
|
enabledConfigName = selectedFeatureClass.static.GetCurrentConfig(); |
|
|
|
if (selectedConfigName.Compare(enabledConfigName, SCASE_INSENSITIVE)) |
|
|
|
if (selectedConfigName.Compare(enabledConfigName, SCASE_INSENSITIVE)) { |
|
|
|
{ |
|
|
|
|
|
|
|
selectedFeatureClass.static.EnableMe(selectedConfigName); |
|
|
|
selectedFeatureClass.static.EnableMe(selectedConfigName); |
|
|
|
announcer.AnnouncePublicPendingConfigSaved(selectedFeatureClass); |
|
|
|
announcer.AnnouncePublicPendingConfigSaved(selectedFeatureName); |
|
|
|
} |
|
|
|
} else { |
|
|
|
else { |
|
|
|
announcer.AnnouncePrivatePendingConfigSaved(selectedFeatureName, selectedConfigName); |
|
|
|
announcer.AnnouncePrivatePendingConfigSaved(selectedFeatureClass); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
_.memory.Free(enabledConfigName); |
|
|
|
_.memory.Free(enabledConfigName); |
|
|
|
pendingData.FreeSelf(); |
|
|
|
pendingData.FreeSelf(); |
|
|
@ -518,125 +476,101 @@ protected function SaveFeatureConfig() |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function NewFeatureConfig() |
|
|
|
protected function NewFeatureConfig() { |
|
|
|
{ |
|
|
|
|
|
|
|
local BaseText enabledConfigName; |
|
|
|
local BaseText enabledConfigName; |
|
|
|
local class<FeatureConfig> configClass; |
|
|
|
local class<FeatureConfig> configClass; |
|
|
|
|
|
|
|
|
|
|
|
configClass = selectedFeatureClass.default.configClass; |
|
|
|
configClass = selectedFeatureClass.default.configClass; |
|
|
|
if (configClass == none) |
|
|
|
if (configClass == none) { |
|
|
|
{ |
|
|
|
announcer.AnnounceFailedNoConfigClass(selectedFeatureName); |
|
|
|
announcer.AnnounceFailedNoConfigClass(selectedFeatureClass); |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (configClass.static.Exists(selectedConfigName)) |
|
|
|
if (configClass.static.Exists(selectedConfigName)) { |
|
|
|
{ |
|
|
|
announcer.AnnounceFailedConfigAlreadyExists(selectedFeatureName, selectedConfigName); |
|
|
|
announcer.AnnounceFailedConfigAlreadyExists( |
|
|
|
|
|
|
|
selectedFeatureClass, |
|
|
|
|
|
|
|
selectedConfigName); |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!configClass.static.NewConfig(selectedConfigName)) |
|
|
|
if (!configClass.static.NewConfig(selectedConfigName)) { |
|
|
|
{ |
|
|
|
|
|
|
|
announcer.AnnounceFailedBadConfigName(selectedConfigName); |
|
|
|
announcer.AnnounceFailedBadConfigName(selectedConfigName); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
enabledConfigName = selectedFeatureClass.static.GetCurrentConfig(); |
|
|
|
enabledConfigName = selectedFeatureClass.static.GetCurrentConfig(); |
|
|
|
if (selectedConfigName.Compare(enabledConfigName, SCASE_INSENSITIVE)) |
|
|
|
if (selectedConfigName.Compare(enabledConfigName, SCASE_INSENSITIVE)) { |
|
|
|
{ |
|
|
|
|
|
|
|
selectedFeatureClass.static.EnableMe(selectedConfigName); |
|
|
|
selectedFeatureClass.static.EnableMe(selectedConfigName); |
|
|
|
announcer.AnnouncePublicPendingConfigSaved(selectedFeatureClass); |
|
|
|
announcer.AnnouncePublicPendingConfigSaved(selectedFeatureName); |
|
|
|
} |
|
|
|
} |
|
|
|
_.memory.Free(enabledConfigName); |
|
|
|
_.memory.Free(enabledConfigName); |
|
|
|
announcer.AnnounceConfigCreated(selectedFeatureClass, selectedConfigName); |
|
|
|
announcer.AnnounceConfigCreated(selectedFeatureName, selectedConfigName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function RemoveFeatureConfig() |
|
|
|
protected function RemoveFeatureConfig() { |
|
|
|
{ |
|
|
|
|
|
|
|
local class<FeatureConfig> configClass; |
|
|
|
local class<FeatureConfig> configClass; |
|
|
|
|
|
|
|
|
|
|
|
configClass = selectedFeatureClass.default.configClass; |
|
|
|
configClass = selectedFeatureClass.default.configClass; |
|
|
|
if (configClass == none) |
|
|
|
if (configClass == none) { |
|
|
|
{ |
|
|
|
announcer.AnnounceFailedNoConfigClass(selectedFeatureName); |
|
|
|
announcer.AnnounceFailedNoConfigClass(selectedFeatureClass); |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!configClass.static.Exists(selectedConfigName)) |
|
|
|
if (!configClass.static.Exists(selectedConfigName)) { |
|
|
|
{ |
|
|
|
|
|
|
|
announcer.AnnounceFailedConfigDoesNotExist( |
|
|
|
announcer.AnnounceFailedConfigDoesNotExist( |
|
|
|
selectedFeatureClass, |
|
|
|
selectedFeatureName, |
|
|
|
selectedConfigName); |
|
|
|
selectedConfigName); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
pendingConfigs.RemoveConfig(); |
|
|
|
pendingConfigs.RemoveConfig(); |
|
|
|
configClass.static.DeleteConfig(selectedConfigName); |
|
|
|
configClass.static.DeleteConfig(selectedConfigName); |
|
|
|
announcer.AnnounceConfigRemoved(selectedFeatureClass, selectedConfigName); |
|
|
|
announcer.AnnounceConfigRemoved(selectedFeatureName, selectedConfigName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function SetAutoFeatureConfig() |
|
|
|
protected function SetAutoFeatureConfig() { |
|
|
|
{ |
|
|
|
|
|
|
|
local Text currentAutoEnabledConfig; |
|
|
|
local Text currentAutoEnabledConfig; |
|
|
|
local class<FeatureConfig> configClass; |
|
|
|
local class<FeatureConfig> configClass; |
|
|
|
|
|
|
|
|
|
|
|
configClass = selectedFeatureClass.default.configClass; |
|
|
|
configClass = selectedFeatureClass.default.configClass; |
|
|
|
if (configClass == none) |
|
|
|
if (configClass == none) { |
|
|
|
{ |
|
|
|
announcer.AnnounceFailedNoConfigClass(selectedFeatureName); |
|
|
|
announcer.AnnounceFailedNoConfigClass(selectedFeatureClass); |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if ( selectedConfigName != none |
|
|
|
if (selectedConfigName != none && !configClass.static.Exists(selectedConfigName)) { |
|
|
|
&& !configClass.static.Exists(selectedConfigName)) |
|
|
|
announcer.AnnounceFailedConfigDoesNotExist(selectedFeatureName, selectedConfigName); |
|
|
|
{ |
|
|
|
|
|
|
|
announcer.AnnounceFailedConfigDoesNotExist( |
|
|
|
|
|
|
|
selectedFeatureClass, |
|
|
|
|
|
|
|
selectedConfigName); |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
currentAutoEnabledConfig = configClass.static.GetAutoEnabledConfig(); |
|
|
|
currentAutoEnabledConfig = configClass.static.GetAutoEnabledConfig(); |
|
|
|
if (selectedConfigName == none && currentAutoEnabledConfig == none) { |
|
|
|
if (selectedConfigName == none && currentAutoEnabledConfig == none) { |
|
|
|
announcer.AnnounceFailedAlreadyNoAutoEnabled(selectedFeatureClass); |
|
|
|
announcer.AnnounceFailedAlreadyNoAutoEnabled(selectedFeatureName); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (selectedConfigName != none && |
|
|
|
else if (selectedConfigName != none && |
|
|
|
selectedConfigName.Compare(currentAutoEnabledConfig, SCASE_INSENSITIVE)) |
|
|
|
selectedConfigName.Compare(currentAutoEnabledConfig, SCASE_INSENSITIVE)) { |
|
|
|
{ |
|
|
|
|
|
|
|
announcer.AnnounceFailedAlreadySameAutoEnabled( |
|
|
|
announcer.AnnounceFailedAlreadySameAutoEnabled( |
|
|
|
selectedFeatureClass, |
|
|
|
selectedFeatureName, |
|
|
|
selectedConfigName); |
|
|
|
selectedConfigName); |
|
|
|
} |
|
|
|
} else { |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
configClass.static.SetAutoEnabledConfig(selectedConfigName); |
|
|
|
configClass.static.SetAutoEnabledConfig(selectedConfigName); |
|
|
|
if (selectedConfigName != none) |
|
|
|
if (selectedConfigName != none) { |
|
|
|
{ |
|
|
|
|
|
|
|
announcer.AnnounceAutoEnabledConfig( |
|
|
|
announcer.AnnounceAutoEnabledConfig( |
|
|
|
selectedFeatureClass, |
|
|
|
selectedFeatureName, |
|
|
|
selectedConfigName); |
|
|
|
selectedConfigName); |
|
|
|
} |
|
|
|
} else { |
|
|
|
else { |
|
|
|
announcer.AnnounceRemovedAutoEnabledConfig(selectedFeatureName); |
|
|
|
announcer.AnnounceRemovedAutoEnabledConfig(selectedFeatureClass); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
_.memory.Free(currentAutoEnabledConfig); |
|
|
|
_.memory.Free(currentAutoEnabledConfig); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private function HashTable GetCurrentConfigData(BaseText configName) |
|
|
|
private function HashTable GetCurrentConfigData(BaseText configName) { |
|
|
|
{ |
|
|
|
|
|
|
|
local class<FeatureConfig> configClass; |
|
|
|
local class<FeatureConfig> configClass; |
|
|
|
|
|
|
|
|
|
|
|
if (configName == none) { |
|
|
|
if (configName == none) { |
|
|
|
return none; |
|
|
|
return none; |
|
|
|
} |
|
|
|
} |
|
|
|
configClass = selectedFeatureClass.default.configClass; |
|
|
|
configClass = selectedFeatureClass.default.configClass; |
|
|
|
if (configClass == none) |
|
|
|
if (configClass == none) { |
|
|
|
{ |
|
|
|
announcer.AnnounceFailedNoConfigClass(selectedFeatureName); |
|
|
|
announcer.AnnounceFailedNoConfigClass(selectedFeatureClass); |
|
|
|
|
|
|
|
return none; |
|
|
|
return none; |
|
|
|
} |
|
|
|
} |
|
|
|
return configClass.static.LoadData(configName); |
|
|
|
return configClass.static.LoadData(configName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private function HashTable GetCurrentSelectedConfigData() |
|
|
|
private function HashTable GetCurrentSelectedConfigData() { |
|
|
|
{ |
|
|
|
|
|
|
|
return GetCurrentConfigData(selectedConfigName); |
|
|
|
return GetCurrentConfigData(selectedConfigName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|