@Override public void execute(IProgressMonitor pm) throws CoreException { if (input instanceof CompareEditorInput) ((CompareEditorInput)input).saveChanges(pm); } };
/** * Flush the contents of any viewers into the compare input. * @param monitor a progress monitor * @throws CoreException */ protected void flushViewers(IProgressMonitor monitor) throws CoreException { editorInput.saveChanges(monitor); }
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { saveChanges(monitor); } catch (CoreException e) { throw new InvocationTargetException(e); } }
/** * Flush the contents of any viewers into the compare input. * @param monitor a progress monitor * @throws CoreException */ protected void flushViewers(IProgressMonitor monitor) throws CoreException { if (editorInput instanceof SaveablesCompareEditorInput) { ((SaveablesCompareEditorInput) editorInput).saveChanges(monitor, this); } else { editorInput.saveChanges(monitor); } }
/** * The <code>OK</code> button was pressed in a dialog. If one or both of * the sides of the input is editable then any changes will be saved. If the * input is for edition selection (see {@link #isEditionSelectionDialog()}), * it is up to subclasses to override this method in order to perform the * appropriate operation on the selected edition. * * @return whether the dialog should be closed or not. * @since 3.3 */ public boolean okPressed() { if (isEditable()) { if (!saveChanges()) return false; } return true; }
/** * The <code>OK</code> button was pressed in a dialog. If one or both of * the sides of the input is editable then any changes will be saved. If the * input is for edition selection (see {@link #isEditionSelectionDialog()}), * it is up to subclasses to override this method in order to perform the * appropriate operation on the selected edition. * * @return whether the dialog should be closed or not. * @since 3.3 */ public boolean okPressed() { if (isEditable()) { if (!saveChanges()) return false; } return true; }
private boolean saveChanges() { try { PlatformUI.getWorkbench().getProgressService().run(true, true, monitor -> { try { saveChanges(monitor); } catch (CoreException e) { throw new InvocationTargetException(e); } }); return true; } catch (InterruptedException x) { // Ignore } catch (OperationCanceledException x) { // Ignore } catch (InvocationTargetException x) { ErrorDialog.openError(fComposite.getShell(), CompareMessages.CompareDialog_error_title, null, new Status(IStatus.ERROR, CompareUIPlugin.PLUGIN_ID, 0, NLS.bind(CompareMessages.CompareDialog_error_message, x.getTargetException().getMessage()), x.getTargetException())); } return false; }
public void saveChanges(IProgressMonitor pm) throws CoreException { super.saveChanges(pm); if (fRoot instanceof DiffNode) { try { commit(pm, (DiffNode) fRoot); } finally { if (fDiffViewer != null) fDiffViewer.refresh(); setDirty(false); } } }
@Override public void saveChanges(IProgressMonitor pm) throws CoreException { super.saveChanges(pm); if (fRoot instanceof DiffNode) { try { commit(pm, (DiffNode) fRoot); } finally { if (fDiffViewer != null) fDiffViewer.refresh(); setDirty(false); } } }