Skip to content

Commit 20eef85

Browse files
committed
let injector create remote catlog
1 parent c49b0b5 commit 20eef85

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/archetype/ArchetypePlugin.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,6 @@
8383
@Component(service = ArchetypePlugin.class)
8484
public class ArchetypePlugin {
8585

86-
/**
87-
*
88-
*/
89-
private static final RemoteCatalogArchetypeDataSource REMOTE_CATALOG = new RemoteCatalogArchetypeDataSource();
90-
9186
private static final InternalCatalogArchetypeDataSource INTERNAL_CATALOG = new InternalCatalogArchetypeDataSource();
9287

9388
private static final LocalCatalogArchetypeDataSource LOCAL_CATALOG = new LocalCatalogArchetypeDataSource();
@@ -108,6 +103,8 @@ public class ArchetypePlugin {
108103

109104
private ArchetypeArtifactManager archetypeArtifactManager;
110105

106+
private RemoteCatalogArchetypeDataSource remoteCatalog;
107+
111108
public ArchetypePlugin() {
112109
this.configFile = new File(MavenPluginActivator.getDefault().getStateLocation().toFile(),
113110
M2EUIPluginActivator.PREFS_ARCHETYPES);
@@ -123,7 +120,6 @@ protected void configure() {
123120
}
124121
};
125122
Slf4jLogger logger = new Slf4jLogger(LoggerFactory.getILoggerFactory().getLogger("catalog"));
126-
REMOTE_CATALOG.enableLogging(logger);
127123
INTERNAL_CATALOG.enableLogging(logger);
128124
LOCAL_CATALOG.enableLogging(logger);
129125
ClassSpace space = new BundleClassSpace(FrameworkUtil.getBundle(ArchetypeArtifactManager.class));
@@ -149,6 +145,10 @@ protected void configure() {
149145
for(ArchetypeCatalogFactory archetypeCatalogFactory : ExtensionReader.readArchetypeExtensions(this)) {
150146
addArchetypeCatalogFactory(archetypeCatalogFactory);
151147
}
148+
this.remoteCatalog = injector.getInstance(RemoteCatalogArchetypeDataSource.class);
149+
if(remoteCatalog instanceof LogEnabled le) {
150+
le.enableLogging(logger);
151+
}
152152
try {
153153
readCatalogs();
154154
} catch(IOException e) {
@@ -168,7 +168,7 @@ public LocalCatalogFactory newLocalCatalogFactory(String path, String descriptio
168168

169169
public RemoteCatalogFactory newRemoteCatalogFactory(String url, String description, boolean editable,
170170
boolean enabled) {
171-
return new RemoteCatalogFactory(url, description, editable, enabled, maven, REMOTE_CATALOG);
171+
return new RemoteCatalogFactory(url, description, editable, enabled, maven, remoteCatalog);
172172
}
173173

174174
public ArchetypeGenerator getGenerator() {

0 commit comments

Comments
 (0)