📄 plugindescriptorimpl.java
字号:
extensionPoints.put(extensionPoint.getId(), extensionPoint);
}
}
private void processExtensions(final PluginFragmentImpl fragment,
final ModelPluginManifest modelManifest)
throws ManifestProcessingException {
for (Iterator it = modelManifest.getExtensions().iterator();
it.hasNext();) {
ExtensionImpl extension = new ExtensionImpl(this, fragment,
(ModelExtension) it.next());
if (extensions.containsKey(extension.getId())) {
throw new ManifestProcessingException(
PluginRegistryImpl.PACKAGE_NAME,
"duplicateExtensions", new Object[] { //$NON-NLS-1$
extension.getId(), getId()});
}
if (!getId().equals(extension.getExtendedPluginId())
&& !pluginPrerequisites.containsKey(
extension.getExtendedPluginId())) {
throw new ManifestProcessingException(
PluginRegistryImpl.PACKAGE_NAME,
"pluginNotDeclaredInPrerequisites", new Object[] { //$NON-NLS-1$
extension.getExtendedPluginId(), extension.getId(),
getId()});
}
extensions.put(extension.getId(), extension);
}
//extensions = Collections.unmodifiableMap(extensions);
}
/**
* @see org.java.plugin.registry.UniqueIdentity#getUniqueId()
*/
public String getUniqueId() {
return registry.makeUniqueId(getId(), model.getVersion());
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getVendor()
*/
public String getVendor() {
return model.getVendor();
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getVersion()
*/
public Version getVersion() {
return model.getVersion();
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getPrerequisites()
*/
public Collection getPrerequisites() {
return Collections.unmodifiableCollection(pluginPrerequisites.values());
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getPrerequisite(java.lang.String)
*/
public PluginPrerequisite getPrerequisite(String id) {
return (PluginPrerequisite) pluginPrerequisites.get(id);
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getExtensionPoints()
*/
public Collection getExtensionPoints() {
return Collections.unmodifiableCollection(extensionPoints.values());
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getExtensionPoint(java.lang.String)
*/
public ExtensionPoint getExtensionPoint(String id) {
return (ExtensionPoint) extensionPoints.get(id);
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getExtensions()
*/
public Collection getExtensions() {
return Collections.unmodifiableCollection(extensions.values());
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getExtension(java.lang.String)
*/
public Extension getExtension(String id) {
return (Extension) extensions.get(id);
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getLibraries()
*/
public Collection getLibraries() {
return Collections.unmodifiableCollection(libraries.values());
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getLibrary(java.lang.String)
*/
public Library getLibrary(String id) {
return (Library) libraries.get(id);
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getRegistry()
*/
public PluginRegistry getRegistry() {
return registry;
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getPluginClassName()
*/
public String getPluginClassName() {
return model.getClassName();
}
/**
* @see java.lang.Object#toString()
*/
public String toString() {
return "{PluginDescriptor: uid=" + getUniqueId() + "}"; //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* @see org.java.plugin.registry.Documentable#getDocumentation()
*/
public Documentation getDocumentation() {
return doc;
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getFragments()
*/
public Collection getFragments() {
return Collections.unmodifiableCollection(fragments);
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getAttribute(java.lang.String)
*/
public PluginAttribute getAttribute(final String id) {
PluginAttributeImpl result = null;
for (Iterator it = attributes.iterator(); it.hasNext();) {
PluginAttributeImpl attr = (PluginAttributeImpl) it.next();
if (attr.getId().equals(id)) {
if (result == null) {
result = attr;
} else {
throw new IllegalArgumentException(
"more than one attribute with ID " + id //$NON-NLS-1$
+ " defined in plug-in " + getUniqueId()); //$NON-NLS-1$
}
}
}
return result;
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getAttributes()
*/
public Collection getAttributes() {
return Collections.unmodifiableCollection(attributes);
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getAttributes(java.lang.String)
*/
public Collection getAttributes(final String id) {
List result = new LinkedList();
for (Iterator it = attributes.iterator(); it.hasNext();) {
PluginAttributeImpl param = (PluginAttributeImpl) it.next();
if (param.getId().equals(id)) {
result.add(param);
}
}
return Collections.unmodifiableList(result);
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getDocsPath()
*/
public String getDocsPath() {
return model.getDocsPath();
}
/**
* @see org.java.plugin.registry.PluginDescriptor#getLocation()
*/
public URL getLocation() {
return location;
}
/**
* @see org.java.plugin.registry.xml.IdentityImpl#isEqualTo(
* org.java.plugin.registry.Identity)
*/
protected boolean isEqualTo(final Identity idt) {
if (!(idt instanceof PluginDescriptorImpl)) {
return false;
}
PluginDescriptorImpl other = (PluginDescriptorImpl) idt;
return getUniqueId().equals(other.getUniqueId())
&& getLocation().toExternalForm().equals(
other.getLocation().toExternalForm());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -