DataContext (@NotNull final DataContext original) { if (CommonDataKeys.PROJECT.getData(original) == myProject) return original; return new DataContext() { @Override public Object getData(String dataId) { if (CommonDataKeys.PROJECT.is(dataId)) { return myProject; } return original.getData(dataId); } }; }