Package org.eclipse.ui.internal
Class AbstractWorkingSetManager
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.ui.internal.AbstractWorkingSetManager
- All Implemented Interfaces:
EventListener,IExtensionChangeHandler,IWorkingSetManager,BundleListener
- Direct Known Subclasses:
LocalWorkingSetManager,WorkingSetManager
public abstract class AbstractWorkingSetManager
extends EventManager
implements IWorkingSetManager, BundleListener, IExtensionChangeHandler
Abstract implementation of
IWorkingSetManager.-
Field Summary
Fields inherited from interface org.eclipse.ui.IWorkingSetManager
CHANGE_WORKING_SET_ADD, CHANGE_WORKING_SET_CONTENT_CHANGE, CHANGE_WORKING_SET_LABEL_CHANGE, CHANGE_WORKING_SET_NAME_CHANGE, CHANGE_WORKING_SET_REMOVE, CHANGE_WORKING_SET_UPDATER_INSTALLED, CHANGE_WORKING_SET_UPDATER_UNINSTALLED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExtension(IExtensionTracker tracker, IExtension extension) This method is called whenever an extension conforming to the extension point filter is being added to the registry.voidAdds a property change listener.voidaddToWorkingSets(IAdaptable element, IWorkingSet[] workingSets) Utility method that will add theelementto each given working set inworkingSetsif possible.voidaddWorkingSet(IWorkingSet workingSet) Adds a working set to the receiver.voidbundleChanged(BundleEvent event) createAggregateWorkingSet(String name, String label, IWorkingSet[] components) Create a working set that is the union of a collection of other working sets.createWorkingSet(String name, IAdaptable[] elements) Creates a new working set.createWorkingSet(IMemento memento) Re-creates and returns a working set from the state captured within the given memento.createWorkingSetEditWizard(IWorkingSet workingSet) Creates a working set edit wizard for the specified working set.createWorkingSetNewWizard(String[] workingSetIds) Creates a working set new wizard.createWorkingSetSelectionDialog(Shell parent) Deprecated.use createWorkingSetSelectionDialog(parent, true) insteadcreateWorkingSetSelectionDialog(Shell parent, boolean multi) Creates a working set selection dialog that lists all working sets and allows the user to add, remove and edit working sets.createWorkingSetSelectionDialog(Shell parent, boolean multi, String[] workingsSetIds) Creates a working set selection dialog that lists all working sets with the specified ids and allows the user to add, remove and edit working sets with the specified ids.voiddispose()Disposes the working set manager.booleanTests the receiver and the object for equalityprotected voidfirePropertyChange(String changeId, Object oldValue, Object newValue) Notify property change listeners about a change to the list of working sets.Returns an array of all working sets stored in the receiver including those that are marked as being not visible.Returns the list of most recently used working sets.intReturns the maximum length of the recent working sets list.getWorkingSet(String name) Returns the working set with the specified name.Returns an array of all working sets stored in the receiver.inthashCode()Returns the hash code.protected voidinternalAddRecentWorkingSet(IWorkingSet workingSet) Adds the specified working set to the list of recently used working sets.protected booleaninternalRemoveWorkingSet(IWorkingSet workingSet) voidremoveExtension(IExtension extension, Object[] objects) This method is called after the removal of an extension.voidRemoves the property change listener.protected voidrestoreMruList(IMemento memento) Restores the list of most recently used working sets from the persistence store.protected IWorkingSetrestoreWorkingSet(IMemento memento) Recreates a working set from the persistence store.protected voidrestoreWorkingSetState(IMemento memento) Recreates all working sets from the persistence store and adds them to the receiver.protected voidsaveMruList(IMemento memento) Saves the list of most recently used working sets in the persistence store.voidSave the state to the state file.voidsaveWorkingSetState(IMemento memento) Saves all persistable working sets in the persistence store.voidsetRecentWorkingSetsLength(int length) Sets maximum length of the recent working sets list.voidworkingSetChanged(IWorkingSet changedWorkingSet, String propertyChangeId, Object oldValue) Fires a property change event for the changed working set.Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObjectMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.ui.IWorkingSetManager
addRecentWorkingSet, removeWorkingSet
-
Constructor Details
-
AbstractWorkingSetManager
-
-
Method Details
-
dispose
public void dispose()Description copied from interface:IWorkingSetManagerDisposes the working set manager.- Specified by:
disposein interfaceIWorkingSetManager
-
createWorkingSet
Description copied from interface:IWorkingSetManagerCreates a new working set. The working set is not added to the working set manager.- Specified by:
createWorkingSetin interfaceIWorkingSetManager- Parameters:
name- the name of the new working set. Should not have leading or trailing whitespace.elements- the working set contents- Returns:
- a new working set with the specified name and content
-
createAggregateWorkingSet
Description copied from interface:IWorkingSetManagerCreate a working set that is the union of a collection of other working sets. One connected (viaIWorkingSetManager.addWorkingSet(IWorkingSet)this working set will be automatically updated to reflect the contents of the component sets, should they themselves change.- Specified by:
createAggregateWorkingSetin interfaceIWorkingSetManager- Parameters:
name- the name of the new working set. Should not have leading or trailing whitespace.label- the user-friendly label the working setcomponents- the component working sets- Returns:
- a new working set with the specified name and content
-
createWorkingSet
Description copied from interface:IWorkingSetManagerRe-creates and returns a working set from the state captured within the given memento.- Specified by:
createWorkingSetin interfaceIWorkingSetManager- Parameters:
memento- a memento containing the state for the working set- Returns:
- the restored working set, or
nullif it could not be created
-
addWorkingSet
Description copied from interface:IWorkingSetManagerAdds a working set to the receiver. The working set must not exist yet.- Specified by:
addWorkingSetin interfaceIWorkingSetManager- Parameters:
workingSet- the working set to add
-
internalRemoveWorkingSet
-
getWorkingSets
Description copied from interface:IWorkingSetManagerReturns an array of all working sets stored in the receiver. The array is sorted by names. Any working set whoseIWorkingSet.isVisible()method returns false will not be included in this array. For a complete list of working sets please useIWorkingSetManager.getAllWorkingSets().- Specified by:
getWorkingSetsin interfaceIWorkingSetManager- Returns:
- the working sets stored in the receiver
-
getAllWorkingSets
Description copied from interface:IWorkingSetManagerReturns an array of all working sets stored in the receiver including those that are marked as being not visible.- Specified by:
getAllWorkingSetsin interfaceIWorkingSetManager- Returns:
- the working sets stored in the receiver
- See Also:
-
getWorkingSet
Description copied from interface:IWorkingSetManagerReturns the working set with the specified name. Returns null if there is no working set with that name.- Specified by:
getWorkingSetin interfaceIWorkingSetManager- Parameters:
name- the name of the working set to return- Returns:
- the working set with the specified name.
-
getRecentWorkingSets
Description copied from interface:IWorkingSetManagerReturns the list of most recently used working sets. The most recently used working set appears first in the list.- Specified by:
getRecentWorkingSetsin interfaceIWorkingSetManager- Returns:
- the list of most recently used working sets
-
internalAddRecentWorkingSet
Adds the specified working set to the list of recently used working sets.- Parameters:
workingSet- working set to added to the list of recently used working sets.
-
equals
Tests the receiver and the object for equality -
hashCode
public int hashCode()Returns the hash code. -
addPropertyChangeListener
Description copied from interface:IWorkingSetManagerAdds a property change listener.- Specified by:
addPropertyChangeListenerin interfaceIWorkingSetManager- Parameters:
listener- the property change listener to add
-
removePropertyChangeListener
Description copied from interface:IWorkingSetManagerRemoves the property change listener.- Specified by:
removePropertyChangeListenerin interfaceIWorkingSetManager- Parameters:
listener- the property change listener to remove
-
firePropertyChange
Notify property change listeners about a change to the list of working sets.- Parameters:
changeId- one of IWorkingSetManager#CHANGE_WORKING_SET_ADD IWorkingSetManager#CHANGE_WORKING_SET_REMOVE IWorkingSetManager#CHANGE_WORKING_SET_CONTENT_CHANGE IWorkingSetManager#CHANGE_WORKING_SET_NAME_CHANGEoldValue- the removed working set or null if a working set was added or changed.newValue- the new or changed working set or null if a working set was removed.
-
workingSetChanged
public void workingSetChanged(IWorkingSet changedWorkingSet, String propertyChangeId, Object oldValue) Fires a property change event for the changed working set. Should only be called by org.eclipse.ui.internal.WorkingSet.- Parameters:
changedWorkingSet- the working set that has changedpropertyChangeId- the changed property. one of CHANGE_WORKING_SET_CONTENT_CHANGE, CHANGE_WORKING_SET_LABEL_CHANGE, and CHANGE_WORKING_SET_NAME_CHANGEoldValue- the old value
-
saveWorkingSetState
Saves all persistable working sets in the persistence store.- Parameters:
memento- the persistence store- See Also:
-
restoreWorkingSetState
Recreates all working sets from the persistence store and adds them to the receiver.- Parameters:
memento- the persistence store
-
restoreWorkingSet
Recreates a working set from the persistence store.- Parameters:
memento- the persistence store- Returns:
- the working set created from the memento or null if creation failed.
-
saveMruList
Saves the list of most recently used working sets in the persistence store.- Parameters:
memento- the persistence store
-
restoreMruList
Restores the list of most recently used working sets from the persistence store.- Parameters:
memento- the persistence store
-
createWorkingSetEditWizard
Description copied from interface:IWorkingSetManagerCreates a working set edit wizard for the specified working set. The working set will already be set in the wizard. The caller is responsible for creating and opening a wizard dialog. Example:IWorkingSetEditWizard wizard = workingSetManager.createWorkingSetEditWizard(workingSet); if (wizard != null) { WizardDialog dialog = new WizardDialog(shell, wizard); dialog.create(); if (dialog.open() == Window.OK) { workingSet = wizard.getSelection(); } }- Specified by:
createWorkingSetEditWizardin interfaceIWorkingSetManager- Parameters:
workingSet- working set to create a working set edit wizard for.- Returns:
- a working set edit wizard to edit the specified working set or
nullif no edit wizard has been defined for the working set. If the defined edit wizard for the working set could not be loaded a default IResource based wizard will be returned. If the default edit wizard can not be loadednullis returned. - Since:
- 2.1
- See Also:
-
createWorkingSetSelectionDialog
Deprecated.use createWorkingSetSelectionDialog(parent, true) instead- Specified by:
createWorkingSetSelectionDialogin interfaceIWorkingSetManager- Parameters:
parent- the parent shell- Returns:
- the dialog
-
createWorkingSetSelectionDialog
Description copied from interface:IWorkingSetManagerCreates a working set selection dialog that lists all working sets and allows the user to add, remove and edit working sets. The caller is responsible for opening the dialog withIWorkingSetSelectionDialog#open, and subsequently extracting the selected working sets usingIWorkingSetSelectionDialog#getSelection.- Specified by:
createWorkingSetSelectionDialogin interfaceIWorkingSetManager- Parameters:
parent- the parent shell of the working set selection dialogmulti- true=IWorkingSetSelectionDialog#getSelection()returns the working sets chosen in the dialog as an array of working set. false=IWorkingSetSelectionDialog#getSelection()returns an array having a single aggregate working set of all working sets selected in the dialog.- Returns:
- a working set selection dialog
-
createWorkingSetNewWizard
Creates a working set new wizard. The wizard will allow creating new working sets. Returnsnullif there aren't any working set definitions that support creation of working sets.Example:
IWorkingSetNewWizard wizard= workingSetManager.createWorkingSetNewWizard(null); if (wizard != null) { WizardDialog dialog = new WizardDialog(shell, wizard); dialog.create(); if (dialog.open() == Window.OK) { ... } }- Specified by:
createWorkingSetNewWizardin interfaceIWorkingSetManager- Parameters:
workingSetIds- a list of working set ids which are valid workings sets to be created ornullif all currently available working set types are valid- Returns:
- the working set new wizard or
null
-
bundleChanged
- Specified by:
bundleChangedin interfaceBundleListener
-
createWorkingSetSelectionDialog
public IWorkingSetSelectionDialog createWorkingSetSelectionDialog(Shell parent, boolean multi, String[] workingsSetIds) Description copied from interface:IWorkingSetManagerCreates a working set selection dialog that lists all working sets with the specified ids and allows the user to add, remove and edit working sets with the specified ids. The caller is responsible for opening the dialog withIWorkingSetSelectionDialog#open, and subsequently extracting the selected working sets usingIWorkingSetSelectionDialog#getSelection.- Specified by:
createWorkingSetSelectionDialogin interfaceIWorkingSetManager- Parameters:
parent- the parent shell of the working set selection dialogmulti- true=IWorkingSetSelectionDialog#getSelection()returns the working sets chosen in the dialog as an array of working set. false=IWorkingSetSelectionDialog#getSelection()returns an array having a single aggregate working set of all working sets selected in the dialog.workingsSetIds- a list of working set ids which are valid workings sets to be selected, created, removed or edited, ornullif all currently available working set types are valid- Returns:
- a working set selection dialog
-
saveState
Save the state to the state file.- Throws:
IOException
-
addExtension
Description copied from interface:IExtensionChangeHandlerThis method is called whenever an extension conforming to the extension point filter is being added to the registry. This method does not automatically register objects to the tracker.- Specified by:
addExtensionin interfaceIExtensionChangeHandler- Parameters:
tracker- a tracker to which the handler has been registeredextension- the extension being added
-
removeExtension
Description copied from interface:IExtensionChangeHandlerThis method is called after the removal of an extension.- Specified by:
removeExtensionin interfaceIExtensionChangeHandler- Parameters:
extension- the extension being removedobjects- the objects that were associated with the removed extension
-
addToWorkingSets
Description copied from interface:IWorkingSetManagerUtility method that will add theelementto each given working set inworkingSetsif possible. This method will invokeIWorkingSet.adaptElements(IAdaptable[])for the element on each working set and the result of this method will be used rather than the original element in the addition operation.- Specified by:
addToWorkingSetsin interfaceIWorkingSetManager- Parameters:
element- the element to adapt and then add to the working setsworkingSets- the working sets to add the element to
-
setRecentWorkingSetsLength
public void setRecentWorkingSetsLength(int length) Description copied from interface:IWorkingSetManagerSets maximum length of the recent working sets list.- Specified by:
setRecentWorkingSetsLengthin interfaceIWorkingSetManager- Parameters:
length- maximum number of recent working sets to be kept in the list
-
getRecentWorkingSetsLength
public int getRecentWorkingSetsLength()Description copied from interface:IWorkingSetManagerReturns the maximum length of the recent working sets list.- Specified by:
getRecentWorkingSetsLengthin interfaceIWorkingSetManager- Returns:
- the maximum length of the recent working sets list.
-