Project (@NotNull VirtualFile virtualFile) { if (FileEditorManager.getInstance(myProject).getAllEditors(virtualFile).length != 0) { // if at least one editor in myProject frame has opened this file, then we can assume this file does belong to the myProject return myProject; } return ProjectUtil.guessProjectForFile(virtualFile); }