Skip to content

Commit

Permalink
IDEA-131487 Evaluate code fragment - enable editor actions: introduce…
Browse files Browse the repository at this point in the history
… variable, quick fix for casting, etc.
  • Loading branch information
gorrus committed Mar 5, 2015
1 parent 8267378 commit ad9f7f0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 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.
Expand Down Expand Up @@ -39,7 +39,6 @@
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.PsiCodeFragment;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
Expand Down Expand Up @@ -73,7 +72,6 @@ public void invoke(@NotNull final Project project, @NotNull Editor editor, @NotN
if (HintManagerImpl.getInstanceImpl().performCurrentQuestionAction()) return;

//intentions check isWritable before modification: if (!file.isWritable()) return;
if (file instanceof PsiCodeFragment) return;

TemplateState state = TemplateManagerImpl.getTemplateState(editor);
if (state != null && !state.isFinished()) {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 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.
Expand All @@ -16,10 +16,13 @@
package com.intellij.xdebugger.impl.ui;

import com.intellij.lang.Language;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.ui.EditorTextField;
import com.intellij.xdebugger.XExpression;
import com.intellij.xdebugger.XSourcePosition;
Expand Down Expand Up @@ -54,6 +57,16 @@ protected EditorEx createEditor() {
return editor;
}

@Override
public Object getData(String dataId) {
if (LangDataKeys.CONTEXT_LANGUAGES.is(dataId)) {
return new Language[]{myExpression.getLanguage()};
} else if (CommonDataKeys.PSI_FILE.is(dataId)) {
return PsiDocumentManager.getInstance(getProject()).getPsiFile(getDocument());
}
return super.getData(dataId);
}

@Override
protected boolean isOneLineMode() {
return false;
Expand Down

0 comments on commit ad9f7f0

Please sign in to comment.