FileDocCategorySizeDatePackage
UiElementsEditPartFactory.javaAPI DocAndroid 1.5 API1861Wed May 06 22:41:10 BST 2009com.android.ide.eclipse.editors.layout.parts

UiElementsEditPartFactory

public class UiElementsEditPartFactory extends Object implements org.eclipse.gef.EditPartFactory
A factory that returns the appropriate {@link EditPart} for a given model object.

The only model objects we use are {@link UiElementNode} objects and they are edited using {@link UiElementEditPart}.

Fields Summary
private org.eclipse.swt.widgets.Display
mDisplay
Constructors Summary
public UiElementsEditPartFactory(org.eclipse.swt.widgets.Display display)

        mDisplay = display;
    
Methods Summary
public org.eclipse.gef.EditPartcreateEditPart(org.eclipse.gef.EditPart context, java.lang.Object model)

        if (model instanceof UiDocumentNode) {
            return new UiDocumentEditPart((UiDocumentNode) model, mDisplay);
        } else if (model instanceof UiElementNode) {
            UiElementNode node = (UiElementNode) model;

            if (node.getDescriptor().hasChildren()) {
                return new UiLayoutEditPart(node);
            }

            return new UiViewEditPart(node);
        }
        return null;