As an outgrowth of the conversation about loading features being different and better than just loading configuration maps, I decided automate loading features with code. I extended #AbtFeatureLoader with #loadFeaturesNamed: to aid that effort (see below). It takes a list of feature names and loads them. It seems to work but the code that loads features is very tied to the window that displays the available features that it is hard to be sure I have done everything right. Instantiations should feel free to incorporate it or something like it into the product.
I have also included below (note this new Google group thing wouldn't take the attachement) the abt.cnf that I use. It is very much tired to how I work but it uses the extended code to load features, so you can see how that is done. I use separate images for each program or application I work on. When I start new development or am ready to package an image, I start with a clean image like the one supplied with a new version of VA Smalltalk v9.2.2. Before making this extension I would have to load features and configuration maps. Now, the abt.cnf does that and other stuff for me.
loadFeaturesNamed: aListOfFeatureNames
| theFeatures |
self getPatternsForFeatures.
theFeatures := OrderedCollection new.
aListOfFeatureNames asSet do: [:aMapName | | hidden |
hidden := self isHiddenFeature: aMapName.
(AbtFeatureLoader checkIfValidFeature: aMapName) ifNotNil: [:map |
theFeatures add: ((AbtFeatureMap map: map loader: self) visible: hidden not; yourself).
].
].
theFeatures do: [:aFeature | | prereqs |
"Find the immediate prerequisite features for aFeature"
prereqs := aFeature prereqs.
prereqs do: [:aPrereqFeature |
aFeature prerequisiteFeatures add: aPrereqFeature.
aPrereqFeature dependentFeatures add: aFeature.
].
].
self loadFeatures: theFeatures.
PostStartUp!
StsPowerTools
parseTreeMaxMethodTextSize: SmallInteger largest;
updateStyling;
superUser: true.
[ | fontName fontStruct |
fontName := ('WIN*' match: (System subsystemType: #CW))
ifTrue: ['-microsoft-times new roman-medium-r-normal--19-140-96-96-p-0-iso8859-1']
ifFalse: ['-bitstream-bitstream charter-medium-r-normal--19-180-75-75-p-102-iso10646-1'].
(fontStruct := CgDisplay default loadQueryFont: fontName) notNil
ifTrue: [EtWindow updateFontList: (CwFontList fontStruct: fontStruct)]
ifFalse: [CwMessagePrompter errorMessage: (NlsCatEST indexedMsg: 5)]. "$NLS$ Failed to load font"
] value.
Transcript shell osWidget disable.
Transcript shell osWidget class busyCursor.
AbtApplicationsOrganizerView current showBusyCursor.
(EmConfigurationMap editionsFor: 'KscFeatureLoaderExtensions') first isLoaded ifFalse: [
(EmConfigurationMap editionsFor: 'KscFeatureLoaderExtensions') first loadWithRequiredMapsAndTracing: true.
(EmConfigurationMap editionsFor: 'KscNonVisualDev') first loadWithRequiredMapsAndTracing: true.
[ | stream featureNames localPath |
localPath := CfsDirectoryDescriptor getcwd, CfsDirectoryDescriptor pathSeparatorString.
stream := CfsReadFileStream open: (localPath, 'FeaturesToLoad.Txt').
featureNames := OrderedCollection new.
[stream atEnd] whileFalse: [featureNames add: stream nextLine trimBlanks].
stream close.
featureNames notEmpty ifTrue: [AbtFeatureLoader new loadFeaturesNamed: featureNames].
] value.
].
Transcript shell osWidget disable.
Transcript shell osWidget class busyCursor.
AbtApplicationsOrganizerView current showBusyCursor.
(AbtApplicationsOrganizerView current respondsTo: #fullMenus:) ifTrue: [AbtApplicationsOrganizerView current fullMenus: true].
[ | appPrefixes |
appPrefixes := AbtApplicationsOrganizerView applicationPrefixes asSet.
appPrefixes addAll: #('Ksc' 'TestKsc').
AbtApplicationsOrganizerView applicationPrefixes: appPrefixes asSortedCollection.
AbtApplicationsOrganizerView applicationsShow: ##matchingPrefixes.
] value.
(AbtApplicationsOrganizerView current respondsTo: #addOptionsMenuItemsToOrganizer) ifTrue: [AbtApplicationsOrganizerView current addOptionsMenuItemsToOrganizer].
(StsAbtApplicationsOrganizerView current respondsTo: #addApplicationsLoadMenuItemsToOrganizer) ifTrue: [StsAbtApplicationsOrganizerView current addApplicationsLoadMenuItemsToOrganizer].
(StsAbtApplicationsOrganizerView current respondsTo: #addClassesMenuItemsToOrganizer) ifTrue: [StsAbtApplicationsOrganizerView current addClassesMenuItemsToOrganizer].
AbtPreferencesBrowsersObject current
standardBrowsers: 1; "Enhanced"
autoRefresh: true;
confirmOnDelete: false;
selectAllApps: true;
selectAllCategories: true;
showCategory: true;
showHSB: false.
AbtPreferencesCEObject current
shapeWidth: 3;
showConnectionsOnOpen: false;
showSourceIndication: true.
EtWindow defaultWindowSize: 900@500.
StsConfirmationDialog answerFor: 'Find String' put: true.
AbtApplicationsOrganizerView current applicationsRefreshNow.
[ | stream appName className localPath |
localPath := CfsDirectoryDescriptor getcwd, CfsDirectoryDescriptor pathSeparatorString.
stream := CfsReadFileStream open: (localPath, 'AppNameToSelect.Txt').
appName := stream nextLine trimBlanks.
className := stream nextLine trimBlanks.
stream close.
(appName notEmpty & className notEmpty) ifTrue: [Compiler evaluate: ('AbtApplicationsOrganizerView current selectClass: ', className, ' inApplication: ', appName) for: nil ifFail: [:e | Transcript show: e message]].
] value.
Transcript shell x: 225; y: 660; height: 365.
AbtApplicationsOrganizerView current x: 270; y: 150; setFocus.
AbtApplicationsOrganizerView current resetCursor.
Transcript shell osWidget enable.
Transcript shell osWidget class resetCursor.