Package com.iizigo

Class SaveParticipant

  • All Implemented Interfaces:
    java.util.EventListener, org.eclipse.core.resources.ISaveParticipant

    public class SaveParticipant
    extends java.lang.Object
    implements org.eclipse.core.resources.ISaveParticipant
    The Module project save participant.
    Author:
    Christopher Mindus
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void doneSaving​(org.eclipse.core.resources.ISaveContext context)
      Tells this participant that the workspace save operation is now complete and it is free to go about its normal business.
      static SaveParticipant getInstance()
      Gets the instance.
      void prepareToSave​(org.eclipse.core.resources.ISaveContext context)
      Tells this participant that the workspace is about to be saved.
      void rollback​(org.eclipse.core.resources.ISaveContext context)
      Tells this participant to rollback its important state.
      void saving​(org.eclipse.core.resources.ISaveContext context)
      Tells this participant to save its important state because the workspace is being saved, as described in the supplied save context.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getInstance

        public static SaveParticipant getInstance()
        Gets the instance.
        Returns:
        The SaveParticipant singleton.
      • prepareToSave

        public void prepareToSave​(org.eclipse.core.resources.ISaveContext context)
                           throws org.eclipse.core.runtime.CoreException
        Tells this participant that the workspace is about to be saved. In preparation, the participant is expected to suspend its normal operation until further notice. saving will be next, followed by either doneSaving or rollback depending on whether the workspace save was successful.
        Specified by:
        prepareToSave in interface org.eclipse.core.resources.ISaveParticipant
        Parameters:
        context - The save context object.
        Throws:
        org.eclipse.core.runtime.CoreException - if this method fails to snapshot the state of this workspace.
      • doneSaving

        public void doneSaving​(org.eclipse.core.resources.ISaveContext context)
        Tells this participant that the workspace save operation is now complete and it is free to go about its normal business. Exceptions are not expected to be thrown at this point, so they should be handled internally.
        Specified by:
        doneSaving in interface org.eclipse.core.resources.ISaveParticipant
        Parameters:
        context - The save context object.
      • rollback

        public void rollback​(org.eclipse.core.resources.ISaveContext context)
        Tells this participant to rollback its important state. The context's previous state number indicates what it was prior to the failed save. Exceptions are not expected to be thrown at this point, so they should be handled internally.
        Specified by:
        rollback in interface org.eclipse.core.resources.ISaveParticipant
        Parameters:
        context - The save context object.
        See Also:
        ISaveContext.getPreviousSaveNumber()
      • saving

        public void saving​(org.eclipse.core.resources.ISaveContext context)
                    throws org.eclipse.core.runtime.CoreException
        Tells this participant to save its important state because the workspace is being saved, as described in the supplied save context.

        The basic contract for this method is the same for full saves, snapshots and project saves: the participant must absolutely guarantee that any important user data it has gathered will not be irrecoverably lost in the event of a crash. The only difference is in the space-time tradeoffs that the participant should make.

        • Full saves: the participant is encouraged to save additional non-essential information that will aid it in retaining user state and configuration information and quickly getting back in sync with the state of the platform at a later point.
        • Snapshots: the participant is discouraged from saving non-essential information that could be recomputed in the unlikely event of a crash. This life cycle event will happen often and participant actions should take an absolute minimum of time.
        • Project saves: the participant should only save project related data. It is discouraged from saving non-essential information that could be recomputed in the unlikely event of a crash.
        Specified by:
        saving in interface org.eclipse.core.resources.ISaveParticipant
        Parameters:
        context - The save context object.
        Throws:
        org.eclipse.core.runtime.CoreException - if this method fails.