This commit is contained in:
Alexey Kudravtsev
2015-11-03 13:46:31 +03:00
parent 455fa4c9de
commit 5a95d86ca8
2 changed files with 8 additions and 8 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* 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.
@@ -24,7 +24,7 @@ import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.psi.PsiElement;
import com.intellij.util.Function;
import com.intellij.util.NotNullFunction;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
@@ -44,8 +44,7 @@ public class InspectionProfileWrapper {
* I.e. given strategy (if any) receives {@link InspectionProfileWrapper} object that is going to be used so far and returns
* {@link InspectionProfileWrapper} object that should be used later.
*/
public static final Key<Function<InspectionProfileWrapper, InspectionProfileWrapper>> CUSTOMIZATION_KEY
= Key.create("Inspection Profile Wrapper Customization");
public static final Key<NotNullFunction<InspectionProfileWrapper, InspectionProfileWrapper>> CUSTOMIZATION_KEY = Key.create("Inspection Profile Wrapper Customization");
protected final InspectionProfile myProfile;
public InspectionProfileWrapper(@NotNull InspectionProfile profile) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* 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.
@@ -30,7 +30,7 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.spellchecker.inspections.SpellCheckingInspection;
import com.intellij.ui.SimpleEditorCustomization;
import com.intellij.util.Function;
import com.intellij.util.NotNullFunction;
import com.intellij.util.containers.WeakHashMap;
import org.jetbrains.annotations.NotNull;
@@ -104,7 +104,7 @@ public class SpellCheckingEditorCustomization extends SimpleEditorCustomization
return;
}
Function<InspectionProfileWrapper, InspectionProfileWrapper> strategy = file.getUserData(InspectionProfileWrapper.CUSTOMIZATION_KEY);
NotNullFunction<InspectionProfileWrapper, InspectionProfileWrapper> strategy = file.getUserData(InspectionProfileWrapper.CUSTOMIZATION_KEY);
if (strategy == null) {
file.putUserData(InspectionProfileWrapper.CUSTOMIZATION_KEY, strategy = new MyInspectionProfileStrategy());
}
@@ -126,12 +126,13 @@ public class SpellCheckingEditorCustomization extends SimpleEditorCustomization
}
}
private static class MyInspectionProfileStrategy implements Function<InspectionProfileWrapper, InspectionProfileWrapper> {
private static class MyInspectionProfileStrategy implements NotNullFunction<InspectionProfileWrapper, InspectionProfileWrapper> {
private final Map<InspectionProfileWrapper, MyInspectionProfileWrapper> myWrappers
= new WeakHashMap<InspectionProfileWrapper, MyInspectionProfileWrapper>();
private boolean myUseSpellCheck;
@NotNull
@Override
public InspectionProfileWrapper fun(InspectionProfileWrapper inspectionProfileWrapper) {
if (!READY) {