use of org.eclipse.wst.xsd.ui.internal.adt.design.editparts.StructureEditPart 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());
}
use of org.eclipse.wst.xsd.ui.internal.adt.design.editparts.StructureEditPart 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());
}
use of org.eclipse.wst.xsd.ui.internal.adt.design.editparts.StructureEditPart in project webtools.sourceediting by eclipse.
the class DesignViewGraphicalViewer method getEditPart.
protected EditPart getEditPart(EditPart parent, Object object) {
EditPart result = null;
for (Iterator i = parent.getChildren().iterator(); i.hasNext(); ) {
EditPart editPart = (EditPart) i.next();
if (editPart.getModel() == object && !(editPart instanceof IHolderEditPart) && !(editPart instanceof RootContentEditPart)) {
result = editPart;
break;
}
}
if (result == null) {
for (Iterator i = parent.getChildren().iterator(); i.hasNext(); ) {
EditPart editPart = getEditPart((EditPart) i.next(), object);
if (editPart != null) {
// First check to see if there is a selection
ISelection currentSelection = getSelection();
// direct edit mode
if (currentSelection != null) {
if (currentSelection instanceof StructuredSelection) {
EditPart targetStructureEditPart = (EditPart) ((StructuredSelection) currentSelection).getFirstElement();
if (targetStructureEditPart != null) {
while (targetStructureEditPart != null) {
if (targetStructureEditPart instanceof StructureEditPart) {
break;
}
targetStructureEditPart = targetStructureEditPart.getParent();
}
}
EditPart potentialEditPartToSelect = editPart;
while (potentialEditPartToSelect != null) {
if (potentialEditPartToSelect instanceof StructureEditPart) {
break;
}
potentialEditPartToSelect = potentialEditPartToSelect.getParent();
}
// the edit part we found
if (potentialEditPartToSelect == targetStructureEditPart || potentialEditPartToSelect == null || targetStructureEditPart == null) {
result = editPart;
break;
}
}
} else // Otherwise just find the first one and return
{
result = editPart;
break;
}
}
}
}
return result;
}
Aggregations