Search in sources :

Example 1 with IStructureFigure

use of org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure in project webtools.sourceediting by eclipse.

the class XSDEditPartFactory method createStructureFigure.

public IStructureFigure createStructureFigure(Object model) {
    IStructureFigure figure = delegate.createStructureFigure(model);
    if (model instanceof XSDBaseAdapter) {
        XSDConcreteComponent comp = (XSDConcreteComponent) ((XSDBaseAdapter) model).getTarget();
        boolean isReadOnly = ((XSDBaseAdapter) model).isReadOnly();
        figure.getNameLabel().setIcon(XSDCommonUIUtils.getUpdatedImage(comp, ((XSDBaseAdapter) model).getImage(), isReadOnly));
    }
    return figure;
}
Also used : IStructureFigure(org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure) XSDConcreteComponent(org.eclipse.xsd.XSDConcreteComponent) XSDBaseAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter)

Example 2 with IStructureFigure

use of org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure in project webtools.sourceediting by eclipse.

the class FieldFigure method editPartAttached.

public void editPartAttached(EditPart owner) {
    StructureEditPart structureEditPart = null;
    for (EditPart parent = owner.getParent(); parent != null; parent = parent.getParent()) {
        if (parent instanceof StructureEditPart) {
            structureEditPart = (StructureEditPart) parent;
            break;
        }
    }
    RowLayout rowLayout = (RowLayout) rowFigure.getLayoutManager();
    IStructureFigure typeFigure = structureEditPart.getStructureFigure();
    Assert.isTrue(typeFigure instanceof StructureFigure, "Expected object of type StructureFigure");
    rowLayout.setColumnData(((StructureFigure) typeFigure).getColumnData());
}
Also used : IStructureFigure(org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure) IStructureFigure(org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure) StructureEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.StructureEditPart) RowLayout(org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.layouts.RowLayout) StructureEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.StructureEditPart) EditPart(org.eclipse.gef.EditPart)

Example 3 with IStructureFigure

use of org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure in project webtools.sourceediting by eclipse.

the class CompartmentFigure method editPartAttached.

public void editPartAttached(EditPart owner) {
    StructureEditPart structureEditPart = null;
    for (EditPart parent = owner.getParent(); parent != null; parent = parent.getParent()) {
        if (parent instanceof StructureEditPart) {
            structureEditPart = (StructureEditPart) parent;
            break;
        }
    }
    RowLayout rowLayout = (RowLayout) rowFigure.getLayoutManager();
    IStructureFigure typeFigure = structureEditPart.getStructureFigure();
    Assert.isTrue(typeFigure instanceof StructureFigure, "Expected object of type StructureFigure");
    rowLayout.setColumnData(((StructureFigure) typeFigure).getColumnData());
}
Also used : IStructureFigure(org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure) IStructureFigure(org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure) StructureEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.StructureEditPart) RowLayout(org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.layouts.RowLayout) StructureEditPart(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.StructureEditPart) EditPart(org.eclipse.gef.EditPart)

Example 4 with IStructureFigure

use of org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure in project webtools.sourceediting by eclipse.

the class TypeVizFigureFactory method createStructureFigure.

public IStructureFigure createStructureFigure(Object model) {
    StructureFigure figure = new StructureFigure();
    figure.setBorder(new LineBorder(1));
    ToolbarLayout toolbarLayout = new ToolbarLayout();
    toolbarLayout.setStretchMinorAxis(true);
    figure.setLayoutManager(toolbarLayout);
    if (model instanceof ITreeElement) {
        figure.getNameLabel().setIcon(((ITreeElement) model).getImage());
    }
    // we should organize ITreeElement and integrate it with the facade
    return figure;
}
Also used : ToolbarLayout(org.eclipse.draw2d.ToolbarLayout) IStructureFigure(org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure) LineBorder(org.eclipse.draw2d.LineBorder) ITreeElement(org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement)

Aggregations

IStructureFigure (org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure)4 EditPart (org.eclipse.gef.EditPart)2 StructureEditPart (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.StructureEditPart)2 RowLayout (org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.layouts.RowLayout)2 LineBorder (org.eclipse.draw2d.LineBorder)1 ToolbarLayout (org.eclipse.draw2d.ToolbarLayout)1 XSDBaseAdapter (org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter)1 ITreeElement (org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement)1 XSDConcreteComponent (org.eclipse.xsd.XSDConcreteComponent)1