Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » JGit - Override paintCommit (AbstractPlotRenderer)
JGit - Override paintCommit (AbstractPlotRenderer) [message #902699] Sun, 19 August 2012 18:17
Doru Chiulan is currently offline Doru Chiulan
Messages: 2
Registered: August 2012
Junior Member
Hy, i am trying to override paintCommit and i have 2 problems.

Code ( i got it from grepCode) org.eclipse.jgit - 2.0.0.201206130900-r

@Override
    protected void paintCommit(final PlotCommit commit, final int h) {
        
		final int dotSize = computeDotSize(h);
		final PlotLane myLane = commit.getLane();
		final int myLaneX = laneC(myLane);
		final Color myColor = laneColor(myLane);
                
		int maxCenter = 0;
		for (final PlotLane passingLane : (PlotLane[]) commit.passingLanes) {
			final int cx = laneC(passingLane);
			final Color c = laneColor(passingLane);
			drawLine(c, cx, 0, cx, h, LINE_WIDTH);
			maxCenter = Math.max(maxCenter, cx);
		}

		final int nParent = commit.getParentCount();
		for (int i = 0; i < nParent; i++) {
			final PlotCommit<PlotLane> p;
			final PlotLane pLane;
			final Color pColor;
			final int cx;

			p = (PlotCommit<PlotLane>) commit.getParent(i);
			pLane = p.getLane();
			if (pLane == null)
				continue;

			pColor = laneColor(pLane);
			cx = laneC(pLane);

			if (Math.abs(myLaneX - cx) > LANE_WIDTH) {
				if (myLaneX < cx) {
					final int ix = cx - LANE_WIDTH / 2;
					drawLine(pColor, myLaneX, h / 2, ix, h / 2, LINE_WIDTH);
					drawLine(pColor, ix, h / 2, cx, h, LINE_WIDTH);
				} else {
					final int ix = cx + LANE_WIDTH / 2;
					drawLine(pColor, myLaneX, h / 2, ix, h / 2, LINE_WIDTH);
					drawLine(pColor, ix, h / 2, cx, h, LINE_WIDTH);
				}
			} else {
				drawLine(pColor, myLaneX, h / 2, cx, h, LINE_WIDTH);
			}
			maxCenter = Math.max(maxCenter, cx);
		}

		final int dotX = myLaneX - dotSize / 2 - 1;
		final int dotY = (h - dotSize) / 2;

		if (commit.getChildCount() > 0)
			drawLine(myColor, myLaneX, 0, myLaneX, dotY, LINE_WIDTH);

		if (commit.has(RevFlag.UNINTERESTING))
			drawBoundaryDot(dotX, dotY, dotSize, dotSize);
		else
			drawCommitDot(dotX, dotY, dotSize, dotSize);
	}


I am having problems with TLane/TColor class which are reported to not exist.
The 2nd problem is with commit.passingLanes . "passingLanes" is reported to not be public.

I want to remove the label and the short message from the renderer so just the graph is shown. Is that the wrong code for paintCommit? or what could be the problem?
Previous Topic:still no decorations for local tracking?
Next Topic:Not saving "Synchronize Git" information
Goto Forum:
  


Current Time: Fri Jul 25 19:16:34 EDT 2014

Powered by FUDForum. Page generated in 0.01358 seconds