protected void validateState(IEditorInput input) { IDocumentProvider provider = getDocumentProvider(); if (!(provider instanceof IDocumentProviderExtension)) return; IDocumentProviderExtension extension = (IDocumentProviderExtension) provider; try { extension.validateState(input, getSite().getShell()); } catch (CoreException x) { IStatus status = x.getStatus(); if (status == null || status.getSeverity() != IStatus.CANCEL) { Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID); ILog log = Platform.getLog(bundle); log.log(x.getStatus()); Shell shell = getSite().getShell(); String title = "EditorMessages.Editor_error_validateEdit_title"; String msg = "EditorMessages.Editor_error_validateEdit_message"; ErrorDialog.openError(shell, title, msg, x.getStatus()); } return; } if (fSourceViewer != null) fSourceViewer.setEditable(isEditable()); }
protected void updateState(IEditorInput input) { IDocumentProvider provider = getDocumentProvider(); if (provider instanceof IDocumentProviderExtension) { IDocumentProviderExtension extension = (IDocumentProviderExtension) provider; try { extension.updateStateCache(input); if (fSourceViewer != null) fSourceViewer.setEditable(isEditable()); } catch (CoreException e) { Activator.log(e); } } }
private void initializeSourceViewer(IEditorInput input) { IDocumentProvider documentProvider = getDocumentProvider(); IAnnotationModel model = documentProvider.getAnnotationModel(input); IDocument document = documentProvider.getDocument(input); if (document != null) { fSourceViewer.setDocument(document, model); fSourceViewer.setEditable(isEditable()); fSourceViewer.showAnnotations(model != null); } if (fElementStateListener instanceof IElementStateListenerExtension) { boolean isStateValidated = false; if (documentProvider instanceof IDocumentProviderExtension) isStateValidated = ((IDocumentProviderExtension) documentProvider).isStateValidated(input); IElementStateListenerExtension extension = (IElementStateListenerExtension) fElementStateListener; extension.elementStateValidationChanged(input, isStateValidated); } }