diff options
author | Michael Valenta | 2006-03-13 21:50:35 +0000 |
---|---|---|
committer | Michael Valenta | 2006-03-13 21:50:35 +0000 |
commit | 49985e24992409f834acbad021110349212643bd (patch) | |
tree | 5d0b6297b66e6ca56a3b0fbe99e8e31fc2b175f2 /bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java | |
parent | ca0f35e905897763527eec706395f8ffa9c6546e (diff) | |
download | eclipse.platform.team-49985e24992409f834acbad021110349212643bd.tar.gz eclipse.platform.team-49985e24992409f834acbad021110349212643bd.tar.xz eclipse.platform.team-49985e24992409f834acbad021110349212643bd.zip |
Bug 128950 [Model Sync] Compress layout operations should match depth
Diffstat (limited to 'bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java')
-rw-r--r-- | bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java index 110cdaae9..caad919b7 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizePageConfiguration.java @@ -19,6 +19,9 @@ import org.eclipse.jface.operation.IRunnableContext; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.ILabelDecorator; +import org.eclipse.team.core.diff.IDiff; +import org.eclipse.team.core.diff.IThreeWayDiff; +import org.eclipse.team.core.mapping.IResourceDiff; import org.eclipse.team.core.synchronize.SyncInfoSet; import org.eclipse.team.internal.ui.TeamUIPlugin; import org.eclipse.team.internal.ui.mapping.CommonViewerAdvisor; @@ -594,4 +597,45 @@ public class SynchronizePageConfiguration extends SynchronizePageActionGroup imp return viewerId; return CommonViewerAdvisor.TEAM_NAVIGATOR_CONTENT; } + + /** + * Return whether the given node is visible in the page based + * on the mode in the configuration. + * @param node a diff node + * @return whether the given node is visible in the page + */ + public boolean isVisible(IDiff node) { + if (getComparisonType() == ISynchronizePageConfiguration.THREE_WAY + && node instanceof IThreeWayDiff) { + IThreeWayDiff twd = (IThreeWayDiff) node; + return includeDirection(twd.getDirection()); + } + return getComparisonType() == ISynchronizePageConfiguration.TWO_WAY && node instanceof IResourceDiff; + } + + /** + * Return whether elements with the given direction should be included in + * the contents. + * + * @param direction + * the synchronization direction + * @return whether elements with the given synchronization kind should be + * included in the contents + */ + public boolean includeDirection(int direction) { + int mode = getMode(); + switch (mode) { + case ISynchronizePageConfiguration.BOTH_MODE: + return true; + case ISynchronizePageConfiguration.CONFLICTING_MODE: + return direction == IThreeWayDiff.CONFLICTING; + case ISynchronizePageConfiguration.INCOMING_MODE: + return direction == IThreeWayDiff.CONFLICTING || direction == IThreeWayDiff.INCOMING; + case ISynchronizePageConfiguration.OUTGOING_MODE: + return direction == IThreeWayDiff.CONFLICTING || direction == IThreeWayDiff.OUTGOING; + default: + break; + } + return true; + } } |