String (Project project) { FileEditorManager fileEditorManager = FileEditorManager.getInstance(project); String openFileCommand = ""; if (fileEditorManager != null) { VirtualFile[] openFiles = fileEditorManager.getSelectedFiles(); if (openFiles.length != 0) { openFileCommand = "%openFile " + openFiles[0].getCanonicalPath() + '\n'; } } return openFileCommand; }