use of org.openlca.app.editors.graphical.command.DeleteLinkCommand in project olca-app by GreenDelta.
the class LinkPart method createEditPolicies.
@Override
protected void createEditPolicies() {
installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new ConnectionEndpointEditPolicy());
installEditPolicy(EditPolicy.CONNECTION_ROLE, new ConnectionEditPolicy() {
@Override
protected Command getDeleteCommand(GroupRequest _req) {
return new DeleteLinkCommand(getModel());
}
});
}
use of org.openlca.app.editors.graphical.command.DeleteLinkCommand in project olca-app by GreenDelta.
the class RemoveAllConnectionsAction method run.
@Override
public void run() {
if (processNodes.size() == 0)
return;
ProductSystemNode systemNode = editor.getModel();
List<Link> links = new ArrayList<>();
// create new link search to avoid problems with missing entries before
// ConnectionLink.unlink is called
List<ProcessLink> pLinks = systemNode.getProductSystem().processLinks;
MutableProcessLinkSearchMap linkSearch = new MutableProcessLinkSearchMap(pLinks);
for (ProcessNode processNode : processNodes) {
List<ProcessLink> processLinks = linkSearch.getLinks(processNode.process.id);
for (ProcessLink link : processLinks) linkSearch.remove(link);
for (Link link : processNode.links) if (!links.contains(link))
links.add(link);
}
Command command = new DeleteLinkCommand(links);
editor.getCommandStack().execute(command);
}
Aggregations