Package org.eclipse.jdt.ui.refactoring
Class RefactoringSaveHelper
java.lang.Object
org.eclipse.jdt.ui.refactoring.RefactoringSaveHelper
Helper to save dirty editors prior to starting a refactoring.
- Since:
- 3.5
- See Also:
- Restriction:
- This class is not intended to be subclassed by clients.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intSave mode to save all dirty editors.static final intSave mode to save all dirty editors (always ask).static final intSave mode to not save any editors.static final intSave mode to save all editors that are known to cause trouble for Java refactorings, e.g. -
Constructor Summary
ConstructorsConstructorDescriptionRefactoringSaveHelper(int saveMode) Creates a refactoring save helper with the given save mode. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether this save helper did actually save any files.booleansaveEditors(org.eclipse.swt.widgets.Shell shell) Saves all editors.voidTriggers an incremental build if this save helper did save files before.
-
Field Details
-
SAVE_ALL_ALWAYS_ASK
public static final int SAVE_ALL_ALWAYS_ASKSave mode to save all dirty editors (always ask).- See Also:
-
SAVE_ALL
public static final int SAVE_ALLSave mode to save all dirty editors.- See Also:
-
SAVE_NOTHING
public static final int SAVE_NOTHINGSave mode to not save any editors.- See Also:
-
SAVE_REFACTORING
public static final int SAVE_REFACTORINGSave mode to save all editors that are known to cause trouble for Java refactorings, e.g. editors on compilation units that are not in working copy mode.- See Also:
-
-
Constructor Details
-
RefactoringSaveHelper
public RefactoringSaveHelper(int saveMode) Creates a refactoring save helper with the given save mode.- Parameters:
saveMode- one of the SAVE_* constants
-
-
Method Details
-
saveEditors
public boolean saveEditors(org.eclipse.swt.widgets.Shell shell) Saves all editors. Depending on thePreferenceConstants.REFACTOR_SAVE_ALL_EDITORSpreference, the user is asked to save affected dirty editors.- Parameters:
shell- the parent shell for the confirmation dialog- Returns:
trueif save was successful and refactoring can proceed; false if the refactoring must be cancelled
-
triggerIncrementalBuild
public void triggerIncrementalBuild()Triggers an incremental build if this save helper did save files before. -
didSaveFiles
public boolean didSaveFiles()Returns whether this save helper did actually save any files.- Returns:
trueiff files have been saved
-