1 11 package org.eclipse.team.internal.ui.mapping; 12 13 import org.eclipse.core.runtime.IPath; 14 import org.eclipse.core.runtime.IProgressMonitor; 15 import org.eclipse.swt.widgets.Shell; 16 import org.eclipse.team.core.diff.*; 17 import org.eclipse.team.core.mapping.ISynchronizationContext; 18 import org.eclipse.team.core.synchronize.SyncInfo; 19 import org.eclipse.team.internal.ui.synchronize.actions.StatusLineContributionGroup; 20 import org.eclipse.team.ui.mapping.ITeamContentProviderManager; 21 import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration; 22 23 public class DiffTreeStatusLineContributionGroup extends 24 StatusLineContributionGroup implements IDiffChangeListener { 25 26 public DiffTreeStatusLineContributionGroup(Shell shell, ISynchronizePageConfiguration configuration) { 27 super(shell, configuration); 28 getSynchronizationContext().getDiffTree().addDiffChangeListener(this); 29 } 30 31 public void dispose() { 32 getSynchronizationContext().getDiffTree().removeDiffChangeListener(this); 33 super.dispose(); 34 } 35 36 protected int getChangeCount() { 37 return getSynchronizationContext().getDiffTree().size(); 38 } 39 40 private ISynchronizationContext getSynchronizationContext() { 41 return (ISynchronizationContext)getConfiguration().getProperty(ITeamContentProviderManager.P_SYNCHRONIZATION_CONTEXT); 42 } 43 44 protected int countFor(int state) { 45 switch (state) { 46 case SyncInfo.OUTGOING: 47 state = IThreeWayDiff.OUTGOING; 48 break; 49 case SyncInfo.INCOMING: 50 state = IThreeWayDiff.INCOMING; 51 break; 52 case SyncInfo.CONFLICTING: 53 state = IThreeWayDiff.CONFLICTING; 54 break; 55 } 56 return (int)getSynchronizationContext().getDiffTree().countFor(state, IThreeWayDiff.DIRECTION_MASK); 57 } 58 59 public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) { 60 updateCounts(); 61 } 62 63 66 public void propertyChanged(IDiffTree tree, int property, IPath[] paths) { 67 } 69 70 } 71 | Popular Tags |