Package org.sonar.ide.intellij.worker

Source Code of org.sonar.ide.intellij.worker.RefreshViolationsWorker

package org.sonar.ide.intellij.worker;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import org.sonar.wsclient.services.Query;
import org.sonar.wsclient.services.Violation;
import org.sonar.wsclient.services.ViolationQuery;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;

public class RefreshViolationsWorker extends RefreshSonarFileWorker<Violation> {

    public RefreshViolationsWorker(Project project, VirtualFile virtualFile) {
        super(project, virtualFile);
    }

    @Override
    protected Query<Violation> getQuery(String resourceKey) {
        ViolationQuery violationQuery = ViolationQuery.createForResource(resourceKey);
        violationQuery.setDepth(-1);
        return violationQuery;
    }

    @Override
    protected void done() {
        try {
            List<Violation> violations = get();
            if (violations == null) {
                violations = new ArrayList<Violation>();
            }
            notifyListeners(violations);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
    }
}
TOP

Related Classes of org.sonar.ide.intellij.worker.RefreshViolationsWorker

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.