obsolete extension point removed
authornik <Nikolay.Chashnikov@jetbrains.com>
Fri, 7 Aug 2015 17:06:40 +0000 (20:06 +0300)
committernik <Nikolay.Chashnikov@jetbrains.com>
Fri, 7 Aug 2015 17:07:07 +0000 (20:07 +0300)
java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MissingDependencyFixUtil.java [deleted file]
java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/OrderEntryFix.java
java/java-impl/src/com/intellij/codeInsight/daemon/quickFix/MissingDependencyFixProvider.java [deleted file]
platform/platform-resources/src/META-INF/LangExtensionPoints.xml

diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MissingDependencyFixUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MissingDependencyFixUtil.java
deleted file mode 100644 (file)
index 79bbb99..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.codeInsight.daemon.impl.quickfix;
-
-import com.intellij.codeInsight.daemon.quickFix.MissingDependencyFixProvider;
-import com.intellij.codeInspection.LocalQuickFix;
-import com.intellij.openapi.extensions.Extensions;
-import com.intellij.util.Function;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.List;
-
-import static com.intellij.codeInsight.daemon.quickFix.MissingDependencyFixProvider.EP_NAME;
-
-/**
- * @author Vladislav.Soroka
- * @since 7/16/2015
- */
-public class MissingDependencyFixUtil {
-  @Nullable
-  public static List<LocalQuickFix> findFixes(Function<MissingDependencyFixProvider, List<LocalQuickFix>> provider) {
-    MissingDependencyFixProvider[] fixProviders = Extensions.getExtensions(EP_NAME);
-    for (MissingDependencyFixProvider each : fixProviders) {
-      List<LocalQuickFix> result = provider.fun(each);
-      if (result != null && !result.isEmpty()) return result;
-    }
-
-    return null;
-  }
-
-  @Nullable
-  public static <T> T provideFix(Function<MissingDependencyFixProvider, T> provider) {
-    MissingDependencyFixProvider[] fixProviders = Extensions.getExtensions(EP_NAME);
-    for (MissingDependencyFixProvider each : fixProviders) {
-      T result = provider.fun(each);
-      if (result != null && Boolean.FALSE != result) return result;
-    }
-
-    return null;
-  }
-}
index 93cc86cd5f0bbb77eca585c942deca2bd1d333e0..0ffe3732748b4d8a9903d19d81121b7b2ae15068 100644 (file)
@@ -17,10 +17,8 @@ package com.intellij.codeInsight.daemon.impl.quickfix;
 
 import com.intellij.codeInsight.daemon.QuickFixActionRegistrar;
 import com.intellij.codeInsight.daemon.impl.actions.AddImportAction;
-import com.intellij.openapi.roots.ExternalLibraryDescriptor;
 import com.intellij.codeInsight.daemon.quickFix.ExternalLibraryResolver;
 import com.intellij.codeInsight.daemon.quickFix.ExternalLibraryResolver.ExternalClassResolveResult;
-import com.intellij.codeInsight.daemon.quickFix.MissingDependencyFixProvider;
 import com.intellij.codeInsight.intention.IntentionAction;
 import com.intellij.codeInspection.LocalQuickFix;
 import com.intellij.codeInspection.ProblemDescriptor;
@@ -40,7 +38,6 @@ import com.intellij.psi.search.PsiShortNamesCache;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.Function;
-import com.intellij.util.ObjectUtils;
 import com.intellij.util.ThreeState;
 import com.intellij.util.containers.ContainerUtil;
 import gnu.trove.THashSet;
@@ -54,9 +51,6 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 
-import static com.intellij.codeInsight.daemon.impl.quickfix.MissingDependencyFixUtil.findFixes;
-import static com.intellij.codeInsight.daemon.impl.quickfix.MissingDependencyFixUtil.provideFix;
-
 /**
  * @author cdr
  */
@@ -96,16 +90,6 @@ public abstract class OrderEntryFix implements IntentionAction, LocalQuickFix {
     final Module currentModule = fileIndex.getModuleForFile(classVFile);
     if (currentModule == null) return null;
 
-    final List<LocalQuickFix> providedFixes = findFixes(new Function<MissingDependencyFixProvider, List<LocalQuickFix>>() {
-      @Override
-      public List<LocalQuickFix> fun(MissingDependencyFixProvider provider) {
-        return provider.registerFixes(registrar, reference);
-      }
-    });
-    if (providedFixes != null) {
-      return providedFixes;
-    }
-
     List<LocalQuickFix> result = new ArrayList<LocalQuickFix>();
     JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project);
     String fullReferenceText = reference.getCanonicalText();
@@ -139,17 +123,6 @@ public abstract class OrderEntryFix implements IntentionAction, LocalQuickFix {
     }
     classes = allowedDependencies.toArray(new PsiClass[allowedDependencies.size()]);
     OrderEntryFix moduleDependencyFix = new AddModuleDependencyFix(currentModule, classVFile, classes, reference);
