Search in sources :

Example 1 with BaseElement

use of org.jboss.tools.hibernate.ui.diagram.editors.model.BaseElement in project jbosstools-hibernate by jbosstools.

the class OrmEditPart method getOrmDiagram.

public OrmDiagram getOrmDiagram() {
    BaseElement modelTmp = (BaseElement) getModel();
    OrmDiagram res = modelTmp instanceof OrmDiagram ? (OrmDiagram) modelTmp : null;
    while (modelTmp != null && modelTmp.getParent() != null) {
        modelTmp = modelTmp.getParent();
        res = modelTmp instanceof OrmDiagram ? (OrmDiagram) modelTmp : res;
    }
    return res;
}
Also used : BaseElement(org.jboss.tools.hibernate.ui.diagram.editors.model.BaseElement) OrmDiagram(org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram)

Example 2 with BaseElement

use of org.jboss.tools.hibernate.ui.diagram.editors.model.BaseElement in project jbosstools-hibernate by jbosstools.

the class ComponentShapeEditPart method propertyChange.

/**
 * @see java.beans.PropertyChangeListener#propertyChange(PropertyChangeEvent)
 */
@Override
public void propertyChange(PropertyChangeEvent evt) {
    String prop = evt.getPropertyName();
    if (ExpandableShape.EXPANDED.equals(prop)) {
        boolean expanded = (Boolean) evt.getNewValue();
        if (getComponentFigure() != null) {
            getComponentFigure().setExpanded(expanded);
        }
        BaseElement parent = getModelParent();
        if (parent.getParent() != null) {
            // refresh only parent which has a parent! so we exclude OrmDiagram here
            // refresh only basic properties
            parent.refreshBasic();
        }
        getOrmDiagram().updateDirty(evt.getNewValue() != evt.getOldValue());
    } else if (BaseElement.REFRESH.equals(prop)) {
        if (getComponentFigure() != null) {
            getComponentFigure().setExpanded(getModelExpandableShape().isExpanded());
        }
        super.propertyChange(evt);
    } else {
        super.propertyChange(evt);
    }
    refresh();
}
Also used : BaseElement(org.jboss.tools.hibernate.ui.diagram.editors.model.BaseElement)

Example 3 with BaseElement

use of org.jboss.tools.hibernate.ui.diagram.editors.model.BaseElement in project jbosstools-hibernate by jbosstools.

the class ExpandableShapeEditPart method propertyChange.

/**
 * @see java.beans.PropertyChangeListener#propertyChange(PropertyChangeEvent)
 */
@Override
public void propertyChange(PropertyChangeEvent evt) {
    String prop = evt.getPropertyName();
    if (ExpandableShape.EXPANDED.equals(prop)) {
        boolean expanded = (Boolean) evt.getNewValue();
        if (getTitleLabel() != null) {
            getTitleLabel().setExpanded(expanded);
        }
        BaseElement parent = getModelParent();
        if (parent.getParent() != null) {
            // refresh only parent which has a parent! so we exclude OrmDiagram here
            // refresh only basic properties
            parent.refreshBasic();
        }
        getOrmDiagram().updateDirty(evt.getNewValue() != evt.getOldValue());
    } else if (BaseElement.REFRESH.equals(prop)) {
        if (getTitleLabel() != null) {
            getTitleLabel().setExpanded(getModelExpandableShape().isExpanded());
        }
        super.propertyChange(evt);
        BaseElement parent = getModelParent();
        if (parent.getParent() != null) {
            // refresh only parent which has a parent! so we exclude OrmDiagram here
            // refresh only basic properties
            parent.refreshBasic();
        }
    } else {
        super.propertyChange(evt);
    }
    refresh();
}
Also used : BaseElement(org.jboss.tools.hibernate.ui.diagram.editors.model.BaseElement)

Aggregations

BaseElement (org.jboss.tools.hibernate.ui.diagram.editors.model.BaseElement)3 OrmDiagram (org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram)1