1 /* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.tools.lint.client.api; 18 19 import com.android.annotations.NonNull; 20 import com.android.annotations.Nullable; 21 import com.android.tools.lint.detector.api.Context; 22 import com.google.common.annotations.Beta; 23 24 /** 25 * Interface implemented by listeners to be notified of lint events 26 * <p> 27 * <b>NOTE: This is not a public or final API; if you rely on this be prepared 28 * to adjust your code for the next tools release.</b> 29 */ 30 @Beta 31 public interface LintListener { 32 /** The various types of events provided to lint listeners */ 33 public enum EventType { 34 /** A lint check is about to begin */ 35 STARTING, 36 37 /** Lint is about to check the given project, see {@link Context#getProject()} */ 38 SCANNING_PROJECT, 39 40 /** Lint is about to check the given library project, see {@link Context#getProject()} */ 41 SCANNING_LIBRARY_PROJECT, 42 43 /** Lint is about to check the given file, see {@link Context#file} */ 44 SCANNING_FILE, 45 46 /** A new pass was initiated */ 47 NEW_PHASE, 48 49 /** The lint check was canceled */ 50 CANCELED, 51 52 /** The lint check is done */ 53 COMPLETED, 54 }; 55 56 /** 57 * Notifies listeners that the event of the given type has occurred. 58 * Additional information, such as the file being scanned, or the project 59 * being scanned, is available in the {@link Context} object (except for the 60 * {@link EventType#STARTING}, {@link EventType#CANCELED} or 61 * {@link EventType#COMPLETED} events which are fired outside of project 62 * contexts.) 63 * 64 * @param driver the driver running through the checks 65 * @param type the type of event that occurred 66 * @param context the context providing additional information 67 */ 68 public void update(@NonNull LintDriver driver, @NonNull EventType type, 69 @Nullable Context context); 70 } 71