private void saveOrDiscardIfNeeded(FileEditorInput file) {
   TextFileDocumentProvider docProvider = file == null ? null : getTextDocumentProvider(file);
   if (docProvider != null && file != null && file.exists() && inputConnected) {
     if (docProvider.canSaveDocument(file)
         && ui.confirmOperation(
                 "Changes Detected",
                 "Manifest file '"
                     + file.getFile().getFullPath().toOSString()
                     + "' has been changed. Do you want to save changes or discard them?",
                 new String[] {"Save", "Discard"},
                 0)
             == 0) {
       try {
         docProvider.saveDocument(
             new NullProgressMonitor(), file, docProvider.getDocument(file), true);
       } catch (CoreException e) {
         Log.log(e);
         ui.errorPopup("Failed Saving File", ExceptionUtil.getMessage(e));
       }
     } else {
       try {
         docProvider.resetDocument(file);
       } catch (CoreException e) {
         Log.log(e);
       }
     }
     disconnect(docProvider, file);
   }
 }
Ejemplo n.º 2
0
 public boolean exists() {
   return innerEidtorInput.exists();
 }