Package org.eclipse.ui.internal
Class SaveableHelper
java.lang.Object
org.eclipse.ui.internal.SaveableHelper
Helper class for prompting to save dirty views or editors.
- Since:
- 3.0.1
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
doSaveModel
(Saveable model, IProgressMonitor progressMonitor, IShellProvider shellProvider, boolean blockUntilSaved) static ISaveablePart
static ISaveablePart2
static boolean
static boolean
isSaveable
(Object o) static boolean
static boolean
needsSave
(ISaveablesSource modelSource) Returns whether the model source needs saving.static boolean
savePart
(ISaveablePart saveable, IWorkbenchPart part, IWorkbenchWindow window, boolean confirm) Saves the workbench part.static int
FOR USE BY THE AUTOMATED TEST HARNESS ONLY.static void
testSetAutomatedResponse
(int response) FOR USE BY THE AUTOMATED TEST HARNESS ONLY.static boolean
waitForBackgroundSaveJobs
(List modelsToSave) Waits for the background save jobs (if any) of the given saveables to complete.
-
Field Details
-
USER_RESPONSE
public static final int USER_RESPONSEThe 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 whensavePart
is called withconfirm=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 whensavePart
is called withconfirm=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 partpart
- the same partwindow
- the workbench windowconfirm
- request confirmation- Returns:
true
for continue,false
if the operation was canceled.
-
needsSave
Returns whether the model source needs saving. This is true if any of the active models are dirty. This logic must correspond withsaveModels(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
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
-
isSaveable
-
getSaveable2
-
isSaveable2
-
isDirtyStateSupported
-