/*
@VaadinApache2LicenseForJavaFiles@
 */

package com.vaadin.terminal;

import com.vaadin.terminal.gwt.server.ClientConnector;

public abstract class AbstractExtension extends AbstractClientConnector
        implements Extension {

    protected Class<? extends ClientConnector> getAcceptedParentType() {
        return ClientConnector.class;
    }

    @Override
    public void setParent(ClientConnector parent) {
        Class<? extends ClientConnector> acceptedParentType = getAcceptedParentType();
        if (parent == null || acceptedParentType.isInstance(parent)) {
            super.setParent(parent);
        } else {
            throw new IllegalArgumentException(getClass().getName()
                    + " can only be attached to parents of type "
                    + acceptedParentType.getName() + " but attach to "
                    + parent.getClass().getName() + " was attempted.");
        }
    }

}

@@ -344,16 +344,126 @@
 %0A    %7D%0A%0A
+    protected void addExtensionTo(AbstractClientConnector parent) %7B%0A        parent.addExtension(this);%0A    %7D%0A%0A
     @Ove

Add a way for an extension to add itself to a connector (#6690)