Class 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  
    • 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 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.eclipse.ui.IActionDelegate

        selectionChanged
    • Constructor Detail

      • SaveToFileAction

        public SaveToFileAction()
    • 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 class AbstractOpenAction
      • 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 null
        overrideOrAppend -
        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()