private boolean isAnySideEditable() { // we only enable the new resolve UI if exactly one side is editable return isLeftEditable() || isRightEditable(); }
@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 protected void updateToolItems() { if (fCopyDiffLeftToRightItem != null) { fCopyDiffLeftToRightItem.setVisible(isRightEditable()); } if (fCopyDiffRightToLeftItem != null) { fCopyDiffRightToLeftItem.setVisible(isLeftEditable()); } //only update toolbar items if diffs need to be calculated (which //dictates whether a toolbar gets added at all) if (!isPatchHunk()){ if (fIgnoreAncestorItem != null) fIgnoreAncestorItem.setVisible(isThreeWay()); if (fCopyDiffLeftToRightItem != null) { IAction a= fCopyDiffLeftToRightItem.getAction(); if (a != null) a.setEnabled(a.isEnabled() && !fHasErrors); } if (fCopyDiffRightToLeftItem != null) { IAction a= fCopyDiffRightToLeftItem.getAction(); if (a != null) a.setEnabled(a.isEnabled() && !fHasErrors); } } super.updateToolItems(); }
configureSourceViewer(fAncestor.getSourceViewer(), false, null); configureSourceViewer(fLeft.getSourceViewer(), isLeftEditable() && cp.isLeftEditable(input), fLeftContributor); configureSourceViewer(fRight.getSourceViewer(), isRightEditable() && cp.isRightEditable(input), fRightContributor); isConfigured = true; // configure once fLeftLineCount= fLeft.getLineCount(); fRightContributor.setDocument(fRight, isRightEditable() && cp.isRightEditable(input)); fRightLineCount= fRight.getLineCount();
Utilities.initAction(a, getResourceBundle(), "action.CopyDiffLeftToRight."); //$NON-NLS-1$ fCopyDiffLeftToRightItem= new ActionContributionItem(a); fCopyDiffLeftToRightItem.setVisible(isRightEditable()); tbm.appendToGroup("merge", fCopyDiffLeftToRightItem); //$NON-NLS-1$ fHandlerService.registerAction(a, "org.eclipse.compare.copyLeftToRight"); //$NON-NLS-1$