Package ru.batrdmi.svnplugin.logic

Examples of ru.batrdmi.svnplugin.logic.Revision


        List<Revision> revisions = ae.getData(SVNRevisionGraph.SELECTED_REVISIONS);
        int selectionSize = (revisions == null) ? 0 : revisions.size();
        if (selectionSize == 2) {
            graph.compareFileRevisions(revisions.get(0), revisions.get(1));
        } else if (selectionSize == 1) {
            Revision currentRevision = ae.getData(SVNRevisionGraph.CURRENT_REVISION);
            graph.compareFileRevisions(revisions.get(0), currentRevision);
        }
    }
View Full Code Here


    }

    public void update(@NotNull AnActionEvent e) {
        Presentation presentation = e.getPresentation();
        FilePath filePath = e.getData(SVNRevisionGraph.SRC_FILE);
        Revision revision = e.getData(SVNRevisionGraph.SELECTED_REVISION);
        boolean enabled = isEnabled(filePath, revision);
        presentation.setEnabled(enabled);
        presentation.setVisible(enabled || !ActionPlaces.isPopupPlace(e.getPlace()));
    }
View Full Code Here

        return cell.isEdge() && !cell.getStyle().equals(SVNRevisionGraph.IN_BRANCH_LINK_STYLE);
    }

    private static Set<mxCell> highlightEdge(RevisionGraphModel model, mxCell edge, boolean on) {
        Set<mxCell> changedCells = new HashSet<mxCell>();
        Revision targetRev = ((RevisionGraphModel.Node)edge.getTarget().getValue()).revisions.get(0);
        List<Revision> copiedOrMergedRevisions = targetRev.getCopiedOrMergedRevisions();
        for (Revision r : copiedOrMergedRevisions) {
            mxCell cell = model.getCellForRevision(r);
            if (cell != null) {
                changedCells.add(cell);
            }
View Full Code Here

        }
        List<RevisionGraphModel.Node> selectedRevs = graph.getModel().getSelectedNodes();
        if (selectedRevs.size() != 1) {
            return false;
        }
        Revision targetRevision = kp.moveFrom(selectedRevs.get(0));
        if (targetRevision != null) {
            graph.selectAndShowRevision(targetRevision);
        }
        return true;
    }
View Full Code Here

        }
        return true;
    }

    private Revision moveUp(RevisionGraphModel.Node currentNode) {
        Revision current = currentNode.revisions.get(0);
        RevisionGraphModel model = graph.getModel();
        Set<Revision> linkedRevs = model.getLinkedRevisions(current);
        if (linkedRevs.isEmpty()) {
            graph.moveUpRange();
            return null;
        }
        Revision result = null;
        double currY = model.getCellForRevision(current).getGeometry().getY();
        Comparator<Revision> comparator = new LinkedRevisionsByDistance(current, false);
        for (Revision r : linkedRevs) {
            if ((model.getCellForRevision(r).getGeometry().getY() - currY < PRECISION)
                    && (result == null || comparator.compare(result, r) > 0)) {
View Full Code Here

        }
        return result;
    }

    private Revision moveDown(RevisionGraphModel.Node currentNode) {
        Revision current = currentNode.revisions.get(0);
        RevisionGraphModel model = graph.getModel();
        Set<Revision> linkedRevs = model.getLinkedRevisions(current);
        if (linkedRevs.isEmpty()) {
            graph.moveDownRange();
            return null;
        }
        Revision result = null;
        double currY = model.getCellForRevision(current).getGeometry().getY();
        Comparator<Revision> comparator = new LinkedRevisionsByDistance(current, true);
        for (Revision r : linkedRevs) {
            if ((model.getCellForRevision(r).getGeometry().getY() - currY > PRECISION)
                    && (result == null || comparator.compare(result, r) > 0)) {
View Full Code Here

        }
        return (result == null) ? current : result;
    }

    private Revision moveLeft(RevisionGraphModel.Node currentNode) {
        Revision current = currentNode.revisions.get(0);
        List<Revision> revsOnPath = graph.getModel().getRevisionsForPath(current.getRelPath());
        ListIterator<Revision> it = revsOnPath.listIterator(revsOnPath.size());
        while (it.hasPrevious()) {
            Revision r = it.previous();
            if (r.equals(current) && it.hasPrevious()) {
                return it.previous();
            }
        }
        return null;
    }
View Full Code Here

        }
        return null;
    }

    private Revision moveRight(RevisionGraphModel.Node currentNode) {
        Revision current = currentNode.revisions.get(currentNode.revisions.size() - 1);
        List<Revision> revsOnPath = graph.getModel().getRevisionsForPath(current.getRelPath());
        Iterator<Revision> it = revsOnPath.iterator();
        while (it.hasNext()) {
            Revision r = it.next();
            if (r.equals(current) && it.hasNext()) {
                return it.next();
            }
        }
        return null;
    }
