@Override protected IContributionItem[] getContributionItems() { IWorkingSet[] workingSets = PlatformUI.getWorkbench() .getWorkingSetManager().getRecentWorkingSets(); List items = new ArrayList(workingSets.length); List sortedWorkingSets = Arrays.asList(workingSets); Collections.sort(sortedWorkingSets, new WorkingSetComparator()); int mruMenuCount = 0; if (page != null && page.getAggregateWorkingSet() != null) { IContributionItem item = new WorkingSetMenuContributionItem( ++mruMenuCount, WorkingSetFilterActionGroup.this, page.getAggregateWorkingSet()); items.add(item); } for (Iterator i = sortedWorkingSets.iterator(); i.hasNext();) { IWorkingSet workingSet = (IWorkingSet) i.next(); if (workingSet != null && !workingSet.isAggregateWorkingSet()) { IContributionItem item = new WorkingSetMenuContributionItem( ++mruMenuCount, WorkingSetFilterActionGroup.this, workingSet); items.add(item); } } return (IContributionItem[]) items .toArray(new IContributionItem[items.size()]); } };
/** * Removes the selected working sets from the workbench. */ private void removeSelectedWorkingSets() { ISelection selection= fTableViewer.getSelection(); if (selection instanceof IStructuredSelection) { IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager(); Iterator<?> iter= ((IStructuredSelection)selection).iterator(); while (iter.hasNext()) { IWorkingSet workingSet= (IWorkingSet)iter.next(); if (fAddedWorkingSets.contains(workingSet)) { fAddedWorkingSets.remove(workingSet); } else { IWorkingSet[] recentWorkingSets= manager.getRecentWorkingSets(); for (int i= 0; i < recentWorkingSets.length; i++) { if (workingSet.equals(recentWorkingSets[i])) { fRemovedMRUWorkingSets.add(workingSet); break; } } fRemovedWorkingSets.add(workingSet); } fAllWorkingSets.remove(workingSet); manager.removeWorkingSet(workingSet); } fTableViewer.remove(((IStructuredSelection)selection).toArray()); } }
/** * Removes the selected working sets from the workbench. */ private void removeSelectedWorkingSets() { ISelection selection= fTableViewer.getSelection(); if (selection instanceof IStructuredSelection) { IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager(); Iterator<?> iter= ((IStructuredSelection)selection).iterator(); while (iter.hasNext()) { IWorkingSet workingSet= (IWorkingSet)iter.next(); if (fAddedWorkingSets.contains(workingSet)) { fAddedWorkingSets.remove(workingSet); } else { IWorkingSet[] recentWorkingSets= manager.getRecentWorkingSets(); for (int i= 0; i < recentWorkingSets.length; i++) { if (workingSet.equals(recentWorkingSets[i])) { fRemovedMRUWorkingSets.add(workingSet); break; } } fRemovedWorkingSets.add(workingSet); } fAllWorkingSets.remove(workingSet); manager.removeWorkingSet(workingSet); } fTableViewer.remove(((IStructuredSelection)selection).toArray()); } }
/** * Removes the selected working sets from the workbench. */ private void removeSelectedWorkingSets() { ISelection selection= fTableViewer.getSelection(); if (selection instanceof IStructuredSelection) { IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager(); Iterator iter= ((IStructuredSelection)selection).iterator(); while (iter.hasNext()) { IWorkingSet workingSet= (IWorkingSet)iter.next(); if (fAddedWorkingSets.contains(workingSet)) { fAddedWorkingSets.remove(workingSet); } else { IWorkingSet[] recentWorkingSets= manager.getRecentWorkingSets(); for (int i= 0; i < recentWorkingSets.length; i++) { if (workingSet.equals(recentWorkingSets[i])) { fRemovedMRUWorkingSets.add(workingSet); break; } } fRemovedWorkingSets.add(workingSet); } fAllWorkingSets.remove(workingSet); manager.removeWorkingSet(workingSet); } fTableViewer.remove(((IStructuredSelection)selection).toArray()); } }
/** * Remove the working sets contained in the provided selection from the * working set manager. * * @param selection * the sets */ protected void removeSelectedWorkingSets(List<IWorkingSet> selection) { IWorkingSetManager manager = WorkbenchPlugin.getDefault().getWorkingSetManager(); Iterator iter = selection.iterator(); while (iter.hasNext()) { IWorkingSet workingSet = (IWorkingSet) iter.next(); if (getAddedWorkingSets().contains(workingSet)) { getAddedWorkingSets().remove(workingSet); } else { IWorkingSet[] recentWorkingSets = manager.getRecentWorkingSets(); for (IWorkingSet recentWorkingSet : recentWorkingSets) { if (workingSet.equals(recentWorkingSet)) { getRemovedMRUWorkingSets().add(workingSet); break; } } getRemovedWorkingSets().add(workingSet); } manager.removeWorkingSet(workingSet); } availableWorkingSetsChanged(); } }
private void addLRUWorkingSetActions(IMenuManager mm) { IWorkingSet[] workingSets= PlatformUI.getWorkbench().getWorkingSetManager().getRecentWorkingSets(); Arrays.sort(workingSets, new WorkingSetComparator()); int currId= 1; if (fWorkbenchPage != null) { addLRUWorkingSetAction(mm, currId++, fWorkbenchPage.getAggregateWorkingSet()); } for (int i= 0; i < workingSets.length; i++) { if (!workingSets[i].isAggregateWorkingSet()) { addLRUWorkingSetAction(mm, currId++, workingSets[i]); } } fLRUMenuCount= currId; }
private void addLRUWorkingSetActions(IMenuManager mm) { IWorkingSet[] workingSets= PlatformUI.getWorkbench().getWorkingSetManager().getRecentWorkingSets(); Arrays.sort(workingSets, new WorkingSetComparator()); int currId= 1; if (fWorkbenchPage != null) { addLRUWorkingSetAction(mm, currId++, fWorkbenchPage.getAggregateWorkingSet()); } for (int i= 0; i < workingSets.length; i++) { if (!workingSets[i].isAggregateWorkingSet()) { addLRUWorkingSetAction(mm, currId++, workingSets[i]); } } fLRUMenuCount= currId; }
private void addLRUWorkingSetActions(IMenuManager mm) { IWorkingSet[] workingSets= PlatformUI.getWorkbench().getWorkingSetManager().getRecentWorkingSets(); Arrays.sort(workingSets, new WorkingSetComparator()); int currId= 1; if (fWorkbenchPage != null) { addLRUWorkingSetAction(mm, currId++, fWorkbenchPage.getAggregateWorkingSet()); } for (int i= 0; i < workingSets.length; i++) { if (!workingSets[i].isAggregateWorkingSet()) { addLRUWorkingSetAction(mm, currId++, workingSets[i]); } } fLRUMenuCount= currId; }
.getRecentWorkingSets(); BuildSetAction last = BuildSetAction.lastBuilt; IWorkingSet lastSet = null;