private boolean areAllResolved() { boolean allResolved = true; for (ResolveStatus fa : table.getItems()) { allResolved &= fa.isResolved(); } return allResolved; }
/** @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) */ public String getColumnText(Object element, int columnIndex) { ResolveStatus flagged = (ResolveStatus) element; switch (columnIndex) { case 0: return flagged.getStatus(); case 1: // TODO: this is wrong when hgroot not at project root return ((IFile) flagged.getAdapter(IFile.class)).getProjectRelativePath().toString(); } throw new IllegalStateException(); }
private void populateView(boolean attemptToCommit) throws HgException { boolean bAllResolved = true; List<ResolveStatus> status = null; status = HgResolveClient.list(hgRoot); table.setItems(status); for (ResolveStatus flagged : status) { if (flagged.isUnresolved()) { bAllResolved = false; } } completeAction.setEnabled(bAllResolved); /* TODO: remove this block? Commit button enablement provides sufficient feedback if (bAllResolved) { String label; if (merging) { label = Messages.getString("MergeView.PleaseCommitMerge"); } else { label = Messages.getString("MergeView.PleaseCommitRebase"); } showInfo(label); } else { hideStatus(); }*/ // Show commit dialog if (attemptToCommit && MercurialUtilities.isOfferAutoCommitMerge() && areAllResolved()) { /* * Offer commit of merge or rebase exactly once if no conflicts are found. Uses {@link * ResourceProperties#MERGE_COMMIT_OFFERED} to avoid showing the user the commit dialog * repeatedly. This flag should be cleared when any of the following operations occur: * commit, rebase, revert. */ attemptToCommit(); } }
/** * @see * com.vectrace.MercurialEclipse.ui.AbstractHighlightableTable.HighlightingLabelProvider#isHighlighted(java.lang.Object) */ @Override public boolean isHighlighted(ResolveStatus flagged) { return flagged.isUnresolved(); }
private static void openMergeEditor(ResolveStatus flagged) { IFile file = (IFile) flagged.getAdapter(IFile.class); CompareAction compareAction = new CompareAction(file); compareAction.setEnableMerge(true); compareAction.run(null); }
private static IFile getFile(ResolveStatus adaptable) { if (adaptable != null) { return (IFile) adaptable.getAdapter(IFile.class); } return null; }