DataContext (DataContext dataContext) { Pair<PsiElement, MyDataContext> pair = DataManager.getInstance().loadFromDataContext(dataContext, LOCATION_WRAPPER); PsiElement element = myElement.getElement(); if (pair == null || pair.first != element) { pair = Pair.pair(element, new MyDataContext(dataContext)); DataManager.getInstance().saveInDataContext(dataContext, LOCATION_WRAPPER, pair); } return pair.second; }