use of com.archimatetool.model.IDiagramModelObject in project archi by archimatetool.
the class BasicConnectionPolicy method getConnectionCreateCommand.
@Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
CreateDiagramConnectionCommand cmd = null;
EClass classType = (EClass) request.getNewObjectType();
IDiagramModelObject source = (IDiagramModelObject) getHost().getModel();
if (isValidConnectionSource(source, classType)) {
cmd = new CreateDiagramConnectionCommand(request);
cmd.setSource(source);
request.setStartCommand(cmd);
}
return cmd;
}
use of com.archimatetool.model.IDiagramModelObject in project archi by archimatetool.
the class BasicContainerEditPolicy method getOrphanChildrenCommand.
/*
* This allows us to drag parts from a parent container to another.
* This is the "remove" counterpart to the "add" Command created in DiagramLayoutPolicy.createAddCommand(EditPart, Object);
*
* If you don't want a part to be removed, return null here.
*/
@Override
public Command getOrphanChildrenCommand(GroupRequest request) {
CompoundCommand result = new CompoundCommand(Messages.BasicContainerEditPolicy_0);
IDiagramModelContainer parent = (IDiagramModelContainer) getHost().getModel();
for (Object o : request.getEditParts()) {
EditPart editPart = (EditPart) o;
IDiagramModelObject child = (IDiagramModelObject) editPart.getModel();
result.add(new RemoveObjectCommand(parent, child));
}
return result;
}
use of com.archimatetool.model.IDiagramModelObject in project archi by archimatetool.
the class DiagramLayoutPolicy method createAddCommand.
/*
* This allows us to drag parts from a parent container to another.
* This is the "add" counterpart to the "remove" Command created in BasicContainerEditPolicy.getOrphanChildrenCommand(GroupRequest);
*
* If you don't want a part to be added, return null here.
*/
@Override
protected AddObjectCommand createAddCommand(ChangeBoundsRequest request, EditPart childEditPart, Object constraint) {
IDiagramModelContainer parent = (IDiagramModelContainer) getHost().getModel();
IDiagramModelObject child = (IDiagramModelObject) childEditPart.getModel();
// Keep within box
Rectangle bounds = (Rectangle) constraint;
if (bounds.x < 0) {
bounds.x = 0;
}
if (bounds.y < 0) {
bounds.y = 0;
}
return new AddObjectCommand(parent, child, bounds);
}
use of com.archimatetool.model.IDiagramModelObject in project archi by archimatetool.
the class PartComponentEditPolicy method createDeleteCommand.
@Override
protected Command createDeleteCommand(GroupRequest request) {
IDiagramModelObject object = (IDiagramModelObject) getHost().getModel();
boolean isLocked = object instanceof ILockable && ((ILockable) object).isLocked();
return isLocked ? null : DiagramCommandFactory.createDeleteDiagramObjectCommand(object);
}
use of com.archimatetool.model.IDiagramModelObject in project archi by archimatetool.
the class NestedElementsChecker method findWrongNestedElements.
// Nested diagram elements without correct relationships
List<IIssue> findWrongNestedElements() {
List<IIssue> issues = new ArrayList<IIssue>();
for (IArchimateDiagramModel dm : fViews) {
for (Iterator<EObject> iter = dm.eAllContents(); iter.hasNext(); ) {
EObject eObject = iter.next();
if (eObject instanceof IDiagramModelArchimateObject) {
IDiagramModelArchimateObject parent = (IDiagramModelArchimateObject) eObject;
for (IDiagramModelObject dmoChild : parent.getChildren()) {
if (dmoChild instanceof IDiagramModelArchimateObject) {
IDiagramModelArchimateObject child = (IDiagramModelArchimateObject) dmoChild;
if (isNestedWithoutValidRelation(parent, child)) {
String description = NLS.bind(fDescription, new Object[] { child.getName(), parent.getName() });
IIssue issue = new AdviceType(fName, description, fExplanation, child);
issues.add(issue);
}
}
}
}
}
}
return issues;
}
Aggregations