Package de.loskutov.anyedit.actions
Class SaveToFileAction
- java.lang.Object
-
- org.eclipse.core.commands.common.EventManager
-
- org.eclipse.core.commands.AbstractHandler
-
- de.loskutov.anyedit.actions.AbstractAction
-
- de.loskutov.anyedit.actions.AbstractOpenAction
-
- de.loskutov.anyedit.actions.SaveToFileAction
-
- All Implemented Interfaces:
org.eclipse.core.commands.IHandler
,org.eclipse.core.commands.IHandler2
,org.eclipse.ui.IActionDelegate
,org.eclipse.ui.IEditorActionDelegate
,org.eclipse.ui.IViewActionDelegate
,org.eclipse.ui.IWorkbenchWindowActionDelegate
- Direct Known Subclasses:
SaveToFileParticipant
public class SaveToFileAction extends AbstractOpenAction
-
-
Field Summary
Fields Modifier and Type Field Description private static int
APPEND
private static int
CANCEL
private static java.lang.String
lastUsedFile
private static int
OVERRIDE
-
Fields inherited from class de.loskutov.anyedit.actions.AbstractAction
editor
-
-
Constructor Summary
Constructors Constructor Description SaveToFileAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private int
checkForExisting(java.io.File file)
private boolean
checkout(org.eclipse.core.resources.IFile file, int overrideOrAppend)
private void
doSave(org.eclipse.jface.text.IDocument doc, org.eclipse.jface.text.ITextSelection selection, java.io.File file, int overrideOrAppend)
private java.io.File
getFileFromUser()
protected void
handleAction(org.eclipse.jface.text.IDocument doc, org.eclipse.jface.viewers.ISelectionProvider selectionProvider, org.eclipse.ui.IEditorInput currentInput)
-
Methods inherited from class de.loskutov.anyedit.actions.AbstractOpenAction
run, runWithViewer, setActiveEditor
-
Methods inherited from class de.loskutov.anyedit.actions.AbstractAction
createActiveEditorDelegate, dispose, execute, getCombinedPreferences, getEditor, getFile, getViewPart, getWindow, init, init, selectionChanged, setEditor, setFile
-
Methods inherited from class org.eclipse.core.commands.AbstractHandler
addHandlerListener, fireHandlerChanged, hasListeners, isEnabled, isHandled, removeHandlerListener, setBaseEnabled, setEnabled
-
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
-
-
-
Field Detail
-
CANCEL
private static final int CANCEL
- See Also:
- Constant Field Values
-
APPEND
private static final int APPEND
- See Also:
- Constant Field Values
-
OVERRIDE
private static final int OVERRIDE
- See Also:
- Constant Field Values
-
lastUsedFile
private static java.lang.String lastUsedFile
-
-
Method Detail
-
handleAction
protected void handleAction(org.eclipse.jface.text.IDocument doc, org.eclipse.jface.viewers.ISelectionProvider selectionProvider, org.eclipse.ui.IEditorInput currentInput)
- Specified by:
handleAction
in classAbstractOpenAction
-
doSave
private void doSave(org.eclipse.jface.text.IDocument doc, org.eclipse.jface.text.ITextSelection selection, java.io.File file, int overrideOrAppend)
-
checkout
private boolean checkout(org.eclipse.core.resources.IFile file, int overrideOrAppend)
- Parameters:
file
- non nulloverrideOrAppend
-- Returns:
- true if file doesn't exist and was created or writable
-
checkForExisting
private int checkForExisting(java.io.File file)
- Parameters:
file
- non null- Returns:
- OVERRIDE if file not exists or exists and may be overriden, APPEND if it exists and should be reused, CANCEL if action should be cancelled
-
getFileFromUser
private java.io.File getFileFromUser()
-
-