/** * Transforms a string value into a list of {@link IContextualMenu}. The string value has to own * the id of the descriptors, separated by the separator {@link SEPARATOR}. * * @param descriptors The string value. * @return The list. */ public List<IContextualMenu> getFilters(String descriptors) { final List<IContextualMenu> result = new ArrayList<IContextualMenu>(); for (ContextualMenuDescriptor desc : getDescriptors(descriptors)) { result.add(desc.getExtension()); } return result; }
/** * Transforms a list of {@link ContextualMenuDescriptor} into a string value which owns the id of * the descriptors, separated by the separator {@link SEPARATOR}. * * @param descriptors The descriptors. * @return The result. */ public String getDescriptors(List<ContextualMenuDescriptor> descriptors) { boolean firstElement = true; final StringBuffer result = new StringBuffer(); for (ContextualMenuDescriptor desc : descriptors) { if (!firstElement) { result.append(SEPARATOR); } result.append(desc.getID()); firstElement = false; } return result.toString(); }
/** * Removes a given descriptor from the list of known contributions. * * @param element The element for which we are to remove a descriptor for. */ public synchronized void removeExtension(IConfigurationElement element) { final ContextualMenuDescriptor desc = new ContextualMenuDescriptor(element); storage.remove(desc.getID()); }
/** * Adds a descriptor for the given configuration element to the list of contributed extensions. * * @param element The element for which we are to add a descriptor for. */ public synchronized void addExtension(IConfigurationElement element) { final ContextualMenuDescriptor desc = new ContextualMenuDescriptor(element); storage.put(desc.getID(), desc); }