Search in sources :

Example 46 with EditPart

use of org.eclipse.gef.EditPart in project cubrid-manager by CUBRID.

the class TablePart method handleViewModelChange.

@Override
protected void handleViewModelChange(PropertyChangeEvent evt) {
    Object newValue = evt.getNewValue();
    Object oldValue = evt.getOldValue();
    if (oldValue == null || newValue == null) {
        throw new IllegalStateException(Messages.errOldNewValueBothNull);
    }
    if (newValue.equals(oldValue)) {
        return;
    }
    ERTable table = getTable();
    if (newValue.equals(PropertyChangeProvider.LOGIC_MODEL)) {
        setName(table.getLogicName());
    } else if (newValue.equals(PropertyChangeProvider.PHYSICAL_MODEL)) {
        setName(table.getName());
    }
    List<EditPart> children = getChildren();
    for (EditPart part : children) {
        if (part instanceof ColumnPart) {
            ColumnPart columnPart = (ColumnPart) part;
            columnPart.handleViewModelChange(evt);
        }
    }
    refreshVisuals();
}
Also used : ConnectionEditPart(org.eclipse.gef.ConnectionEditPart) NodeEditPart(org.eclipse.gef.NodeEditPart) EditPart(org.eclipse.gef.EditPart) ERTable(com.cubrid.common.ui.er.model.ERTable)

Example 47 with EditPart

use of org.eclipse.gef.EditPart in project cubrid-manager by CUBRID.

the class TablePart method handleRelationMapChange.

/* (non-Javadoc)
	 * @see com.cubrid.common.ui.er.part.BasicPart#handleRelationMapChange(java.beans.PropertyChangeEvent)
	 */
@Override
protected void handleRelationMapChange(PropertyChangeEvent evt) {
    List<EditPart> children = getChildren();
    for (EditPart part : children) {
        if (part instanceof ColumnPart) {
            ColumnPart columnPart = (ColumnPart) part;
            columnPart.handleRelationMapChange(evt);
        }
    }
    refreshVisuals();
}
Also used : ConnectionEditPart(org.eclipse.gef.ConnectionEditPart) NodeEditPart(org.eclipse.gef.NodeEditPart) EditPart(org.eclipse.gef.EditPart)

Example 48 with EditPart

use of org.eclipse.gef.EditPart in project dbeaver by serge-rider.

the class PropertyAwarePart method handleChildChange.

/**
	 * called when child added or removed
	 */
protected void handleChildChange(PropertyChangeEvent evt) {
    //we could do this but it is not very efficient
    //refreshChildren();
    Object newValue = evt.getNewValue();
    Object oldValue = evt.getOldValue();
    if (!((oldValue != null) ^ (newValue != null))) {
        throw new IllegalStateException("Exactly one of old or new values must be non-null for CHILD event");
    }
    if (newValue != null) {
        //add new child
        EditPart editPart = createChild(newValue);
        int modelIndex = getModelChildren().indexOf(newValue);
        addChild(editPart, modelIndex);
    } else {
        List<?> children = getChildren();
        EditPart partToRemove = null;
        for (Iterator<?> iter = children.iterator(); iter.hasNext(); ) {
            EditPart part = (EditPart) iter.next();
            if (part.getModel() == oldValue) {
                partToRemove = part;
                break;
            }
        }
        if (partToRemove != null)
            removeChild(partToRemove);
    }
//getContentPane().revalidate();
}
Also used : AbstractGraphicalEditPart(org.eclipse.gef.editparts.AbstractGraphicalEditPart) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) EditPart(org.eclipse.gef.EditPart) ConnectionEditPart(org.eclipse.gef.ConnectionEditPart) ERDObject(org.jkiss.dbeaver.ext.erd.model.ERDObject) DBPNamedObject(org.jkiss.dbeaver.model.DBPNamedObject)

Example 49 with EditPart

use of org.eclipse.gef.EditPart in project cubrid-manager by CUBRID.

the class MonitorEditPartFacotry method createEditPart.

/**
	 * PartFacotry used by
	 * {@link com.cubrid.cubridmanager.ui.mondashboard.editor.MonitorDashboardEditor}
	 *
	 * @see org.eclipse.gef.EditPartFactory.createEditPart(EditPart context,
	 *      Object model)
	 * @param context parent edit part
	 * @param model current model the new edit part will used
	 * @return edit part
	 */
public EditPart createEditPart(EditPart context, Object model) {
    EditPart part = null;
    Class<?> clazz = MODEL2PARTMAP.get(model.getClass());
    try {
        part = (EditPart) clazz.newInstance();
    } catch (Exception e) {
        throw new IllegalArgumentException(e);
    }
    if (null != part) {
        part.setModel(model);
        part.setParent(context);
    }
    return part;
}
Also used : EditPart(org.eclipse.gef.EditPart)

Example 50 with EditPart

use of org.eclipse.gef.EditPart in project Palladio-Editors-Sirius by PalladioSimulator.

the class LinkingResourceEditPolicyProvider method provides.

@Override
public boolean provides(final IOperation operation) {
    if (operation instanceof CreateEditPoliciesOperation) {
        final CreateEditPoliciesOperation castedOperation = (CreateEditPoliciesOperation) operation;
        final EditPart editPart = castedOperation.getEditPart();
        final Object model = editPart.getModel();
        if (model instanceof View) {
            final View view = (View) model;
            // FIXME find right constraints for this filter
            if (view.getDiagram() != null && view.getDiagram().getElement() != null && view.getDiagram().getElement().eClass().getEPackage().getNsURI().equals(DiagramPackage.eINSTANCE.getNsURI())) {
                if (("SomeVisualID").equals(view.getType())) {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : CreateEditPoliciesOperation(org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation) EditPart(org.eclipse.gef.EditPart) View(org.eclipse.gmf.runtime.notation.View)

Aggregations

EditPart (org.eclipse.gef.EditPart)132 List (java.util.List)50 ArrayList (java.util.ArrayList)37 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)26 NodeContainerEditPart (org.knime.workbench.editor2.editparts.NodeContainerEditPart)20 ProcessPart (org.talend.designer.core.ui.editor.process.ProcessPart)19 SubjobContainerPart (org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart)18 Point (org.eclipse.draw2d.geometry.Point)17 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)17 Command (org.eclipse.gef.commands.Command)16 NodePart (org.talend.designer.core.ui.editor.nodes.NodePart)16 ConnectionEditPart (org.eclipse.gef.ConnectionEditPart)15 ConnectionContainerEditPart (org.knime.workbench.editor2.editparts.ConnectionContainerEditPart)14 Node (org.talend.designer.core.ui.editor.nodes.Node)13 RootEditPart (org.eclipse.gef.RootEditPart)11 ConnLabelEditPart (org.talend.designer.core.ui.editor.connections.ConnLabelEditPart)11 NodeContainerPart (org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart)11 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)10 ScalableFreeformRootEditPart (org.eclipse.gef.editparts.ScalableFreeformRootEditPart)10 INode (org.talend.core.model.process.INode)10