@@ -0,0 +1,2737 @@
+/*%0A * Copyright 2018-present Facebook, Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A * not use this file except in compliance with the License. You may obtain%0A * a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS, WITHOUT%0A * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the%0A * License for the specific language governing permissions and limitations%0A * under the License.%0A */%0A%0Apackage com.facebook.buck.intellij.ideabuck.api;%0A%0Aimport com.intellij.openapi.components.ProjectComponent;%0Aimport com.intellij.openapi.vfs.VirtualFile;%0Aimport com.intellij.psi.PsiElement;%0Aimport java.nio.file.Path;%0Aimport java.util.Optional;%0A%0A/** Resolves %7B@link BuckTarget%7D and %7B@link BuckTargetPattern%7D to their source files or elements. */%0Apublic interface BuckTargetLocator extends ProjectComponent %7B%0A  /**%0A   * Returns a %7B@link Path%7D to the Buck file in the given target's package.%0A   *%0A   * %3Cp%3ENote that this does not guarantee that the Buck file exists or that (if the file does exist)%0A   * the rule definition is actually present in the Buck file.%0A   */%0A  Optional%3CPath%3E findPathForTarget(BuckTarget buckTarget);%0A%0A  /**%0A   * Returns a %7B@link VirtualFile%7D for the Buck file in the given target's package.%0A   *%0A   * %3Cp%3ENote that this does not guarantee that the Buck file exists or that (if the file does exist)%0A   * the rule definition is actually present in the Buck file.%0A   */%0A  Optional%3CVirtualFile%3E findVirtualFileForTarget(BuckTarget buckTarget);%0A%0A  /**%0A   * Returns a %7B@link Path%7D to the extension file identified by the given target.%0A   *%0A   * %3Cp%3ENote that this does not guarantee that the extension file actually exists.%0A   */%0A  Optional%3CPath%3E findPathForExtensionFile(BuckTarget buckTarget);%0A%0A  /**%0A   * Returns a %7B@link VirtualFile%7D to the extension file identified by the given target.%0A   *%0A   * %3Cp%3ENote that this does not guarantee that the extension file actually exists.%0A   */%0A  Optional%3CVirtualFile%3E findVirtualFileForExtensionFile(BuckTarget buckTarget);%0A%0A  /** Returns a %7B@link Path%7D to a file or directory that matches the given target pattern. */%0A  Optional%3CPath%3E findPathForTargetPattern(BuckTargetPattern buckTargetPattern);%0A%0A  /** Returns a %7B@link VirtualFile%7D to a file or directory that matches the given target pattern. */%0A  Optional%3CVirtualFile%3E findVirtualFileForTargetPattern(BuckTargetPattern buckTargetPattern);%0A%0A  /** Returns the element in the PsiTree where the given target is defined, if it can be found. */%0A  Optional%3C? extends PsiElement%3E findElementForTarget(BuckTarget buckTarget);%0A%7D%0A

Add BuckTargetLocator to API package to resolve targets and target patterns