/** * 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; }
private void initialize(ISynchronizePageConfiguration configuration) { configuration.getSite().getSelectionProvider().addSelectionChangedListener(this); configuration .getPage() .getViewer() .getControl() .addDisposeListener( new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { getConfiguration() .getSite() .getSelectionProvider() .removeSelectionChangedListener(ModelParticipantAction.this); } }); }
/** * Set the active saveable. By default to active saveable is stored with the synchronize page * configuration. * * @param saveable the saveable that is now active (or <code>null</code> if no saveable is * active). */ protected void setActiveSaveable(SaveableComparison saveable) { ((ModelSynchronizeParticipant) configuration.getParticipant()).setActiveSaveable(saveable); }
/** * Return the currently active saveable. By default, the active saveable is obtained from the * synchronization page configuration. * * @return the currently active saveable (or <code>null</code> if no buffer is active). */ protected SaveableComparison getActiveSaveable() { return ((ModelSynchronizeParticipant) configuration.getParticipant()).getActiveSaveable(); }