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();
}
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();
}
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();
}
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;
}
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;
}
Aggregations