Package org.infernus.idea.checkstyle.checker

Source Code of org.infernus.idea.checkstyle.checker.CreateScannableFileAction

package org.infernus.idea.checkstyle.checker;

import com.intellij.openapi.module.Module;
import com.intellij.psi.PsiFile;
import org.infernus.idea.checkstyle.util.ScannableFile;

import java.io.IOException;

/**
* Action to read the file to a temporary file.
*/
class CreateScannableFileAction implements Runnable {

    /**
     * Any failure that occurred on the thread.
     */
    private IOException failure;

    private PsiFile psiFile;
    private Module module;

    /**
     * The created temporary file.
     */
    private ScannableFile file;

    /**
     * Create a thread to read the given file to a temporary file.
     *
     * @param psiFile the file to read.
     * @param module the module the file belongs to.
     */
    public CreateScannableFileAction(final PsiFile psiFile, final Module module) {
        this.psiFile = psiFile;
        this.module = module;
    }

    /**
     * Get any failure that occurred in this thread.
     *
     * @return the failure, if any.
     */
    public IOException getFailure() {
        return failure;
    }

    /**
     * Get the scannable file.
     *
     * @return the scannable file.
     */
    public ScannableFile getFile() {
        return file;
    }

    public void run() {
        try {
            file = new ScannableFile(psiFile, module);

        } catch (IOException e) {
            failure = e;
        }
    }
}
TOP

Related Classes of org.infernus.idea.checkstyle.checker.CreateScannableFileAction

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.