/*
 * Copyright 2000-2015 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.codeInspection.concurrencyAnnotations;

import com.intellij.openapi.roots.ExternalLibraryDescriptor;
import com.intellij.codeInsight.daemon.quickFix.ExternalLibraryResolver;
import com.intellij.openapi.module.Module;
import com.intellij.util.PathUtil;
import com.intellij.util.ThreeState;
import net.jcip.annotations.GuardedBy;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Collections;
import java.util.List;

/**
 * @author nik
 */
public class JCiPExternalLibraryResolver extends ExternalLibraryResolver {
  private static final ExternalLibraryDescriptor JDCIP_LIBRARY_DESCRIPTOR =
    new ExternalLibraryDescriptor("net.jcip", "jcip-annotations") {
      @NotNull
      @Override
      public List<String> getLibraryClassesRoots() {
        return Collections.singletonList(PathUtil.getJarPathForClass(GuardedBy.class));
      }

      @Override
      public String getPresentableName() {
        return "jcip-annotations.jar";
      }
    };

  @Nullable
  @Override
  public ExternalClassResolveResult resolveClass(@NotNull String shortClassName, @NotNull ThreeState isAnnotation, @NotNull Module contextModule) {
    if (JCiPUtil.isJCiPAnnotation(shortClassName) && isAnnotation == ThreeState.YES) {
      return new ExternalClassResolveResult("net.jcip.annotations." + shortClassName, JDCIP_LIBRARY_DESCRIPTOR);
    }
    return null;
  }

  @Nullable
  @Override
  public ExternalLibraryDescriptor resolvePackage(@NotNull String packageName) {
    if (packageName.equals("net.jcip.annotations")) {
      return JDCIP_LIBRARY_DESCRIPTOR;
    }
    return null;
  }
}

@@ -659,69 +659,8 @@
 s;%0A%0A
-import com.intellij.openapi.roots.ExternalLibraryDescriptor;%0A
 impo
@@ -795,97 +795,84 @@
 lij.
-util.PathUtil;%0Aimport com.intellij.util.ThreeState;%0Aimport net.jcip.annotations.GuardedBy
+openapi.roots.ExternalLibraryDescriptor;%0Aimport com.intellij.util.ThreeState
 ;%0Aim
@@ -959,62 +959,8 @@
 e;%0A%0A
-import java.util.Collections;%0Aimport java.util.List;%0A%0A
 /**%0A
@@ -1197,192 +1197,30 @@
 ons%22
-) %7B%0A      @NotNull%0A      @Override%0A      public List%3CString%3E getLibraryClassesRoots() %7B%0A        return Collections.singletonList(PathUtil.getJarPathForClass(GuardedBy.class));%0A      %7D%0A
+, null, null, %221.0%22) %7B
 %0A   

use repository library when adding jcip-annotations library via quickfix