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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addExtension
(IExtensionTracker tracker, IExtension extension) This method is called whenever an extension conforming to the extension point filter is being added to the registry.void
Adds a property change listener.void
addToWorkingSets
(IAdaptable element, IWorkingSet[] workingSets) Utility method that will add theelement
to each given working set inworkingSets
if possible.void
addWorkingSet
(IWorkingSet workingSet) Adds a working set to the receiver.void
bundleChanged
(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.void
dispose()
Disposes the working set manager.boolean
Tests the receiver and the object for equalityprotected void
firePropertyChange
(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.int
Returns 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.int
hashCode()
Returns the hash code.protected void
internalAddRecentWorkingSet
(IWorkingSet workingSet) Adds the specified working set to the list of recently used working sets.protected boolean
internalRemoveWorkingSet
(IWorkingSet workingSet) void
removeExtension
(IExtension extension, Object[] objects) This method is called after the removal of an extension.void
Removes the property change listener.protected void
restoreMruList
(IMemento memento) Restores the list of most recently used working sets from the persistence store.protected IWorkingSet
restoreWorkingSet
(IMemento memento) Recreates a working set from the persistence store.protected void
restoreWorkingSetState
(IMemento memento) Recreates all working sets from the persistence store and adds them to the receiver.protected void
saveMruList
(IMemento memento) Saves the list of most recently used working sets in the persistence store.void
Save the state to the state file.void
saveWorkingSetState
(IMemento memento) Saves all persistable working sets in the persistence store.void
setRecentWorkingSetsLength
(int length) Sets maximum length of the recent working sets list.void
workingSetChanged
(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, removeListenerObject
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.ui.IWorkingSetManager
addRecentWorkingSet, removeWorkingSet
-
Constructor Details
-
AbstractWorkingSetManager
-
-
Method Details
-
dispose
public void dispose()Description copied from interface:IWorkingSetManager
Disposes the working set manager.- Specified by:
dispose
in interfaceIWorkingSetManager
-
createWorkingSet
Description copied from interface:IWorkingSetManager
Creates a new working set. The working set is not added to the working set manager.- Specified by:
createWorkingSet
in 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:IWorkingSetManager
Create 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:
createAggregateWorkingSet
in 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:IWorkingSetManager
Re-creates and returns a working set from the state captured within the given memento.- Specified by:
createWorkingSet
in interfaceIWorkingSetManager
- Parameters:
memento
- a memento containing the state for the working set- Returns:
- the restored working set, or
null
if it could not be created
-
addWorkingSet
Description copied from interface:IWorkingSetManager
Adds a working set to the receiver. The working set must not exist yet.- Specified by:
addWorkingSet
in interfaceIWorkingSetManager
- Parameters:
workingSet
- the working set to add
-
internalRemoveWorkingSet
-
getWorkingSets
Description copied from interface:IWorkingSetManager
Returns 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:
getWorkingSets
in interfaceIWorkingSetManager
- Returns:
- the working sets stored in the receiver
-
getAllWorkingSets
Description copied from interface:IWorkingSetManager
Returns an array of all working sets stored in the receiver including those that are marked as being not visible.- Specified by:
getAllWorkingSets
in interfaceIWorkingSetManager
- Returns:
- the working sets stored in the receiver
- See Also:
-
getWorkingSet
Description copied from interface:IWorkingSetManager
Returns the working set with the specified name. Returns null if there is no working set with that name.- Specified by:
getWorkingSet
in interfaceIWorkingSetManager
- Parameters:
name
- the name of the working set to return- Returns:
- the working set with the specified name.
-
getRecentWorkingSets
Description copied from interface:IWorkingSetManager
Returns the list of most recently used working sets. The most recently used working set appears first in the list.- Specified by:
getRecentWorkingSets
in 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:IWorkingSetManager
Adds a property change listener.- Specified by:
addPropertyChangeListener
in interfaceIWorkingSetManager
- Parameters:
listener
- the property change listener to add
-
removePropertyChangeListener
Description copied from interface:IWorkingSetManager
Removes the property change listener.- Specified by:
removePropertyChangeListener
in 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:IWorkingSetManager
Creates 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:
createWorkingSetEditWizard
in 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
null
if 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 loadednull
is returned. - Since:
- 2.1
- See Also:
-
createWorkingSetSelectionDialog
Deprecated.use createWorkingSetSelectionDialog(parent, true) instead- Specified by:
createWorkingSetSelectionDialog
in interfaceIWorkingSetManager
- Parameters:
parent
- the parent shell- Returns:
- the dialog
-
createWorkingSetSelectionDialog
Description copied from interface:IWorkingSetManager
Creates 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:
createWorkingSetSelectionDialog
in 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. Returnsnull
if 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:
createWorkingSetNewWizard
in interfaceIWorkingSetManager
- Parameters:
workingSetIds
- a list of working set ids which are valid workings sets to be created ornull
if all currently available working set types are valid- Returns:
- the working set new wizard or
null
-
bundleChanged
- Specified by:
bundleChanged
in interfaceBundleListener
-
createWorkingSetSelectionDialog
public IWorkingSetSelectionDialog createWorkingSetSelectionDialog(Shell parent, boolean multi, String[] workingsSetIds) Description copied from interface:IWorkingSetManager
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. The caller is responsible for opening the dialog withIWorkingSetSelectionDialog#open
, and subsequently extracting the selected working sets usingIWorkingSetSelectionDialog#getSelection
.- Specified by:
createWorkingSetSelectionDialog
in 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, ornull
if 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:IExtensionChangeHandler
This 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:
addExtension
in interfaceIExtensionChangeHandler
- Parameters:
tracker
- a tracker to which the handler has been registeredextension
- the extension being added
-
removeExtension
Description copied from interface:IExtensionChangeHandler
This method is called after the removal of an extension.- Specified by:
removeExtension
in interfaceIExtensionChangeHandler
- Parameters:
extension
- the extension being removedobjects
- the objects that were associated with the removed extension
-
addToWorkingSets
Description copied from interface:IWorkingSetManager
Utility method that will add theelement
to each given working set inworkingSets
if 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:
addToWorkingSets
in 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:IWorkingSetManager
Sets maximum length of the recent working sets list.- Specified by:
setRecentWorkingSetsLength
in interfaceIWorkingSetManager
- Parameters:
length
- maximum number of recent working sets to be kept in the list
-
getRecentWorkingSetsLength
public int getRecentWorkingSetsLength()Description copied from interface:IWorkingSetManager
Returns the maximum length of the recent working sets list.- Specified by:
getRecentWorkingSetsLength
in interfaceIWorkingSetManager
- Returns:
- the maximum length of the recent working sets list.
-