private IWorkingSet[] getWorkingSets(String[] workingSetNames) { if (workingSetNames == null) { return null; } Set<IWorkingSet> workingSets= new HashSet<>(2); for (int j= 0; j < workingSetNames.length; j++) { IWorkingSet workingSet= getWorkingSetManager().getWorkingSet(workingSetNames[j]); if (workingSet != null) { workingSets.add(workingSet); } } return workingSets.toArray(new IWorkingSet[workingSets.size()]); }
private IWorkingSet[] getWorkingSets(String[] workingSetNames) { if (workingSetNames == null) { return null; } Set workingSets= new HashSet(2); for (int j= 0; j < workingSetNames.length; j++) { IWorkingSet workingSet= getWorkingSetManager().getWorkingSet(workingSetNames[j]); if (workingSet != null) { workingSets.add(workingSet); } } return (IWorkingSet[])workingSets.toArray(new IWorkingSet[workingSets.size()]); }
private IWorkingSet[] getWorkingSets(String[] workingSetNames) { if (workingSetNames == null) { return null; } Set<IWorkingSet> workingSets= new HashSet<>(2); for (int j= 0; j < workingSetNames.length; j++) { IWorkingSet workingSet= getWorkingSetManager().getWorkingSet(workingSetNames[j]); if (workingSet != null) { workingSets.add(workingSet); } } return workingSets.toArray(new IWorkingSet[workingSets.size()]); }
private void removeDeletedWorkingSets() { Iterator<IWorkingSet[]> iter= new ArrayList<>(fLRUList).iterator(); while (iter.hasNext()) { IWorkingSet[] workingSets= iter.next(); for (int i= 0; i < workingSets.length; i++) { if (PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(workingSets[i].getName()) == null) { fLRUList.remove(workingSets); break; } } } }
private void removeDeletedWorkingSets() { Iterator iter= new ArrayList(fLRUList).iterator(); while (iter.hasNext()) { IWorkingSet[] workingSets= (IWorkingSet[])iter.next(); for (int i= 0; i < workingSets.length; i++) { if (PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(workingSets[i].getName()) == null) { fLRUList.remove(workingSets); break; } } } }
private void removeDeletedWorkingSets() { Iterator<IWorkingSet[]> iter= new ArrayList<>(fLRUList).iterator(); while (iter.hasNext()) { IWorkingSet[] workingSets= iter.next(); for (int i= 0; i < workingSets.length; i++) { if (PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(workingSets[i].getName()) == null) { fLRUList.remove(workingSets); break; } } } }
private IWorkingSet getWorkingSet(IWorkingSetManager workingSetManager, String storedName) { if (storedName.length() == 0) { IWorkbenchPage page= fSearchDialog.getWorkbenchWindow().getActivePage(); if (page != null) { return page.getAggregateWorkingSet(); } return null; } return workingSetManager.getWorkingSet(storedName); }
private void updateSelectedWorkingSets() { String item= fWorkingSetCombo.getItem(fWorkingSetCombo.getSelectionIndex()); String[] workingSetNames= item.split(", "); //$NON-NLS-1$ IWorkingSetManager workingSetManager= PlatformUI.getWorkbench().getWorkingSetManager(); fSelectedWorkingSets= new IWorkingSet[workingSetNames.length]; for (int i= 0; i < workingSetNames.length; i++) { IWorkingSet set= workingSetManager.getWorkingSet(workingSetNames[i]); Assert.isNotNull(set); fSelectedWorkingSets[i]= set; } }
private IWorkingSet getWorkingSet(IWorkingSetManager workingSetManager, String storedName) { if (storedName.length() == 0) { IWorkbenchPage page= fSearchDialog.getWorkbenchWindow().getActivePage(); if (page != null) { return page.getAggregateWorkingSet(); } return null; } return workingSetManager.getWorkingSet(storedName); }
/** * Restores the saved working set, if any. * * @param the saved working set name or null */ private void restoreWorkingSet(String workingSetName) { if (workingSetName != null) { IWorkingSetManager workingSetManager = PlatformUI.getWorkbench() .getWorkingSetManager(); IWorkingSet workingSet = workingSetManager .getWorkingSet(workingSetName); if (workingSet != null) { this.workingSet = workingSet; } } }
@Override protected void init(IMemento memento) { super.init(memento); IMemento[] rootNodes = memento.getChildren(CTX_SETS); if (rootNodes != null) { List<IWorkingSet> sets = new ArrayList<>(); for (int i = 0; i < rootNodes.length; i++) { IMemento rootNode = rootNodes[i]; String setName = rootNode.getString(CTX_SET_NAME); IWorkingSet set = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(setName); if (set != null) { sets.add(set); } } setWorkingSets(sets.toArray(new IWorkingSet[sets.size()])); } } }
private void updateSelectedWorkingSets() { String item = workingSetCombo.getItem(workingSetCombo .getSelectionIndex()); String[] workingSetNames = split(item, ", "); //$NON-NLS-1$ IWorkingSetManager workingSetManager = PlatformUI.getWorkbench() .getWorkingSetManager(); selectedWorkingSets = new IWorkingSet[workingSetNames.length]; for (int i = 0; i < workingSetNames.length; i++) { IWorkingSet set = workingSetManager .getWorkingSet(workingSetNames[i]); Assert.isNotNull(set); selectedWorkingSets[i] = set; } }
/** * One of the search scope radio buttons has been pressed. Update the dialog accordingly. */ private void handleRadioButtonPressed() { if (workingSetScopeButton.getSelection()) { IWorkingSet set = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(getWorkingSetName()); if (set != null) { setWorkingSet(set); return; } } setWorkingSet(null); }
/** * Returns the active default breakpoint working set, or <code>null</code> * if none. * * @return the active default breakpoint working set, or <code>null</code> */ public static IWorkingSet getDefaultWorkingSet() { IPreferenceStore preferenceStore = DebugUIPlugin.getDefault().getPreferenceStore(); String name = preferenceStore.getString(IInternalDebugUIConstants.MEMENTO_BREAKPOINT_WORKING_SET_NAME); if (name != null) { return PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(name); } return null; }
private void createWorkingSet(String workingSetName, IProject[] projects) { IWorkingSetManager manager = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager(); IWorkingSet oldSet = manager.getWorkingSet(workingSetName); if (oldSet == null) { IWorkingSet newSet = manager.createWorkingSet(workingSetName, projects); manager.addWorkingSet(newSet); } else { //don't overwrite the old elements IAdaptable[] tempElements = oldSet.getElements(); IAdaptable[] adaptedProjects = oldSet.adaptElements(projects); IAdaptable[] finalElementList = new IAdaptable[tempElements.length + adaptedProjects.length]; System.arraycopy(tempElements, 0, finalElementList, 0, tempElements.length); System.arraycopy(adaptedProjects, 0,finalElementList, tempElements.length, adaptedProjects.length); oldSet.setElements(finalElementList); } } }
/** * Restores the state of the filter actions from a memento. * <p> * Note: This method does not refresh the viewer. * </p> * * @param memento the memento */ public void restoreState(IMemento memento) { String workingSetName= memento.getString(TAG_WORKING_SET_NAME); if (workingSetName != null && workingSetName.length() > 0) { setWorkingSet(PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(workingSetName), false); } else if (fWorkbenchPage != null && useWindowWorkingSetByDefault()) { setWorkingSet(fWorkbenchPage.getAggregateWorkingSet(), false); } }
/** * Returns existing or creates new workbench working set with the given name * * @since 1.5 */ public static IWorkingSet getOrCreateWorkingSet(String workingSetName) { IWorkingSetManager wsm = PlatformUI.getWorkbench().getWorkingSetManager(); IWorkingSet workingSet = wsm.getWorkingSet(workingSetName); if(workingSet == null) { workingSet = wsm.createWorkingSet(workingSetName, new IAdaptable[0]); // TODO is there a constant we should be setting here? workingSet.setId("org.eclipse.ui.resourceWorkingSetPage"); wsm.addWorkingSet(workingSet); } return workingSet; }
/** * Change the label on the "Ok" button and initialize the enabled state */ @Override protected void createButtonsForButtonBar(Composite parent) { super.createButtonsForButtonBar(parent); getOkButton().setText(AntViewActionMessages.SearchForBuildFilesDialog__Search_4); String workingSetName = settings.get(IAntUIPreferenceConstants.ANTVIEW_LAST_WORKINGSET_SEARCH_SCOPE); if (workingSetName.length() > 0) { setWorkingSet(PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(workingSetName)); } if (!settings.getBoolean(IAntUIPreferenceConstants.ANTVIEW_USE_WORKINGSET_SEARCH_SCOPE)) { selectRadioButton(workspaceScopeButton); handleRadioButtonPressed(); } }
/** * Restores the state of the filter actions from a memento. * <p> * Note: This method does not refresh the viewer. * </p> * * @param memento the memento */ public void restoreState(IMemento memento) { String workingSetName= memento.getString(TAG_WORKING_SET_NAME); if (workingSetName != null && workingSetName.length() > 0) { setWorkingSet(PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(workingSetName), false); } else if (fWorkbenchPage != null && useWindowWorkingSetByDefault()) { setWorkingSet(fWorkbenchPage.getAggregateWorkingSet(), false); } }
private static void restoreFromOldFormat() { fgLRUWorkingSets= new LRUWorkingSetsList(LRU_WORKINGSET_LIST_SIZE); IDialogSettings settingsStore= getDialogStoreSection(); boolean foundLRU= false; String[] lruWorkingSetNames= settingsStore.getArray(STORE_LRU_WORKING_SET_NAMES); if (lruWorkingSetNames != null) { for (int i= lruWorkingSetNames.length - 1; i >= 0; i--) { IWorkingSet workingSet= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(lruWorkingSetNames[i]); if (workingSet != null) { foundLRU= true; fgLRUWorkingSets.add(new IWorkingSet[]{workingSet}); } } } if (foundLRU) // save in new format saveState(settingsStore); }