Class SaveableHelper

java.lang.Object
org.eclipse.ui.internal.SaveableHelper

public class SaveableHelper extends Object
Helper class for prompting to save dirty views or editors.
Since:
3.0.1
  • Field Details

    • USER_RESPONSE

      public static final int USER_RESPONSE
      The helper must prompt.
      See Also:
  • Constructor Details

    • SaveableHelper

      public SaveableHelper()
  • Method Details

    • testSetAutomatedResponse

      public static void testSetAutomatedResponse(int response)
      FOR USE BY THE AUTOMATED TEST HARNESS ONLY. Sets the response to use when savePart is called with confirm=true.
      Parameters:
      response - 0 for yes, 1 for no, 2 for cancel, -1 for default (prompt)
    • testGetAutomatedResponse

      public static int testGetAutomatedResponse()
      FOR USE BY THE AUTOMATED TEST HARNESS ONLY. Sets the response to use when savePart is called with confirm=true.
      Returns:
      0 for yes, 1 for no, 2 for cancel, -1 for default (prompt)
    • savePart

      public static boolean savePart(ISaveablePart saveable, IWorkbenchPart part, IWorkbenchWindow window, boolean confirm)
      Saves the workbench part.
      Parameters:
      saveable - the part
      part - the same part
      window - the workbench window
      confirm - request confirmation
      Returns:
      true for continue, false if the operation was canceled.
    • needsSave

      public static boolean needsSave(ISaveablesSource modelSource)
      Returns whether the model source needs saving. This is true if any of the active models are dirty. This logic must correspond with saveModels(org.eclipse.ui.ISaveablesSource, org.eclipse.ui.IWorkbenchWindow, boolean) above.
      Parameters:
      modelSource - the model source
      Returns:
      true if save is required, false otherwise
      Since:
      3.2
    • doSaveModel

      public static void doSaveModel(Saveable model, IProgressMonitor progressMonitor, IShellProvider shellProvider, boolean blockUntilSaved)
    • waitForBackgroundSaveJobs

      public static boolean waitForBackgroundSaveJobs(List modelsToSave)
      Waits for the background save jobs (if any) of the given saveables to complete. This may open a progress dialog with the option to cancel.
      Returns:
      true if the user canceled.
    • getSaveable

      public static ISaveablePart getSaveable(Object o)
    • isSaveable

      public static boolean isSaveable(Object o)
    • getSaveable2

      public static ISaveablePart2 getSaveable2(Object o)
    • isSaveable2

      public static boolean isSaveable2(Object o)
    • isDirtyStateSupported

      public static boolean isDirtyStateSupported(IWorkbenchPart part)