Example usage for com.intellij.openapi.fileEditor FileEditorManagerEvent getOldFile

List of usage examples for com.intellij.openapi.fileEditor FileEditorManagerEvent getOldFile

Introduction

In this page you can find the example usage for com.intellij.openapi.fileEditor FileEditorManagerEvent getOldFile.

Prototype

@Nullable
    public VirtualFile getOldFile() 

Source Link

Usage

From source file:com.atlassian.theplugin.idea.ui.linkhiglighter.FileEditorListenerImpl.java

License:Apache License

public void selectionChanged(final FileEditorManagerEvent event) {
    final FileEditorManager editorManager = event.getManager();
    if (project != editorManager.getProject()) {
        assert false : this;
        return;//  w w  w .  j av  a  2s .c o m
    }
    VirtualFile newFile = event.getNewFile();

    VirtualFile oldFile = event.getOldFile();

    if (oldFile != null && newFile == null) {
        removeHighlighter(oldFile);
        linkHighlighters.remove(oldFile);

    } else if (newFile != null && !linkHighlighters.containsKey(newFile)) {
        PsiFile psiFile = safeFindFile(newFile);
        if (psiFile != null) {
            Editor editor = editorManager.getSelectedTextEditor();
            if (editor != null) {
                addHighlighter(newFile, psiFile, editor);
            }
        }
    }
}