use of com.intellij.vcs.log.graph.api.elements.GraphElement in project intellij-community by JetBrains.
the class CollapsedActionManager method isForDelegateGraph.
private static boolean isForDelegateGraph(@NotNull ActionContext context) {
GraphElement affectedGraphElement = context.getAffectedGraphElement();
if (affectedGraphElement == null)
return false;
GraphEdge dottedEdge = getDottedEdge(context.getAffectedGraphElement(), context.getCompiledGraph());
if (dottedEdge != null) {
int upNodeIndex = context.convertToDelegateNodeIndex(assertInt(dottedEdge.getUpNodeIndex()));
int downNodeIndex = context.convertToDelegateNodeIndex(assertInt(dottedEdge.getDownNodeIndex()));
if (!context.myCollapsedGraph.isMyCollapsedEdge(upNodeIndex, downNodeIndex))
return true;
}
return false;
}
use of com.intellij.vcs.log.graph.api.elements.GraphElement in project intellij-community by JetBrains.
the class PrintElementManagerImpl method isSelected.
@Override
public boolean isSelected(@NotNull PrintElementWithGraphElement printElement) {
if (printElement.equals(mySelectedPrintElement))
return true;
GraphElement graphElement = printElement.getGraphElement();
if (graphElement instanceof GraphNode) {
int nodeId = myLinearGraph.getNodeId(((GraphNode) graphElement).getNodeIndex());
return mySelectedNodeIds.contains(nodeId);
}
if (graphElement instanceof GraphEdge) {
GraphEdge edge = (GraphEdge) graphElement;
boolean selected = edge.getTargetId() == null || mySelectedNodeIds.contains(edge.getTargetId());
selected &= edge.getUpNodeIndex() == null || mySelectedNodeIds.contains(myLinearGraph.getNodeId(edge.getUpNodeIndex()));
selected &= edge.getDownNodeIndex() == null || mySelectedNodeIds.contains(myLinearGraph.getNodeId(edge.getDownNodeIndex()));
return selected;
}
return false;
}
use of com.intellij.vcs.log.graph.api.elements.GraphElement in project intellij-community by JetBrains.
the class PrintElementGeneratorImpl method getDownShortEdges.
@NotNull
@Override
protected List<ShortEdge> getDownShortEdges(int rowIndex) {
NullableFunction<GraphEdge, Integer> endPosition = createEndPositionFunction(rowIndex);
List<ShortEdge> result = new ArrayList<>();
List<GraphElement> visibleElements = getSortedVisibleElementsInRow(rowIndex);
for (int startPosition = 0; startPosition < visibleElements.size(); startPosition++) {
GraphElement element = visibleElements.get(startPosition);
if (element instanceof GraphNode) {
int nodeIndex = ((GraphNode) element).getNodeIndex();
for (GraphEdge edge : myLinearGraph.getAdjacentEdges(nodeIndex, EdgeFilter.ALL)) {
if (isEdgeDown(edge, nodeIndex)) {
Integer endPos = endPosition.fun(edge);
if (endPos != null)
result.add(new ShortEdge(edge, startPosition, endPos));
}
}
}
if (element instanceof GraphEdge) {
GraphEdge edge = (GraphEdge) element;
Integer endPos = endPosition.fun(edge);
if (endPos != null)
result.add(new ShortEdge(edge, startPosition, endPos));
}
}
return result;
}
use of com.intellij.vcs.log.graph.api.elements.GraphElement in project intellij-community by JetBrains.
the class PrintElementGeneratorImpl method getSimpleRowElements.
@NotNull
@Override
protected List<SimpleRowElement> getSimpleRowElements(int visibleRowIndex) {
List<SimpleRowElement> result = new SmartList<>();
List<GraphElement> sortedVisibleElementsInRow = getSortedVisibleElementsInRow(visibleRowIndex);
for (int position = 0; position < sortedVisibleElementsInRow.size(); position++) {
GraphElement element = sortedVisibleElementsInRow.get(position);
if (element instanceof GraphNode) {
result.add(new SimpleRowElement(element, RowElementType.NODE, position));
}
if (element instanceof GraphEdge) {
GraphEdge edge = (GraphEdge) element;
RowElementType arrowType = getArrowType(edge, visibleRowIndex);
if (arrowType != null) {
result.add(new SimpleRowElement(edge, arrowType, position));
}
}
}
return result;
}
use of com.intellij.vcs.log.graph.api.elements.GraphElement in project intellij-community by JetBrains.
the class PrintElementGeneratorImpl method getSortedVisibleElementsInRow.
@NotNull
private List<GraphElement> getSortedVisibleElementsInRow(int rowIndex) {
List<GraphElement> graphElements = myCache.get(rowIndex);
if (graphElements != null) {
return graphElements;
}
List<GraphElement> result = new ArrayList<>();
result.add(myLinearGraph.getGraphNode(rowIndex));
for (GraphEdge edge : myEdgesInRowGenerator.getEdgesInRow(rowIndex)) {
if (isEdgeVisibleInRow(edge, rowIndex))
result.add(edge);
}
addSpecialEdges(result, rowIndex);
Collections.sort(result, myGraphElementComparator);
myCache.put(rowIndex, result);
return result;
}
Aggregations