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.
  • Constructor Details

    • AbstractWorkingSetManager

      protected AbstractWorkingSetManager(BundleContext context)
  • Method Details

    • dispose

      public void dispose()
      Description copied from interface: IWorkingSetManager
      Disposes the working set manager.
      Specified by:
      dispose in interface IWorkingSetManager
    • createWorkingSet

      public IWorkingSet createWorkingSet(String name, IAdaptable[] elements)
      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 interface IWorkingSetManager
      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

      public IWorkingSet createAggregateWorkingSet(String name, String label, IWorkingSet[] components)
      Description copied from interface: IWorkingSetManager
      Create a working set that is the union of a collection of other working sets. One connected (via IWorkingSetManager.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 interface IWorkingSetManager
      Parameters:
      name - the name of the new working set. Should not have leading or trailing whitespace.
      label - the user-friendly label the working set
      components - the component working sets
      Returns:
      a new working set with the specified name and content
    • createWorkingSet

      public IWorkingSet createWorkingSet(IMemento memento)
      Description copied from interface: IWorkingSetManager
      Re-creates and returns a working set from the state captured within the given memento.
      Specified by:
      createWorkingSet in interface IWorkingSetManager
      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

      public void addWorkingSet(IWorkingSet workingSet)
      Description copied from interface: IWorkingSetManager
      Adds a working set to the receiver. The working set must not exist yet.
      Specified by:
      addWorkingSet in interface IWorkingSetManager
      Parameters:
      workingSet - the working set to add
    • internalRemoveWorkingSet

      protected boolean internalRemoveWorkingSet(IWorkingSet workingSet)
    • getWorkingSets

      public IWorkingSet[] 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 whose IWorkingSet.isVisible() method returns false will not be included in this array. For a complete list of working sets please use IWorkingSetManager.getAllWorkingSets().
      Specified by:
      getWorkingSets in interface IWorkingSetManager
      Returns:
      the working sets stored in the receiver
    • getAllWorkingSets

      public IWorkingSet[] 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 interface IWorkingSetManager
      Returns:
      the working sets stored in the receiver
      See Also:
    • getWorkingSet

      public IWorkingSet getWorkingSet(String name)
      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 interface IWorkingSetManager
      Parameters:
      name - the name of the working set to return
      Returns:
      the working set with the specified name.
    • getRecentWorkingSets

      public IWorkingSet[] 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 interface IWorkingSetManager
      Returns:
      the list of most recently used working sets
    • internalAddRecentWorkingSet

      protected void internalAddRecentWorkingSet(IWorkingSet workingSet)
      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

      public boolean equals(Object object)
      Tests the receiver and the object for equality
      Overrides:
      equals in class Object
      Parameters:
      object - object to compare the receiver to
      Returns:
      true=the object equals the receiver, it has the same working sets. false otherwise
    • hashCode

      public int hashCode()
      Returns the hash code.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code.
    • addPropertyChangeListener

      public void addPropertyChangeListener(IPropertyChangeListener listener)
      Description copied from interface: IWorkingSetManager
      Adds a property change listener.
      Specified by:
      addPropertyChangeListener in interface IWorkingSetManager
      Parameters:
      listener - the property change listener to add
    • removePropertyChangeListener

      public void removePropertyChangeListener(IPropertyChangeListener listener)
      Description copied from interface: IWorkingSetManager
      Removes the property change listener.
      Specified by:
      removePropertyChangeListener in interface IWorkingSetManager
      Parameters:
      listener - the property change listener to remove
    • firePropertyChange

      protected void firePropertyChange(String changeId, Object oldValue, Object newValue)
      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_CHANGE
      oldValue - 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 changed
      propertyChangeId - the changed property. one of CHANGE_WORKING_SET_CONTENT_CHANGE, CHANGE_WORKING_SET_LABEL_CHANGE, and CHANGE_WORKING_SET_NAME_CHANGE
      oldValue - the old value
    • saveWorkingSetState

      public void saveWorkingSetState(IMemento memento)
      Saves all persistable working sets in the persistence store.
      Parameters:
      memento - the persistence store
      See Also:
    • restoreWorkingSetState

      protected void restoreWorkingSetState(IMemento memento)
      Recreates all working sets from the persistence store and adds them to the receiver.
      Parameters:
      memento - the persistence store
    • restoreWorkingSet

      protected IWorkingSet restoreWorkingSet(IMemento memento)
      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

      protected void saveMruList(IMemento memento)
      Saves the list of most recently used working sets in the persistence store.
      Parameters:
      memento - the persistence store
    • restoreMruList

      protected void restoreMruList(IMemento memento)
      Restores the list of most recently used working sets from the persistence store.
      Parameters:
      memento - the persistence store
    • createWorkingSetEditWizard

      public IWorkingSetEditWizard createWorkingSetEditWizard(IWorkingSet workingSet)
      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 interface IWorkingSetManager
      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 loaded null is returned.
      Since:
      2.1
      See Also:
    • createWorkingSetSelectionDialog

      @Deprecated public IWorkingSetSelectionDialog createWorkingSetSelectionDialog(Shell parent)
      Deprecated.
      use createWorkingSetSelectionDialog(parent, true) instead
      Specified by:
      createWorkingSetSelectionDialog in interface IWorkingSetManager
      Parameters:
      parent - the parent shell
      Returns:
      the dialog
    • createWorkingSetSelectionDialog

      public IWorkingSetSelectionDialog createWorkingSetSelectionDialog(Shell parent, boolean multi)
      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 with IWorkingSetSelectionDialog#open, and subsequently extracting the selected working sets using IWorkingSetSelectionDialog#getSelection.
      Specified by:
      createWorkingSetSelectionDialog in interface IWorkingSetManager
      Parameters:
      parent - the parent shell of the working set selection dialog
      multi - 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

      public IWorkingSetNewWizard createWorkingSetNewWizard(String[] workingSetIds)
      Creates a working set new wizard. The wizard will allow creating new working sets. Returns null 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 interface IWorkingSetManager
      Parameters:
      workingSetIds - a list of working set ids which are valid workings sets to be created or null if all currently available working set types are valid
      Returns:
      the working set new wizard or null
    • bundleChanged

      public void bundleChanged(BundleEvent event)
      Specified by:
      bundleChanged in interface BundleListener
    • 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 with IWorkingSetSelectionDialog#open, and subsequently extracting the selected working sets using IWorkingSetSelectionDialog#getSelection.
      Specified by:
      createWorkingSetSelectionDialog in interface IWorkingSetManager
      Parameters:
      parent - the parent shell of the working set selection dialog
      multi - 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, or null if all currently available working set types are valid
      Returns:
      a working set selection dialog
    • saveState

      public void saveState(File stateFile) throws IOException
      Save the state to the state file.
      Throws:
      IOException
    • addExtension

      public void addExtension(IExtensionTracker tracker, IExtension extension)
      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 interface IExtensionChangeHandler
      Parameters:
      tracker - a tracker to which the handler has been registered
      extension - the extension being added
    • removeExtension

      public void removeExtension(IExtension extension, Object[] objects)
      Description copied from interface: IExtensionChangeHandler
      This method is called after the removal of an extension.
      Specified by:
      removeExtension in interface IExtensionChangeHandler
      Parameters:
      extension - the extension being removed
      objects - the objects that were associated with the removed extension
    • addToWorkingSets

      public void addToWorkingSets(IAdaptable element, IWorkingSet[] workingSets)
      Description copied from interface: IWorkingSetManager
      Utility method that will add the element to each given working set in workingSets if possible. This method will invoke IWorkingSet.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 interface IWorkingSetManager
      Parameters:
      element - the element to adapt and then add to the working sets
      workingSets - 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 interface IWorkingSetManager
      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 interface IWorkingSetManager
      Returns:
      the maximum length of the recent working sets list.