protected void disconnectDocuments() { IMergeViewerContentProvider contentProvider = (IMergeViewerContentProvider) getContentProvider(); Object ancestorContent = contentProvider.getAncestorContent(getInput()); Object leftContent = contentProvider.getLeftContent(getInput()); Object rightContent = contentProvider.getRightContent(getInput()); documentProvider.disconnect(inputObjectStreamContentAccessorMap.get(ancestorContent)); documentProvider.disconnect(inputObjectStreamContentAccessorMap.get(leftContent)); documentProvider.disconnect(inputObjectStreamContentAccessorMap.get(rightContent)); }
Image ancestorImage = content.getAncestorImage(input); if (ancestorImage != null) fAncestorLabel.setImage(ancestorImage); String ancestorLabel = content.getAncestorLabel(input); if (ancestorLabel != null) fAncestorLabel.setText(TextProcessor.process(ancestorLabel)); Image leftImage = content.getLeftImage(input); if (leftImage != null) fLeftLabel.setImage(leftImage); String leftLabel = content.getLeftLabel(input); if (leftLabel != null) fLeftLabel.setText(TextProcessor.process(leftLabel)); Image rightImage = content.getRightImage(input); if (rightImage != null) fRightLabel.setImage(rightImage); String rightLabel = content.getRightLabel(input); if (rightLabel != null) fRightLabel.setText(TextProcessor.process(rightLabel));
boolean enable= content.isRightEditable(input); boolean enable= content.isLeftEditable(input);
void flushLeftSide(Object input, IProgressMonitor monitor) { IMergeViewerContentProvider content = (IMergeViewerContentProvider) getContentProvider(); boolean rightEmpty = content.getRightContent(input) == null; if (getCompareConfiguration().isLeftEditable() && isLeftDirty()) { byte[] bytes = getContents(true); if (rightEmpty && bytes != null && bytes.length == 0) bytes = null; setLeftDirty(false); content.saveLeftContent(input, bytes); } }
void flushRightSide(Object input, IProgressMonitor monitor) { IMergeViewerContentProvider content = (IMergeViewerContentProvider) getContentProvider(); boolean leftEmpty = content.getLeftContent(input) == null; if (getCompareConfiguration().isRightEditable() && isRightDirty()) { byte[] bytes = getContents(false); if (leftEmpty && bytes != null && bytes.length == 0) bytes = null; setRightDirty(false); content.saveRightContent(input, bytes); } }
boolean leftEmpty= content.getLeftContent(input) == null; boolean rightEmpty= content.getRightContent(input) == null; bytes= null; setLeftDirty(false); content.saveLeftContent(input, bytes); bytes= null; setRightDirty(false); content.saveRightContent(input, bytes);
protected void flushContent(Object oldInput, IProgressMonitor monitor) { // check and handle any shared buffers IMergeViewerContentProvider content= getMergeContentProvider(); Object leftContent = content.getLeftContent(oldInput); Object rightContent = content.getRightContent(oldInput); if (leftContent != null && getCompareConfiguration().isLeftEditable() && isLeftDirty()) { if (fLeftContributor.hasSharedDocument(leftContent)) { if (flush(fLeftContributor)) setLeftDirty(false); } } if (rightContent != null && getCompareConfiguration().isRightEditable() && isRightDirty()) { if (fRightContributor.hasSharedDocument(rightContent)) { if (flush(fRightContributor)) setRightDirty(false); } } if (!(content instanceof MergeViewerContentProvider) || isLeftDirty() || isRightDirty()) { super.flushContent(oldInput, monitor); } }
@Override void flushRightSide(Object oldInput, IProgressMonitor monitor){ IMergeViewerContentProvider content= getMergeContentProvider(); Object rightContent = content.getRightContent(oldInput); if (rightContent != null && isRightEditable() && isRightDirty()) { if (fRightContributor.hasSharedDocument(rightContent)) { if (flush(fRightContributor)) setRightDirty(false); } } if (!(content instanceof MergeViewerContentProvider) || isRightDirty()) { super.flushRightSide(oldInput, monitor); } }
@Override void flushLeftSide(Object oldInput, IProgressMonitor monitor){ IMergeViewerContentProvider content= getMergeContentProvider(); Object leftContent = content.getLeftContent(oldInput); if (leftContent != null && isLeftEditable() && isLeftDirty()) { if (fLeftContributor.hasSharedDocument(leftContent)) { if (flush(fLeftContributor)) setLeftDirty(false); } } if (!(content instanceof MergeViewerContentProvider) || isLeftDirty()) { super.flushLeftSide(oldInput, monitor); } }
Image ancestorImage = content.getAncestorImage(input); if (ancestorImage != null) fAncestorLabel.setImage(ancestorImage); String ancestorLabel = content.getAncestorLabel(input); if (ancestorLabel != null) fAncestorLabel.setText(LegacyActionTools.escapeMnemonics(TextProcessor.process(ancestorLabel))); Image leftImage = content.getLeftImage(input); if (leftImage != null) fLeftLabel.setImage(leftImage); String leftLabel = content.getLeftLabel(input); if (leftLabel != null) fLeftLabel.setText(LegacyActionTools.escapeMnemonics(leftLabel)); Image rightImage = content.getRightImage(input); if (rightImage != null) fRightLabel.setImage(rightImage); String rightLabel = content.getRightLabel(input); if (rightLabel != null) fRightLabel.setText(LegacyActionTools.escapeMnemonics(rightLabel));
Object ancestor= content.getAncestorContent(input); boolean oldFlag = fIsThreeWay; if (Utilities.isHunk(input)) { Object left= content.getLeftContent(input); Object right= content.getRightContent(input); updateContent(ancestor, left, right);
/** * Updates the enabled state of the toolbar items. * <p> * This method is called whenever the state of the items needs updating. * <p> * Subclasses may extend this method, although this is generally not required. */ protected void updateToolItems() { IMergeViewerContentProvider content= getMergeContentProvider(); Object input= getInput(); if (copyLeftToRightItem != null) { boolean rightEditable = content.isRightEditable(input); copyLeftToRightItem.setVisible(rightEditable); copyLeftToRightItem.getAction().setEnabled(rightEditable); } if (copyRightToLeftItem != null) { boolean leftEditable = content.isLeftEditable(input); copyRightToLeftItem.setVisible(leftEditable); copyRightToLeftItem.getAction().setEnabled(leftEditable); } if (fSwitchLeftAndRight != null) { fSwitchLeftAndRight.setChecked(getCompareConfiguration().isMirrored()); } }
private void internalRefresh(Object input) { IMergeViewerContentProvider content= getMergeContentProvider(); if (content != null) { Object ancestor= content.getAncestorContent(input); boolean oldFlag = fIsThreeWay; if (Utilities.isHunk(input)) { fIsThreeWay = true; } else if (input instanceof ICompareInput) { fIsThreeWay= (((ICompareInput) input).getKind() & Differencer.DIRECTION_MASK) != 0; } else { fIsThreeWay= ancestor != null; } if (fAncestorItem != null) fAncestorItem.setVisible(fIsThreeWay); if (fAncestorVisible && oldFlag != fIsThreeWay) fComposite.layout(true); Object left= content.getLeftContent(input); Object right= content.getRightContent(input); updateContent(ancestor, left, right); updateHeader(); if (Utilities.okToUse(fComposite) && Utilities.okToUse(fComposite.getParent())) { ToolBarManager tbm = (ToolBarManager) getToolBarManager(fComposite.getParent()); if (tbm != null ) { updateToolItems(); tbm.update(true); tbm.getControl().getParent().layout(true); } } } }
if (cp != null) { if (!isPatchHunk()) { rightToLeft= cp.isLeftEditable(getInput()); leftToRight= cp.isRightEditable(getInput());
if (cp != null) { if (!isPatchHunk()) { rightToLeft= cp.isLeftEditable(getInput()); leftToRight= cp.isRightEditable(getInput());
configureSourceViewer(fLeft.getSourceViewer(), isLeftEditable() && cp.isLeftEditable(input), fLeftContributor); configureSourceViewer(fRight.getSourceViewer(), isRightEditable() && cp.isRightEditable(input), fRightContributor); isConfigured = true; // configure once fLeftContributor.setDocument(fLeft, isLeftEditable() && cp.isLeftEditable(input)); fLeftLineCount= fLeft.getLineCount(); fRightContributor.setDocument(fRight, isRightEditable() && cp.isRightEditable(input)); fRightLineCount= fRight.getLineCount();
fLeftContributor.setDocument(fLeft, cc.isLeftEditable() && cp.isLeftEditable(input)); fLeftLineCount= fLeft.getLineCount(); fRightContributor.setDocument(fRight, cc.isRightEditable() && cp.isRightEditable(input)); fRightLineCount= fRight.getLineCount();