View Full Code Here

    }

    private mxCell createCell(mxCell neighborCell, Revision rev, boolean collapseRevisions) {
        mxCell result;
        List<Revision> prevList = (neighborCell == null) ? null : ((Node)neighborCell.getValue()).revisions;
        Revision prevRev = (prevList == null) ? null : prevList.get(prevList.size() - 1);
        int thisOrder = revisionOrder.get(rev);
        int prevOrder = (prevRev == null) ? -100 : revisionOrder.get(prevRev);
        if (collapseRevisions && prevRev != currentRevision && rev != currentRevision
                && prevRev != null && !linkedRevisions.containsKey(prevRev) && !prevRev.isDeleted()
                && !linkedRevisions.containsKey(rev) && !rev.isDeleted() && (thisOrder - prevOrder) == 1
                && (prevOrder == 0 || revisions.get(prevOrder - 1).getRevisionNumber() < prevRev.getRevisionNumber())
                && (thisOrder == (revisions.size() - 1) || revisions.get(thisOrder + 1).getRevisionNumber() > rev.getRevisionNumber())) {
            prevList.add(rev);
            result = neighborCell;
        } else {
            List<Revision> nodeRevisions = new ArrayList<Revision>();
            nodeRevisions.add(rev);
            result = new mxCell(new Node(nodeRevisions), new mxGeometry(), null);
            result.setVertex(true);
            result.setConnectable(true);
            result.setStyle(SVNRevisionGraph.REVISION_STYLE + ";"
                    + mxConstants.STYLE_STROKEWIDTH + "=" + ((rev == currentRevision) ? "3" : "1"+ ";"
                    + mxConstants.STYLE_DASHED + "=" + rev.isDeleted());
            addCell(result);
            if (prevRev != null && !prevRev.isDeleted()) {
                createEdge(neighborCell, result, false);
            }
        }
        cellMap.put(rev, result);
        return result;
View Full Code Here

        Double nextY = null;
        int i = 0;
        for (String path : revMap.keySet()) {
            ArrayList<Revision> revsOnPath = revMap.get(path);
            if (i != 0) {
                Revision firstRev = revsOnPath.get(0);
                lastCell = getLinkedCell(firstRev);
            }
            int relativePosition = SwingConstants.BOTTOM;
            double widestY = 0;
            for (Revision rev : revsOnPath) {
                mxCell cell = cellMap.get(rev);
                if (cell != lastCell) {
                    lastCell = positionCell(lastCell, relativePosition, nextY, cell);
                    relativePosition = SwingConstants.RIGHT;
                    mxRectangle rect = lastCell.getGeometry();
                    widestY = Math.max(widestY, rect.getY() + rect.getHeight());
                }
            }
            nextY = widestY + SVNRevisionGraph.CELL_SPACING;
            i++;
        }
        //Now adjust x position in order of revision numbers
        for (i = 1; i < revisions.size(); i++) {
            Revision rev = revisions.get(i);
            Revision prevRev = revisions.get(i - 1);
            mxCell cell = cellMap.get(rev);
            mxCell prevCell = cellMap.get(prevRev);
            if (cell != prevCell) {
                Rectangle rect = cell.getGeometry().getRectangle();
                positionCell(prevCell,
                        rev.getRevisionNumber() > prevRev.getRevisionNumber() ? SwingConstants.RIGHT : SwingConstants.BOTTOM,
                        rect.getY(), cell);
            }
        }
    }
View Full Code Here

TOP

Related Classes of ru.batrdmi.svnplugin.logic.Revision

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.