@Override public void resetDocument(Object element) throws CoreException { fParentProvider.resetDocument(element); }
public void resetDocument(Object element) throws CoreException { fParentProvider.resetDocument(element); }
@Override public void resetDocument(Object element) throws CoreException { final FileInfo info= fFileInfoMap.get(element); if (info != null) { DocumentProviderOperation operation= new DocumentProviderOperation() { @Override protected void execute(IProgressMonitor monitor) throws CoreException { info.fTextFileBuffer.revert(monitor); if (info.fModel instanceof AbstractMarkerAnnotationModel) { AbstractMarkerAnnotationModel markerModel= (AbstractMarkerAnnotationModel) info.fModel; markerModel.resetMarkers(); } } @Override public ISchedulingRule getSchedulingRule() { if (info.fElement instanceof IFileEditorInput) { IFileEditorInput input= (IFileEditorInput) info.fElement; return fResourceRuleFactory.refreshRule((input).getFile()); } return null; } }; executeOperation(operation, getProgressMonitor()); } else { getParentProvider().resetDocument(element); } }
public void resetDocument(Object element) throws CoreException { final FileInfo info= (FileInfo) fFileInfoMap.get(element); if (info != null) { DocumentProviderOperation operation= new DocumentProviderOperation() { /* * @see org.eclipse.ui.editors.text.TextFileDocumentProvider.DocumentProviderOperation#execute(org.eclipse.core.runtime.IProgressMonitor) */ protected void execute(IProgressMonitor monitor) throws CoreException { info.fTextFileBuffer.revert(monitor); if (info.fModel instanceof AbstractMarkerAnnotationModel) { AbstractMarkerAnnotationModel markerModel= (AbstractMarkerAnnotationModel) info.fModel; markerModel.resetMarkers(); } } /* * @see org.eclipse.ui.editors.text.TextFileDocumentProvider.DocumentProviderOperation#getSchedulingRule() */ public ISchedulingRule getSchedulingRule() { if (info.fElement instanceof IFileEditorInput) { IFileEditorInput input= (IFileEditorInput) info.fElement; return fResourceRuleFactory.refreshRule((input).getFile()); } return null; } }; executeOperation(operation, getProgressMonitor()); } else { getParentProvider().resetDocument(element); } }
@Override public void setEncoding(String encoding) { if (fDocumentKey == null || fDocumentProvider == null) { return; } if (fDocumentProvider instanceof IStorageDocumentProvider) { IStorageDocumentProvider provider = (IStorageDocumentProvider) fDocumentProvider; String current = provider.getEncoding(fDocumentKey); boolean dirty = fDocumentProvider.canSaveDocument(fDocumentKey); if (!dirty) { String internal = encoding == null ? "" : encoding; //$NON-NLS-1$ if (!internal.equals(current)) { provider.setEncoding(fDocumentKey, encoding); try { fDocumentProvider.resetDocument(fDocumentKey); } catch (CoreException e) { CompareUIPlugin.log(e); } finally { update(true); updateStructure(fLeg); } } } } }
/** * Performs revert and handles errors appropriately. * <p> * Subclasses may extend. * </p> * * @since 3.0 */ protected void performRevert() { IDocumentProvider provider= getDocumentProvider(); if (provider == null) return; try { provider.aboutToChange(getEditorInput()); provider.resetDocument(getEditorInput()); editorSaved(); } catch (CoreException x) { IStatus status= x.getStatus(); if (status == null || status.getSeverity() != IStatus.CANCEL ) { Shell shell= getSite().getShell(); String title= EditorMessages.Editor_error_revert_title; String msg= EditorMessages.Editor_error_revert_message; ErrorDialog.openError(shell, title, msg, x.getStatus()); } } finally { provider.changed(getEditorInput()); } }
/** * Performs revert and handles errors appropriately. * <p> * Subclasses may extend. * </p> * * @since 3.0 */ protected void performRevert() { IDocumentProvider provider= getDocumentProvider(); if (provider == null) return; try { provider.aboutToChange(getEditorInput()); provider.resetDocument(getEditorInput()); editorSaved(); } catch (CoreException x) { IStatus status= x.getStatus(); if (status == null || status.getSeverity() != IStatus.CANCEL ) { Shell shell= getSite().getShell(); String title= EditorMessages.Editor_error_revert_title; String msg= EditorMessages.Editor_error_revert_message; ErrorDialog.openError(shell, title, msg, x.getStatus()); } } finally { provider.changed(getEditorInput()); } }
/** * Performs revert and handles errors appropriately. * <p> * Subclasses may extend. * </p> * * @since 3.0 */ protected void performRevert() { IDocumentProvider provider= getDocumentProvider(); if (provider == null) return; try { provider.aboutToChange(getEditorInput()); provider.resetDocument(getEditorInput()); editorSaved(); } catch (CoreException x) { IStatus status= x.getStatus(); if (status == null || status.getSeverity() != IStatus.CANCEL ) { Shell shell= getSite().getShell(); String title= EditorMessages.Editor_error_revert_title; String msg= EditorMessages.Editor_error_revert_message; ErrorDialog.openError(shell, title, msg, x.getStatus()); } } finally { provider.changed(getEditorInput()); } }
private void updateTextualEditor() { ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager(); fTargetDocument.removeDocumentListener(fTargetDocumentListener); try { TargetDefinitionPersistenceHelper.persistXML(getTarget(), manager.getTextFileBuffer(fTargetDocument)); fTextualEditor.getDocumentProvider().resetDocument(getEditorInput()); } catch (CoreException | ParserConfigurationException | TransformerException | IOException | SAXException e) { PDEPlugin.log(e); } fTargetDocument.addDocumentListener(fTargetDocumentListener); }