-
-    final PsiClass[] finalClasses = classes;
-    final OrderEntryFix finalModuleDependencyFix = moduleDependencyFix;
-    final OrderEntryFix providedModuleDependencyFix = provideFix(new Function<MissingDependencyFixProvider, OrderEntryFix>() {
-      @Override
-      public OrderEntryFix fun(MissingDependencyFixProvider provider) {
-        return provider.getAddModuleDependencyFix(reference, finalModuleDependencyFix, currentModule, classVFile, finalClasses);
-      }
-    });
-    moduleDependencyFix = ObjectUtils.notNull(providedModuleDependencyFix, moduleDependencyFix);
-
     registrar.register(moduleDependencyFix);
     result.add(moduleDependencyFix);
     for (final PsiClass aClass : classes) {
@@ -235,14 +208,6 @@ public abstract class OrderEntryFix implements IntentionAction, LocalQuickFix {
 
   public static void addJarsToRoots(@NotNull final List<String> jarPaths, @Nullable final String libraryName,
                                     @NotNull final Module module, @Nullable final PsiElement location) {
-    final Boolean isAdded = provideFix(new Function<MissingDependencyFixProvider, Boolean>() {
-      @Override
-      public Boolean fun(MissingDependencyFixProvider provider) {
-        return provider.addJarsToRoots(jarPaths, libraryName, module, location);
-      }
-    });
-    if (Boolean.TRUE.equals(isAdded)) return;
-
     List<String> urls = refreshAndConvertToUrls(jarPaths);
     DependencyScope scope = suggestScopeByLocation(module, location);
     ModuleRootModificationUtil.addModuleLibrary(module, libraryName, urls, Collections.<String>emptyList(),
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/quickFix/MissingDependencyFixProvider.java b/java/java-impl/src/com/intellij/codeInsight/daemon/quickFix/MissingDependencyFixProvider.java
deleted file mode 100644 (file)
index 3818c92..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.codeInsight.daemon.quickFix;
-
-import com.intellij.codeInsight.daemon.QuickFixActionRegistrar;
-import com.intellij.codeInsight.daemon.impl.quickfix.OrderEntryFix;
-import com.intellij.codeInspection.LocalQuickFix;
-import com.intellij.openapi.extensions.ExtensionPointName;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.roots.LibraryOrderEntry;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiReference;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.List;
-
-/**
- * {@link MissingDependencyFixProvider} extension can be used to override or complement default platform {@link OrderEntryFix}-es.
- * <p/>
- * It can be useful for modules imported from external build system like Maven, Gradle etc,
- * when external build configuration(pom.xml/*.gradle scripts) should be changed in additional or instead of IntelliJ project configuration.
- *
- * @author Vladislav.Soroka
- * @since 7/15/2015
- */
-public abstract class MissingDependencyFixProvider {
-  public static final ExtensionPointName<MissingDependencyFixProvider> EP_NAME =
-    ExtensionPointName.create("com.intellij.codeInsight.missingDependencyFixProvider");
-
-  @Nullable
-  public List<LocalQuickFix> registerFixes(@NotNull QuickFixActionRegistrar registrar, @NotNull final PsiReference reference) {
-    return null;
-  }
-
-  @Nullable
-  public OrderEntryFix getAddModuleDependencyFix(@NotNull PsiReference reference,
-                                                 @NotNull OrderEntryFix platformFix,
-                                                 @NotNull Module currentModule,
-                                                 @NotNull VirtualFile classVFile,
-                                                 @NotNull PsiClass[] classes) {
-    return null;
-  }
-
-  @Nullable
-  public OrderEntryFix getAddLibraryToClasspathFix(@NotNull PsiReference reference,
-                                                   @NotNull OrderEntryFix platformFix,
-                                                   @NotNull Module currentModule,
-                                                   @NotNull LibraryOrderEntry libraryEntry,
-                                                   @NotNull PsiClass aClass) {
-    return null;
-  }
-
-  @NotNull
-  public Boolean addJarsToRoots(@NotNull List<String> jarPaths, @Nullable String libraryName,
-                                @NotNull Module module, @Nullable PsiElement location) {
-    return Boolean.FALSE;
-  }
-}
index 6d8b5739da074124e34ef3b53fca23b8054e8e08..b0d916dffe9a508012ebe54bc20d35cb2d8ccab4 100644 (file)
@@ -52,9 +52,6 @@
     <extensionPoint name="codeInsight.unresolvedReferenceQuickFixProvider"
                     interface="com.intellij.codeInsight.quickfix.UnresolvedReferenceQuickFixProvider"/>
 
-    <extensionPoint name="codeInsight.missingDependencyFixProvider"
-                    interface="com.intellij.codeInsight.daemon.quickFix.MissingDependencyFixProvider"/>
-
     <extensionPoint name="bidiRegionsSeparator"
                     beanClass="com.intellij.lang.LanguageExtensionPoint">
       <with attribute="implementationClass" implements="com.intellij.openapi.editor.bidi.BidiRegionsSeparator"/>