/** * Return whether the given diff should be visible based on the configuration of the * synchronization page showing this content. An {@link IThreeWayDiff} is visible if the direction * of the change matches the mode of the synchronization page. An {@link ITwoWayDiff} is visible * if it has a kind that represents a change. * * @param diff the diff * @return whether the diff should be visible */ protected boolean isVisible(IDiff diff) { if (diff instanceof IThreeWayDiff) { IThreeWayDiff twd = (IThreeWayDiff) diff; return includeDirection(twd.getDirection()); } return diff.getKind() != IDiff.NO_CHANGE; }
/** * 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 */ protected boolean isVisible(IDiff node) { ISynchronizePageConfiguration configuration = getConfiguration(); if (configuration.getComparisonType() == ISynchronizePageConfiguration.THREE_WAY && node instanceof IThreeWayDiff) { IThreeWayDiff twd = (IThreeWayDiff) node; int mode = configuration.getMode(); switch (mode) { case ISynchronizePageConfiguration.INCOMING_MODE: if (twd.getDirection() == IThreeWayDiff.CONFLICTING || twd.getDirection() == IThreeWayDiff.INCOMING) { return true; } break; case ISynchronizePageConfiguration.OUTGOING_MODE: if (twd.getDirection() == IThreeWayDiff.CONFLICTING || twd.getDirection() == IThreeWayDiff.OUTGOING) { return true; } break; case ISynchronizePageConfiguration.CONFLICTING_MODE: if (twd.getDirection() == IThreeWayDiff.CONFLICTING) { return true; } break; case ISynchronizePageConfiguration.BOTH_MODE: return true; } } else if (configuration.getComparisonType() == ISynchronizePageConfiguration.TWO_WAY && node instanceof ITwoWayDiff) { return true; } return false; }