IDEADEV-11226 ?

This commit is contained in:
Alexey Kudravtsev
2007-04-02 18:24:58 +04:00
parent a96c8161ed
commit 5293cc527f
3 changed files with 7 additions and 10 deletions
@@ -23,7 +23,7 @@ public class QuickFixWrapper implements IntentionAction {
private int myFixNumber;
private static final Logger LOG = Logger.getInstance("com.intellij.codeInspection.ex.QuickFixWrapper");
public QuickFixWrapper(ProblemDescriptor descriptor, int fixNumber) {
public QuickFixWrapper(@NotNull ProblemDescriptor descriptor, int fixNumber) {
myDescriptor = descriptor;
myFixNumber = fixNumber;
LOG.assertTrue(fixNumber > -1);
@@ -40,12 +40,12 @@ public class QuickFixWrapper implements IntentionAction {
return myDescriptor.getFixes()[myFixNumber].getName();
}
public boolean isAvailable(Project project, Editor editor, PsiFile file) {
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
PsiElement psiElement = myDescriptor.getPsiElement();
return psiElement != null && psiElement.isValid();
}
public void invoke(Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
if (!CodeInsightUtil.prepareFileForWrite(file)) return;
LocalQuickFix fix = (LocalQuickFix)myDescriptor.getFixes()[myFixNumber];
fix.applyFix(project, myDescriptor);
@@ -225,6 +225,7 @@ public class DummyHolder extends PsiFileImpl implements PsiImportHolder {
private FileViewProvider myViewProvider = null;
@NotNull
public FileViewProvider getViewProvider() {
if(myViewProvider != null) return myViewProvider;
return super.getViewProvider();
@@ -19,10 +19,7 @@ import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.*;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
@@ -63,7 +60,7 @@ public class InjectedLanguageUtil {
CachedValueProvider.Result<List<Pair<PsiElement, TextRange>>> result = provider.compute();
if (result == null) return null;
cachedPsi = host.getManager().getCachedValuesManager().createCachedValue(provider, false);
host.putUserData(INJECTED_PSI, cachedPsi);
((UserDataHolderEx)host).putUserDataIfAbsent(INJECTED_PSI, cachedPsi);
return result.getValue();
}
return cachedPsi.getValue();
@@ -408,8 +405,7 @@ public class InjectedLanguageUtil {
List<DocumentRange> injected = hostDocument.getUserData(INJECTED_DOCS_KEY);
if (injected == null) {
injected = new ArrayList<DocumentRange>();
hostDocument.putUserData(INJECTED_DOCS_KEY, injected);
injected = ((UserDataHolderEx)hostDocument).putUserDataIfAbsent(INJECTED_DOCS_KEY, new ArrayList<DocumentRange>());
}
RangeMarker rangeMarker = documentRange.getTextRange();