use of org.eclipse.wst.xsl.ui.internal.editor.XSLEditor in project webtools.sourceediting by eclipse.
the class DelegatingSourceValidatorForXSL method validate.
@Override
public void validate(IValidationContext helper, IReporter reporter) throws ValidationException {
super.validate(helper, reporter);
// validating will refresh the model, so now calculate the overrides.
// (we only calculate overrides for source validation as we only want to do it for files open in an editor)
// There follows a very complicated way of creating the required annotations in an editor.
// TODO resolve this when bug 247222 is sorted
String[] delta = helper.getURIs();
if (delta.length > 0) {
IFile file = getFile(delta[0]);
// find any files with open editors...
IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
for (IWorkbenchWindow workbenchWindow : windows) {
IWorkbenchPage page = workbenchWindow.getActivePage();
if (page != null) {
IEditorReference[] refs = page.findEditors(new FileEditorInput(file), XSL_UI_XSL_EDITOR_ID, IWorkbenchPage.MATCH_ID | IWorkbenchPage.MATCH_INPUT);
// lets hope we only have one XSL editor open on the file, or else we don't know which one started this validation...
if (refs.length == 1) {
XSLEditor editor = (XSLEditor) refs[0].getEditor(false);
if (editor != null) {
// all this work just to get here...
editor.getOverrideIndicatorManager().updateAnnotations();
}
}
}
}
}
}
Aggregations