}
private Lookup getDefaultLookup() {
// The Lookup is not created in the constructor, so that we do not need
// to share "this" in the constructor.
Lookup result = defaultLookupRef.get();
if (result == null) {
GradleAuxiliaryConfiguration auxConfig = new GradleAuxiliaryConfiguration(this);
Lookup newLookup = Lookups.fixed(new Object[] {
this,
state, //allow outside code to mark the project as needing saving
NbGradleSingleProjectConfigProvider.create(this),
new GradleProjectInformation(this),
new GradleProjectLogicalViewProvider(this),
new GradleActionProvider(this),
new GradleSharabilityQuery(this),
new GradleSourceEncodingQuery(this),
new GradleCustomizer(this),
new OpenHook(),
auxConfig,
new GradleAuxiliaryProperties(auxConfig),
new GradleTemplateAttrProvider(this),
new DefaultGradleCommandExecutor(this),
ProjectPropertiesApi.buildPlatform(getProperties().getPlatform()),
ProjectPropertiesApi.scriptPlatform(getProperties().getScriptPlatform()),
ProjectPropertiesApi.sourceEncoding(getProperties().getSourceEncoding()),
ProjectPropertiesApi.sourceLevel(getProperties().getSourceLevel()),
new ProjectInfoManager(),
// FileOwnerQueryImplementation cannot be added to the project's
// lookup, since NetBeans will ignore it. It must be added
// using the ServiceProviders annotation. Our implementation is
// GradleFileOwnerQuery and is added using the annotation.
});
if (defaultLookupRef.compareAndSet(null, newLookup)) {
for (ProjectInitListener listener: newLookup.lookupAll(ProjectInitListener.class)) {
listener.onInitProject();
}
}
result = defaultLookupRef.get();
}