Class SyncState

  • All Implemented Interfaces:
    org.eclipse.core.runtime.jobs.IJobChangeListener

    public class SyncState
    extends java.lang.Object
    implements org.eclipse.core.runtime.jobs.IJobChangeListener
    Synchronization state class or Java in regards to refactoring.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidaboutToRun​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
      Notification that a job is about to be run.
      static voidaddSyncStateListener​(ISyncStateListener listener)
      Adds a listener for synchronized state.
      voidawake​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
      Notification that a job was previously sleeping and has now been rescheduled to run.
      static voidbuildStarted()
      Called from workspace when a build starts using resource change listener rather than job checking, because a Job is often triggered but not doing anything in the end.
      voiddone​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
      Notification that a job has completed execution, either due to cancellation, successful completion, or failure.
      static voidenterInhibitState()
      Called whenever the workspace changes in such a way that it would require a build operation.
      static intgetState()
      Gets the current state.
      static booleanisSynchronized()
      Checks if refactor-styled operations should be prohibited due to the unsynchronized state.
      static voidremoveSyncStateListener​(ISyncStateListener listener)
      Removes a listener for synchronized state.
      voidrunning​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
      Notification that a job has started running.
      voidscheduled​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
      Notification that a job is being added to the queue of scheduled jobs.
      static voidsetAutoBuilding​(boolean on)
      Turn on auto-building.
      voidsleeping​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
      Notification that a job was waiting to run and has now been put in the sleeping state.
      static voidstart()
      Called when the first Module project is opened.
      static voidstop()
      Called when the last Module project is closed or the plug-in is stopped.
      • Methods inherited from class java.lang.Object

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

      • addSyncStateListener

        public static void addSyncStateListener​(ISyncStateListener listener)
        Adds a listener for synchronized state.
      • removeSyncStateListener

        public static void removeSyncStateListener​(ISyncStateListener listener)
        Removes a listener for synchronized state.
      • start

        public static void start()
        Called when the first Module project is opened.
      • stop

        public static void stop()
        Called when the last Module project is closed or the plug-in is stopped.
      • enterInhibitState

        public static void enterInhibitState()
        Called whenever the workspace changes in such a way that it would require a build operation.
      • isSynchronized

        public static boolean isSynchronized()
        Checks if refactor-styled operations should be prohibited due to the unsynchronized state.
      • getState

        public static int getState()
        Gets the current state.
        Returns:
        On of the values READY, INHIBIT, BUSY or AUTOBUILD_DISABLED.
      • setAutoBuilding

        public static void setAutoBuilding​(boolean on)
                                    throws org.eclipse.core.runtime.CoreException
        Turn on auto-building.
        Parameters:
        on - Flag.
        Throws:
        org.eclipse.core.runtime.CoreException - If it failed changing the state.
      • buildStarted

        public static void buildStarted()
        Called from workspace when a build starts using resource change listener rather than job checking, because a Job is often triggered but not doing anything in the end.
      • aboutToRun

        public void aboutToRun​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
        Notification that a job is about to be run. Listeners are allowed to sleep, cancel, or change the priority of the job before it is started (and as a result may prevent the run from actually occurring).
        Specified by:
        aboutToRun in interface org.eclipse.core.runtime.jobs.IJobChangeListener
        Parameters:
        event - the event details
      • awake

        public void awake​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
        Notification that a job was previously sleeping and has now been rescheduled to run.
        Specified by:
        awake in interface org.eclipse.core.runtime.jobs.IJobChangeListener
        Parameters:
        event - the event details
      • done

        public void done​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
        Notification that a job has completed execution, either due to cancellation, successful completion, or failure. The event status object indicates how the job finished, and the reason for failure, if applicable.
        Specified by:
        done in interface org.eclipse.core.runtime.jobs.IJobChangeListener
        Parameters:
        event - the event details
      • scheduled

        public void scheduled​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
        Notification that a job is being added to the queue of scheduled jobs. The event details includes the scheduling delay before the job should start running.
        Specified by:
        scheduled in interface org.eclipse.core.runtime.jobs.IJobChangeListener
        Parameters:
        event - the event details, including the job instance and the scheduling delay
      • sleeping

        public void sleeping​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
        Notification that a job was waiting to run and has now been put in the sleeping state.
        Specified by:
        sleeping in interface org.eclipse.core.runtime.jobs.IJobChangeListener
        Parameters:
        event - the event details
      • running

        public void running​(org.eclipse.core.runtime.jobs.IJobChangeEvent event)
        Notification that a job has started running.
        Specified by:
        running in interface org.eclipse.core.runtime.jobs.IJobChangeListener
        Parameters:
        event - the event details