DataContext (DataContext dataContext) { if (PlatformCoreDataKeys.FILE_EDITOR.getData(dataContext) != null) { return dataContext; } Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) { return dataContext; } FileEditorManager editorManager = FileEditorManager.getInstance(project); if (editorManager == null) { return dataContext; } VirtualFile[] files = editorManager.getSelectedFiles(); if (files.length == 0) { return dataContext; } FileEditor fileEditor = editorManager.getSelectedEditor(files[0]); return fileEditor == null ? dataContext : DataManager.getInstance().getDataContext(fileEditor.getComponent()); }