Search in sources :

Example 6 with IWorkbenchContext

use of org.eclipse.wst.validation.internal.operations.IWorkbenchContext in project webtools.sourceediting by eclipse.

the class StreamingMarkupValidator method validateProject.

private void validateProject(IValidationContext helper, final IReporter reporter) {
    // if uris[] length 0 -> validate() gets called for each project
    if (helper instanceof IWorkbenchContext) {
        IProject project = ((IWorkbenchContext) helper).getProject();
        IResourceProxyVisitor visitor = new IResourceProxyVisitor() {

            public boolean visit(IResourceProxy proxy) throws CoreException {
                if (shouldValidate(proxy)) {
                    validateFile((IFile) proxy.requestResource(), reporter);
                }
                return true;
            }
        };
        try {
            // collect all jsp files for the project
            project.accept(visitor, IResource.DEPTH_INFINITE);
        } catch (CoreException e) {
            Logger.logException(e);
        }
    }
}
Also used : IWorkbenchContext(org.eclipse.wst.validation.internal.operations.IWorkbenchContext) IResourceProxyVisitor(org.eclipse.core.resources.IResourceProxyVisitor) CoreException(org.eclipse.core.runtime.CoreException) IResourceProxy(org.eclipse.core.resources.IResourceProxy) IProject(org.eclipse.core.resources.IProject)

Example 7 with IWorkbenchContext

use of org.eclipse.wst.validation.internal.operations.IWorkbenchContext in project webtools.sourceediting by eclipse.

the class JSDTSourceValidator method validateFull.

/**
 */
private void validateFull(IValidationContext helper, IReporter reporter) {
    IProject project = null;
    String[] fileDelta = helper.getURIs();
    if (helper instanceof IWorkbenchContext) {
        IWorkbenchContext wbHelper = (IWorkbenchContext) helper;
        project = wbHelper.getProject();
    } else if (fileDelta.length > 0) {
        // won't work for project validation (b/c nothing in file delta)
        project = getResource(fileDelta[0]).getProject();
    }
    if (project == null)
        return;
    validateContainer(helper, reporter, project);
}
Also used : IWorkbenchContext(org.eclipse.wst.validation.internal.operations.IWorkbenchContext) IProject(org.eclipse.core.resources.IProject)

Example 8 with IWorkbenchContext

use of org.eclipse.wst.validation.internal.operations.IWorkbenchContext in project webtools.sourceediting by eclipse.

the class JSONSyntaxValidator method validateProject.

private void validateProject(IValidationContext helper, final IReporter reporter) {
    // if uris[] length 0 -> validate() gets called for each project
    if (helper instanceof IWorkbenchContext) {
        IProject project = ((IWorkbenchContext) helper).getProject();
        IResourceProxyVisitor visitor = new IResourceProxyVisitor() {

            public boolean visit(IResourceProxy proxy) throws CoreException {
                if (shouldValidate(proxy)) {
                    validateFile((IFile) proxy.requestResource(), reporter);
                }
                return true;
            }
        };
        try {
            // collect all jsp files for the project
            project.accept(visitor, IResource.DEPTH_INFINITE);
        } catch (CoreException e) {
            Logger.logException(e);
        }
    }
}
Also used : IWorkbenchContext(org.eclipse.wst.validation.internal.operations.IWorkbenchContext) IResourceProxyVisitor(org.eclipse.core.resources.IResourceProxyVisitor) CoreException(org.eclipse.core.runtime.CoreException) IResourceProxy(org.eclipse.core.resources.IResourceProxy) IProject(org.eclipse.core.resources.IProject)

Example 9 with IWorkbenchContext

use of org.eclipse.wst.validation.internal.operations.IWorkbenchContext in project webtools.sourceediting by eclipse.

the class MarkupValidator method validateV1Project.

/**
 * @param helper
 * @param reporter
 */
private void validateV1Project(IValidationContext helper, final IReporter reporter) {
    // if uris[] length 0 -> validate() gets called for each project
    if (helper instanceof IWorkbenchContext) {
        IProject project = ((IWorkbenchContext) helper).getProject();
        IResourceProxyVisitor visitor = new IResourceProxyVisitor() {

            public boolean visit(IResourceProxy proxy) throws CoreException {
                if (shouldValidate(proxy)) {
                    validateV1File((IFile) proxy.requestResource(), reporter);
                }
                return true;
            }
        };
        try {
            // collect all jsp files for the project
            project.accept(visitor, IResource.DEPTH_INFINITE);
        } catch (CoreException e) {
            Logger.logException(e);
        }
    }
}
Also used : IWorkbenchContext(org.eclipse.wst.validation.internal.operations.IWorkbenchContext) IResourceProxyVisitor(org.eclipse.core.resources.IResourceProxyVisitor) CoreException(org.eclipse.core.runtime.CoreException) IResourceProxy(org.eclipse.core.resources.IResourceProxy) IProject(org.eclipse.core.resources.IProject)

Aggregations

IProject (org.eclipse.core.resources.IProject)9 IWorkbenchContext (org.eclipse.wst.validation.internal.operations.IWorkbenchContext)9 CoreException (org.eclipse.core.runtime.CoreException)7 IResourceProxy (org.eclipse.core.resources.IResourceProxy)4 IResourceProxyVisitor (org.eclipse.core.resources.IResourceProxyVisitor)4 IFile (org.eclipse.core.resources.IFile)3 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)3 Path (org.eclipse.core.runtime.Path)3 IMessage (org.eclipse.wst.validation.internal.provisional.core.IMessage)3 Message (org.eclipse.wst.validation.internal.core.Message)2 IPath (org.eclipse.core.runtime.IPath)1