This commit is contained in:
Alexey Kudravtsev
2011-04-05 17:54:05 +04:00
parent 8332523054
commit 36ddf69d50
3 changed files with 4 additions and 5 deletions
@@ -100,7 +100,7 @@ public class CreateFileFix extends LocalQuickFixAndIntentionActionOnPsiElement {
@Override
public void invoke(@NotNull final Project project, @NotNull PsiFile file, @NotNull PsiElement startElement, @NotNull PsiElement endElement) {
final PsiDirectory myDirectory = (PsiDirectory)startElement;
if (isAvailable(project, null, null)) {
if (isAvailable(project, null, file)) {
new WriteCommandAction(project) {
protected void run(Result result) throws Throwable {
invoke(project, myDirectory);
@@ -19,7 +19,6 @@ package com.intellij.codeInspection.ex;
import com.intellij.codeInspection.*;
import com.intellij.codeInspection.ui.ProblemDescriptionNode;
import com.intellij.lang.injection.InjectedLanguageManager;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.colors.TextAttributesKey;
@@ -95,10 +94,9 @@ public class ProblemDescriptorImpl extends CommonProblemDescriptorImpl implement
myHighlightType = highlightType;
final Project project = startElement.getProject();
final boolean useLazy = !onTheFly || ApplicationManager.getApplication().isHeadlessEnvironment();
final SmartPointerManager manager = SmartPointerManager.getInstance(project);
myStartSmartPointer = useLazy? manager.createLazyPointer(startElement) : manager.createSmartPsiElementPointer(startElement);
myEndSmartPointer = startElement == endElement ? null : useLazy ? manager.createLazyPointer(endElement) : manager.createSmartPsiElementPointer(endElement);
myStartSmartPointer = manager.createSmartPsiElementPointer(startElement);
myEndSmartPointer = startElement == endElement ? null : manager.createSmartPsiElementPointer(endElement);
myAfterEndOfLine = isAfterEndOfLine;
myTextRangeInElement = rangeInElement;
@@ -270,6 +270,7 @@ public class InjectedLanguageUtil {
TextRange hostRange = place.host.getTextRange();
if (hostRange.cutOut(place.getRangeInsideHost()).grown(1).contains(hostOffset)) {
DocumentWindowImpl document = (DocumentWindowImpl)documentManager.getCachedDocument(injectedPsi);
if (document == null) return;
int injectedOffset = document.hostToInjected(hostOffset);
PsiElement injElement = injectedPsi.findElementAt(injectedOffset);
out.set(injElement == null ? injectedPsi : injElement);