unfold and add to navigation history on navigating within the same editor (IDEA-128907)

This commit is contained in:
peter
2016-02-12 17:10:44 +01:00
parent bf4e149335
commit 90731c6674
@@ -33,11 +33,12 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.LogicalPosition;
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.editor.ex.EditorGutterComponentEx;
import com.intellij.openapi.editor.ex.util.EditorUtil;
import com.intellij.openapi.extensions.ExtensionException;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.fileEditor.ex.IdeDocumentHistory;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.IndexNotReadyException;
@@ -136,8 +137,9 @@ public class GotoDeclarationAction extends BaseCodeInsightAction implements Code
private static void gotoTargetElement(@NotNull PsiElement element, @NotNull Editor currentEditor, @NotNull PsiFile currentFile) {
if (element.getContainingFile() == currentFile) {
currentEditor.getCaretModel().moveToOffset(element.getTextOffset());
currentEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
Project project = element.getProject();
IdeDocumentHistory.getInstance(project).includeCurrentCommandAsNavigation();
new OpenFileDescriptor(project, currentFile.getViewProvider().getVirtualFile(), element.getTextOffset()).navigateIn(currentEditor);
return;
}