public final <T> T createStableValue(final Factory<T> provider, final Condition<T> validator) {
    final T initial = provider.create();
    assert initial != null;
    final StableInvocationHandler handler =
        new StableInvocationHandler<T>(initial, provider, validator);

    final Set<Class> intf = new HashSet<Class>();
    ContainerUtil.addAll(intf, initial.getClass().getInterfaces());
    intf.add(StableElement.class);
    //noinspection unchecked

    return (T)
        AdvancedProxy.createProxy(
            initial.getClass().getSuperclass(), intf.toArray(new Class[intf.size()]), handler);
  }
 @Override
 @NotNull
 protected JComponent createCustomComponent() {
   new MnemonicHelper().register(getComponent());
   myComponent = myComponentFactory.create();
   DomUIFactory.getDomUIFactory().setupErrorOutdatingUserActivityWatcher(this, getDomElement());
   DomManager.getDomManager(getProject())
       .addDomEventListener(
           new DomEventListener() {
             @Override
             public void eventOccured(DomEvent event) {
               checkIsValid();
             }
           },
           this);
   Disposer.register(this, myComponent);
   return myComponent.getComponent();
 }
 @Override
 public void reset() {
   if (checkIsValid()) {
     myComponent.reset();
   }
 }
 private DomElement getDomElement() {
   return myComponent.getDomElement();
 }
 @Override
 @Nullable
 public JComponent getPreferredFocusedComponent() {
   ensureInitialized();
   return myComponent.getComponent();
 }