/* (non-Javadoc) * @see org.eclipse.core.runtime.dynamichelpers.IExtensionChangeHandler#removeExtension(org.eclipse.core.runtime.IExtension, java.lang.Object[]) */ public void removeExtension(IExtension extension, Object[] objects) { for (int i = 0; i < objects.length; i++) { if (objects[i] instanceof WorkingSetDescriptor) { WorkingSetDescriptor desc = (WorkingSetDescriptor) objects[i]; workingSetDescriptors.remove(desc.getId()); } } }
/** * Returns the working set page with the given id. * * @param pageId working set page id * @return the working set page with the given id. */ public IWorkingSetPage getWorkingSetPage(String pageId) { WorkingSetDescriptor descriptor = (WorkingSetDescriptor) workingSetDescriptors.get(pageId); if (descriptor == null) { return null; } return descriptor.createWorkingSetPage(); }
/** * Returns the default, resource based, working set page * * @return the default working set page. */ public IWorkingSetPage getDefaultWorkingSetPage() { // @issue this will return the IDE resource working set page... not good for generic workbench WorkingSetDescriptor descriptor = (WorkingSetDescriptor) workingSetDescriptors.get(DEFAULT_PAGE_ID); if (descriptor != null) { return descriptor.createWorkingSetPage(); } return null; }
/** * Returns <code>true</code> if there is a working set descriptor with a page class attribute. * Otherwise <code>false</code> is returned. * * @return whether a descriptor with a page class attribute exists */ public boolean hasNewPageWorkingSetDescriptor() { Collection descriptors = workingSetDescriptors.values(); for (Iterator iter = descriptors.iterator(); iter.hasNext(); ) { WorkingSetDescriptor descriptor = (WorkingSetDescriptor) iter.next(); if (descriptor.getPageClassName() != null) { return true; } } return false; }
/** * Adds a working set descriptor. * * @param descriptor working set descriptor to add. Must not exist in the registry yet. */ public void addWorkingSetDescriptor(WorkingSetDescriptor descriptor) { Assert.isTrue( !workingSetDescriptors.containsValue(descriptor), "working set descriptor already registered"); //$NON-NLS-1$ IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker(); tracker.registerObject( descriptor.getConfigurationElement().getDeclaringExtension(), descriptor, IExtensionTracker.REF_WEAK); workingSetDescriptors.put(descriptor.getId(), descriptor); }
/** * Returns an array of all working set descriptors having a page class attribute * * @return an array of all working set descriptors having a page class attribute */ public WorkingSetDescriptor[] getNewPageWorkingSetDescriptors() { Collection descriptors = workingSetDescriptors.values(); List result = new ArrayList(descriptors.size()); for (Iterator iter = descriptors.iterator(); iter.hasNext(); ) { WorkingSetDescriptor descriptor = (WorkingSetDescriptor) iter.next(); if (descriptor.getPageClassName() != null) { result.add(descriptor); } } return (WorkingSetDescriptor[]) result.toArray(new WorkingSetDescriptor[result.size()]); }
public WorkingSetDescriptor[] getElementAdapterDescriptorsForNamespace(String namespace) { if (namespace == null) // fix for Bug 84225 return new WorkingSetDescriptor[0]; Collection descriptors = workingSetDescriptors.values(); List result = new ArrayList(); for (Iterator iter = descriptors.iterator(); iter.hasNext(); ) { WorkingSetDescriptor descriptor = (WorkingSetDescriptor) iter.next(); if (namespace.equals(descriptor.getDeclaringNamespace())) { result.add(descriptor); } } return (WorkingSetDescriptor[]) result.toArray(new WorkingSetDescriptor[result.size()]); }