public void dispose() { if (fWorkingSetManagerListener != null) { PlatformUI.getWorkbench().getWorkingSetManager().removePropertyChangeListener(fWorkingSetManagerListener); fLocalWorkingSetManager.removePropertyChangeListener(fWorkingSetManagerListener); fLocalWorkingSetManager.dispose(); fWorkingSetManagerListener= null; } }
public IWorkingSet[] getAllWorkingSets() { List result= new ArrayList(); result.addAll(fActiveWorkingSets); IWorkingSet[] locals= fLocalWorkingSetManager.getWorkingSets(); for (int i= 0; i < locals.length; i++) { if (!result.contains(locals[i])) result.add(locals[i]); } IWorkingSet[] globals= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets(); for (int i= 0; i < globals.length; i++) { if (!result.contains(globals[i])) result.add(globals[i]); } return (IWorkingSet[])result.toArray(new IWorkingSet[result.size()]); }
public void saveState(IMemento memento) { memento.putString(TAG_CONFIGURED, Boolean.toString(fConfigured)); fLocalWorkingSetManager.saveState(memento.createChild(TAG_LOCAL_WORKING_SET_MANAGER)); for (Iterator iter= fActiveWorkingSets.iterator(); iter.hasNext();) { IMemento active= memento.createChild(TAG_ACTIVE_WORKING_SET); IWorkingSet workingSet= (IWorkingSet)iter.next(); active.putString(TAG_WORKING_SET_NAME, workingSet.getName()); } }
fLocalWorkingSetManager.restoreState(memento.getChild(TAG_LOCAL_WORKING_SET_MANAGER)); IWorkingSet[] allLocalWorkingSets= fLocalWorkingSetManager.getAllWorkingSets(); for (int i= 0; i < allLocalWorkingSets.length; i++) { IWorkingSet ws= allLocalWorkingSets[i]; String name= actives[i].getString(TAG_WORKING_SET_NAME); if (name != null) { IWorkingSet ws= fLocalWorkingSetManager.getWorkingSet(name); if (ws == null) { ws= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(name); String name= allWorkingSets[i].getString(TAG_WORKING_SET_NAME); if (name != null) { IWorkingSet ws= fLocalWorkingSetManager.getWorkingSet(name); if (ws == null) { ws= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(name);
/** * @param memento a memento, or <code>null</code> */ public WorkingSetModel(IMemento memento) { fLocalWorkingSetManager= PlatformUI.getWorkbench().createLocalWorkingSetManager(); addListenersToWorkingSetManagers(); fActiveWorkingSets= new ArrayList<>(); fAllWorkingSets= new ArrayList<>(); if (memento == null || ! restoreState(memento)) { IWorkingSet others= fLocalWorkingSetManager.createWorkingSet(WorkingSetMessages.WorkingSetModel_others_name, new IAdaptable[0]); others.setId(IWorkingSetIDs.OTHERS); fLocalWorkingSetManager.addWorkingSet(others); fActiveWorkingSets.add(others); fAllWorkingSets.add(others); } Assert.isNotNull(fOthersWorkingSetUpdater); fElementMapper.rebuild(getActiveWorkingSets()); fOthersWorkingSetUpdater.updateElements(); }
/** * Restore localWorkingSetManager and active working sets * @param memento * @return whether the restore was successful */ private boolean restoreState(IMemento memento) { String configured= memento.getString(TAG_CONFIGURED); if (configured == null) return false; fConfigured= Boolean.valueOf(configured).booleanValue(); fLocalWorkingSetManager.restoreState(memento.getChild(TAG_LOCAL_WORKING_SET_MANAGER)); IMemento[] actives= memento.getChildren(TAG_ACTIVE_WORKING_SET); for (int i= 0; i < actives.length; i++) { String name= actives[i].getString(TAG_WORKING_SET_NAME); if (name != null) { IWorkingSet ws= fLocalWorkingSetManager.getWorkingSet(name); if (ws == null) { ws= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(name); } if (ws != null) { fActiveWorkingSets.add(ws); } } } return true; } private void workingSetManagerChanged(PropertyChangeEvent event) {
private void addListenersToWorkingSetManagers() { fListeners= new ListenerList<>(ListenerList.IDENTITY); fWorkingSetManagerListener= new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { workingSetManagerChanged(event); } }; PlatformUI.getWorkbench().getWorkingSetManager().addPropertyChangeListener(fWorkingSetManagerListener); fLocalWorkingSetManager.addPropertyChangeListener(fWorkingSetManagerListener); }
fLocalWorkingSetManager.restoreState(memento.getChild(TAG_LOCAL_WORKING_SET_MANAGER)); IWorkingSet[] allLocalWorkingSets= fLocalWorkingSetManager.getAllWorkingSets(); for (int i= 0; i < allLocalWorkingSets.length; i++) { IWorkingSet ws= allLocalWorkingSets[i]; String name= actives[i].getString(TAG_WORKING_SET_NAME); if (name != null) { IWorkingSet ws= fLocalWorkingSetManager.getWorkingSet(name); if (ws == null) { ws= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(name); String name= allWorkingSets[i].getString(TAG_WORKING_SET_NAME); if (name != null) { IWorkingSet ws= fLocalWorkingSetManager.getWorkingSet(name); if (ws == null) { ws= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(name);
/** * @param memento a memento, or <code>null</code> */ public WorkingSetModel(IMemento memento) { fLocalWorkingSetManager= PlatformUI.getWorkbench().createLocalWorkingSetManager(); addListenersToWorkingSetManagers(); fActiveWorkingSets= new ArrayList<>(); fAllWorkingSets= new ArrayList<>(); if (memento == null || ! restoreState(memento)) { IWorkingSet others= fLocalWorkingSetManager.createWorkingSet(WorkingSetMessages.WorkingSetModel_others_name, new IAdaptable[0]); others.setId(IWorkingSetIDs.OTHERS); fLocalWorkingSetManager.addWorkingSet(others); fActiveWorkingSets.add(others); fAllWorkingSets.add(others); } Assert.isNotNull(fOthersWorkingSetUpdater); fElementMapper.rebuild(getActiveWorkingSets()); fOthersWorkingSetUpdater.updateElements(); }
private void addListenersToWorkingSetManagers() { fListeners= new ListenerList(ListenerList.IDENTITY); fWorkingSetManagerListener= new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { workingSetManagerChanged(event); } }; PlatformUI.getWorkbench().getWorkingSetManager().addPropertyChangeListener(fWorkingSetManagerListener); fLocalWorkingSetManager.addPropertyChangeListener(fWorkingSetManagerListener); }
public void dispose() { if (fWorkingSetManagerListener != null) { PlatformUI.getWorkbench().getWorkingSetManager().removePropertyChangeListener(fWorkingSetManagerListener); fLocalWorkingSetManager.removePropertyChangeListener(fWorkingSetManagerListener); fLocalWorkingSetManager.dispose(); fWorkingSetManagerListener= null; } }
/** * @param memento a memento, or <code>null</code> */ public WorkingSetModel(IMemento memento) { fLocalWorkingSetManager= PlatformUI.getWorkbench().createLocalWorkingSetManager(); addListenersToWorkingSetManagers(); fActiveWorkingSets= new ArrayList(2); if (memento == null || ! restoreState(memento)) { IWorkingSet others= fLocalWorkingSetManager.createWorkingSet(WorkingSetMessages.WorkingSetModel_others_name, new IAdaptable[0]); others.setId(OthersWorkingSetUpdater.ID); fLocalWorkingSetManager.addWorkingSet(others); fActiveWorkingSets.add(others); } Assert.isNotNull(fOthersWorkingSetUpdater); fElementMapper.rebuild(getActiveWorkingSets()); fOthersWorkingSetUpdater.updateElements(); }
private void addListenersToWorkingSetManagers() { fListeners= new ListenerList<>(ListenerList.IDENTITY); fWorkingSetManagerListener= new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { workingSetManagerChanged(event); } }; PlatformUI.getWorkbench().getWorkingSetManager().addPropertyChangeListener(fWorkingSetManagerListener); fLocalWorkingSetManager.addPropertyChangeListener(fWorkingSetManagerListener); }
public void saveState(IMemento memento) { memento.putBoolean(TAG_SORT_WORKING_SETS, fIsSortingEnabled); memento.putBoolean(TAG_CONFIGURED, fConfigured); fLocalWorkingSetManager.saveState(memento.createChild(TAG_LOCAL_WORKING_SET_MANAGER)); for (Iterator<IWorkingSet> iter= fActiveWorkingSets.iterator(); iter.hasNext();) { IMemento active= memento.createChild(TAG_ACTIVE_WORKING_SET); IWorkingSet workingSet= iter.next(); active.putString(TAG_WORKING_SET_NAME, workingSet.getName()); } for (Iterator<IWorkingSet> iter= Arrays.asList(getAllWorkingSets()).iterator(); iter.hasNext();) { IMemento allWorkingSet= memento.createChild(TAG_ALL_WORKING_SETS); IWorkingSet workingSet= iter.next(); if (isSupportedAsTopLevelElement(workingSet)) allWorkingSet.putString(TAG_WORKING_SET_NAME, workingSet.getName()); } }
/** * Returns the list containing active and all working sets from the working set managers. * * @return the list of all the working sets * @since 3.7 */ private List<IWorkingSet> getActiveAndAllWorkingSetsFromManagers() { List<IWorkingSet> result= new ArrayList<>(); result.addAll(fActiveWorkingSets); IWorkingSet[] locals= fLocalWorkingSetManager.getWorkingSets(); for (int i= 0; i < locals.length; i++) { if (!result.contains(locals[i]) && isSupportedAsTopLevelElement(locals[i])) result.add(locals[i]); } IWorkingSet[] globals= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets(); for (int i= 0; i < globals.length; i++) { if (!result.contains(globals[i]) && isSupportedAsTopLevelElement(globals[i])) result.add(globals[i]); } if (fIsSortingEnabled) Collections.sort(result, new WorkingSetComparator(true)); return result; }
public void dispose() { if (fWorkingSetManagerListener != null) { PlatformUI.getWorkbench().getWorkingSetManager().removePropertyChangeListener(fWorkingSetManagerListener); fLocalWorkingSetManager.removePropertyChangeListener(fWorkingSetManagerListener); fLocalWorkingSetManager.dispose(); fWorkingSetManagerListener= null; } }
public void saveState(IMemento memento) { memento.putBoolean(TAG_SORT_WORKING_SETS, fIsSortingEnabled); memento.putBoolean(TAG_CONFIGURED, fConfigured); fLocalWorkingSetManager.saveState(memento.createChild(TAG_LOCAL_WORKING_SET_MANAGER)); for (Iterator<IWorkingSet> iter= fActiveWorkingSets.iterator(); iter.hasNext();) { IMemento active= memento.createChild(TAG_ACTIVE_WORKING_SET); IWorkingSet workingSet= iter.next(); active.putString(TAG_WORKING_SET_NAME, workingSet.getName()); } for (Iterator<IWorkingSet> iter= Arrays.asList(getAllWorkingSets()).iterator(); iter.hasNext();) { IMemento allWorkingSet= memento.createChild(TAG_ALL_WORKING_SETS); IWorkingSet workingSet= iter.next(); if (isSupportedAsTopLevelElement(workingSet)) allWorkingSet.putString(TAG_WORKING_SET_NAME, workingSet.getName()); } }
/** * Returns the list containing active and all working sets from the working set managers. * * @return the list of all the working sets * @since 3.7 */ private List<IWorkingSet> getActiveAndAllWorkingSetsFromManagers() { List<IWorkingSet> result= new ArrayList<>(); result.addAll(fActiveWorkingSets); IWorkingSet[] locals= fLocalWorkingSetManager.getWorkingSets(); for (int i= 0; i < locals.length; i++) { if (!result.contains(locals[i]) && isSupportedAsTopLevelElement(locals[i])) result.add(locals[i]); } IWorkingSet[] globals= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets(); for (int i= 0; i < globals.length; i++) { if (!result.contains(globals[i]) && isSupportedAsTopLevelElement(globals[i])) result.add(globals[i]); } if (fIsSortingEnabled) Collections.sort(result, new WorkingSetComparator(true)); return result; }