mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
platform cleanup: remove duplicated code from ExtensionsAreaImpl
This commit is contained in:
+3
-23
@@ -131,28 +131,8 @@ public class ExtensionsAreaImpl implements ExtensionsArea {
|
||||
|
||||
@Override
|
||||
public void registerExtension(@NotNull final PluginDescriptor pluginDescriptor, @NotNull final Element extensionElement, String ns) {
|
||||
final PluginId pluginId = pluginDescriptor.getPluginId();
|
||||
|
||||
if (!Extensions.isComponentSuitableForOs(extensionElement.getAttributeValue("os"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
String epName = extractEPName(extensionElement, ns);
|
||||
|
||||
ExtensionComponentAdapter adapter;
|
||||
final ExtensionPointImpl extensionPoint = getExtensionPoint(epName);
|
||||
if (extensionPoint.getKind() == ExtensionPoint.Kind.INTERFACE) {
|
||||
String implClass = extensionElement.getAttributeValue("implementation");
|
||||
if (implClass == null) {
|
||||
throw new RuntimeException("'implementation' attribute not specified for '" + epName + "' extension in '" + pluginId.getIdString() + "' plugin");
|
||||
}
|
||||
adapter = new ExtensionComponentAdapter(implClass, extensionElement, myPicoContainer, pluginDescriptor, shouldDeserializeInstance(extensionElement));
|
||||
}
|
||||
else {
|
||||
adapter = new ExtensionComponentAdapter(extensionPoint.getClassName(), extensionElement, myPicoContainer, pluginDescriptor, true);
|
||||
}
|
||||
myPicoContainer.registerComponent(adapter);
|
||||
extensionPoint.registerExtensionAdapter(adapter);
|
||||
registerExtension(getExtensionPoint(epName), pluginDescriptor, extensionElement);
|
||||
}
|
||||
|
||||
// Used in Upsource
|
||||
@@ -166,8 +146,8 @@ public class ExtensionsAreaImpl implements ExtensionsArea {
|
||||
if (extensionPoint.getKind() == ExtensionPoint.Kind.INTERFACE) {
|
||||
String implClass = extensionElement.getAttributeValue("implementation");
|
||||
if (implClass == null) {
|
||||
throw new RuntimeException("'implementation' attribute not specified for '" + extensionPoint.getName() + "' extension in '" + pluginDescriptor.getPluginId()
|
||||
.getIdString() + "' plugin");
|
||||
throw new RuntimeException("'implementation' attribute not specified for '" + extensionPoint.getName() + "' extension in '"
|
||||
+ pluginDescriptor.getPluginId().getIdString() + "' plugin");
|
||||
}
|
||||
adapter = new ExtensionComponentAdapter(implClass, extensionElement, myPicoContainer, pluginDescriptor, shouldDeserializeInstance(extensionElement));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user