void (DynamicElementSettings settings) { if (settings == null) return; assert settings.isMethod(); final DMethodElement methodElement = (DMethodElement) createDynamicElement(settings); final DClassElement classElement = getOrCreateClassElement(myProject, settings.getContainingClassName()); ToolWindow window = DynamicToolWindowWrapper.getInstance(myProject).getToolWindow(); //important to fetch myToolWindow before adding classElement.addMethod(methodElement); addItemInTree(classElement, methodElement, window); }