mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
refactoring arquillian containers
This commit is contained in:
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.idea.maven.utils.library;
|
||||
|
||||
import com.intellij.openapi.extensions.AbstractExtensionPointBean;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.util.xmlb.annotations.Attribute;
|
||||
import com.intellij.util.xmlb.annotations.Tag;
|
||||
|
||||
public class RepositoryLibraryBean extends AbstractExtensionPointBean {
|
||||
protected static final ExtensionPointName<RepositoryLibraryBean> EP_NAME
|
||||
= ExtensionPointName.create("org.jetbrains.idea.maven.mavenCoordinates");
|
||||
|
||||
@Attribute("name")
|
||||
public String name;
|
||||
|
||||
@Tag("groupId")
|
||||
public String groupId;
|
||||
|
||||
@Tag("artifactId")
|
||||
public String artifactId;
|
||||
}
|
||||
+6
-13
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven.utils.library;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.roots.DependencyScope;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import icons.MavenIcons;
|
||||
@@ -29,8 +28,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class RepositoryLibraryDescription {
|
||||
protected static final ExtensionPointName<RepositoryLibraryDescription> EP_NAME
|
||||
= ExtensionPointName.create("org.jetbrains.idea.maven.repositoryLibrary");
|
||||
protected static final MavenRepositoryInfo mavenCentralRepository = new MavenRepositoryInfo(
|
||||
"central",
|
||||
"Maven Central repository",
|
||||
@@ -52,20 +49,16 @@ public class RepositoryLibraryDescription {
|
||||
this.libraryName = libraryName;
|
||||
}
|
||||
|
||||
public static <C extends RepositoryLibraryDescription> C ofClass(Class<C> clazz) {
|
||||
return EP_NAME.findExtension(clazz);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static synchronized RepositoryLibraryDescription findDescription(@NotNull final String groupId, @NotNull final String artifactId) {
|
||||
if (registeredLibraries == null) {
|
||||
registeredLibraries = new HashMap<String, RepositoryLibraryDescription>();
|
||||
for (RepositoryLibraryDescription description : EP_NAME.getExtensions()) {
|
||||
String id = description.getGroupId() + ":" + description.getArtifactId();
|
||||
RepositoryLibraryDescription existDescription = registeredLibraries.get(id);
|
||||
if (existDescription == null || existDescription.getWeight() >= description.getWeight()) {
|
||||
registeredLibraries.put(id, description);
|
||||
}
|
||||
for (RepositoryLibraryBean bean : RepositoryLibraryBean.EP_NAME.getExtensions()) {
|
||||
String id = bean.groupId + ":" + bean.artifactId;
|
||||
registeredLibraries.put(id, new RepositoryLibraryDescription(
|
||||
bean.groupId,
|
||||
bean.artifactId,
|
||||
bean.name));
|
||||
}
|
||||
}
|
||||
final String id = groupId + ":" + artifactId;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<extensionPoint name="pluginDescriptor" beanClass="org.jetbrains.idea.maven.plugins.api.MavenPluginDescriptor" />
|
||||
|
||||
<extensionPoint name="repositoryProvider" interface="org.jetbrains.idea.maven.indices.MavenRepositoryProvider"/>
|
||||
<extensionPoint name="repositoryLibrary" interface="org.jetbrains.idea.maven.utils.library.RepositoryLibraryDescription"/>
|
||||
<extensionPoint name="mavenCoordinates" beanClass="org.jetbrains.idea.maven.utils.library.RepositoryLibraryBean"/>
|
||||
</extensionPoints>
|
||||
|
||||
<depends>com.intellij.properties</depends>
|
||||
|
||||
Reference in New Issue
Block a user