diff options
author | Mathias Kinzler | 2010-12-08 07:33:10 +0000 |
---|---|---|
committer | Mathias Kinzler | 2010-12-08 07:33:10 +0000 |
commit | bfc439fe900dd036aa97a36b9a0dea18b5e9df20 (patch) | |
tree | c370bcb6d480c015542cdcb068ae7bd7a4571bb0 /org.eclipse.egit.ui/src/org | |
parent | 90da7ba7b9fb3c4db61ddfa60b1e13abc25d8b43 (diff) | |
download | egit-bfc439fe900dd036aa97a36b9a0dea18b5e9df20.tar.gz egit-bfc439fe900dd036aa97a36b9a0dea18b5e9df20.tar.xz egit-bfc439fe900dd036aa97a36b9a0dea18b5e9df20.zip |
Rebase Interoperability: do not auto-abort upon conflict
EGit now stops when a conflict is found during rebase and allows the
user to manipulate the content; they can then switch to the command
line to continue the rebase.
The rebase result dialog also offers the options to abort the current
rebase altogether or to open the merge tool to work out the conflicts.
Change-Id: Ie694e09b45c43ee82254231d4f619fbe5510d5eb
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
Diffstat (limited to 'org.eclipse.egit.ui/src/org')
9 files changed, 310 insertions, 128 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/PluginPreferenceInitializer.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/PluginPreferenceInitializer.java index 4d0c355064..9d4b224573 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/PluginPreferenceInitializer.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/PluginPreferenceInitializer.java @@ -69,6 +69,7 @@ public class PluginPreferenceInitializer extends AbstractPreferenceInitializer { store.setDefault(UIPreferences.REFESH_ON_INDEX_CHANGE, true); store.setDefault(UIPreferences.REFESH_ONLY_WHEN_ACTIVE, true); store.setDefault(UIPreferences.DEFAULT_REPO_DIR, FS.DETECTED.userHome().getPath()); + store.setDefault(UIPreferences.REBASE_HIDE_CONFIRM, false); } } diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIPreferences.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIPreferences.java index 57a20ea778..eae4a6b099 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIPreferences.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIPreferences.java @@ -100,6 +100,8 @@ public class UIPreferences { public static final String DEFAULT_REPO_DIR = "default_repository_dir"; //$NON-NLS-1$ /** */ public static final String MERGE_MODE = "merge_mode"; //$NON-NLS-1$ + /** */ + public static final String REBASE_HIDE_CONFIRM = "rebase_hide_confirm"; //$NON-NLS-1$ /** * Converts a persisted String separated with commas to an integer array diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java index f05494a02e..59b7efe15a 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java @@ -413,6 +413,12 @@ public class UIText extends NLS { public static String GitPreferenceRoot_DefaultRepoFolderTooltip; /** */ + public static String GitPreferenceRoot_HideConfirmationGroup; + + /** */ + public static String GitPreferenceRoot_HideRebaseConfirmationField; + + /** */ public static String GitPreferenceRoot_HistoryGroupHeader; /** */ @@ -479,12 +485,24 @@ public class UIText extends NLS { public static String RebaseCurrentRefCommand_RebasingCurrentJobName; /** */ + public static String RebaseResultDialog_AbortButton; + + /** */ + public static String RebaseResultDialog_AbortRebaseRadioText; + + /** */ + public static String RebaseResultDialog_ActionGroupTitle; + + /** */ public static String RebaseResultDialog_CommitIdLabel; /** */ public static String RebaseResultDialog_CommitMessageLabel; /** */ + public static String RebaseResultDialog_ConflictListFailureMessage; + + /** */ public static String RebaseResultDialog_DetailsGroup; /** */ @@ -500,9 +518,21 @@ public class UIText extends NLS { public static String RebaseResultDialog_DiffDetailsLabel; /** */ + public static String RebaseResultDialog_DoNothingRadioText; + + /** */ + public static String RebaseResultDialog_MergeButton; + + /** */ + public static String RebaseResultDialog_StartMergeRadioText; + + /** */ public static String RebaseResultDialog_StatusLabel; /** */ + public static String RebaseResultDialog_ToggleShowButton; + + /** */ public static String RebaseTargetSelectionDialog_DialogMessage; /** */ diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitPreferenceRoot.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitPreferenceRoot.java index 6155b2006e..c5ec5fde1c 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitPreferenceRoot.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitPreferenceRoot.java @@ -142,6 +142,15 @@ public class GitPreferenceRoot extends FieldEditorPreferencePage implements UIText.GitPreferenceRoot_MergeModeTooltip); addField(mergeMode); updateMargins(mergeGroup); + + Group confirmGroup = new Group(main, SWT.SHADOW_ETCHED_IN); + GridDataFactory.fillDefaults().grab(true, false).span(GROUP_SPAN, 1) + .applyTo(confirmGroup); + confirmGroup.setText(UIText.GitPreferenceRoot_HideConfirmationGroup); + addField(new BooleanFieldEditor(UIPreferences.REBASE_HIDE_CONFIRM, + UIText.GitPreferenceRoot_HideRebaseConfirmationField, + confirmGroup)); + updateMargins(confirmGroup); } private void updateMargins(Group group) { diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseResultDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseResultDialog.java index beae4b8c3d..14b1b3f55c 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseResultDialog.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/rebase/RebaseResultDialog.java @@ -10,128 +10,298 @@ *******************************************************************************/ package org.eclipse.egit.ui.internal.rebase; -import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.eclipse.compare.CompareEditorInput; +import org.eclipse.compare.CompareUI; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.egit.core.op.RebaseOperation; +import org.eclipse.egit.core.project.RepositoryMapping; import org.eclipse.egit.ui.Activator; +import org.eclipse.egit.ui.UIPreferences; import org.eclipse.egit.ui.UIText; -import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.egit.ui.internal.merge.GitMergeEditorInput; +import org.eclipse.egit.ui.internal.merge.MergeModeDialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.text.TextViewer; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.window.Window; import org.eclipse.jgit.api.RebaseResult; +import org.eclipse.jgit.api.RebaseCommand.Operation; import org.eclipse.jgit.api.RebaseResult.Status; -import org.eclipse.jgit.diff.DiffFormatter; +import org.eclipse.jgit.dircache.DirCache; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevWalk; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; /** * Display the result of a rebase. */ -public class RebaseResultDialog extends Dialog { - private final Repository repo; +public class RebaseResultDialog extends MessageDialog { + private static final Image INFO = PlatformUI.getWorkbench() + .getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK); private final RebaseResult result; + private final Repository repo; + + private final Set<String> conflictPaths = new HashSet<String>(); + + private Button toggleButton; + + private Button startMergeButton; + + private Button abortRebaseButton; + + private Button doNothingButton; + + /** + * @param result + * the result to show + * @param repository + */ + public static void show(final RebaseResult result, + final Repository repository) { + boolean shouldShow = result.getStatus() == Status.STOPPED + || !Activator.getDefault().getPreferenceStore().getBoolean( + UIPreferences.REBASE_HIDE_CONFIRM); + if (!shouldShow) { + Activator.getDefault().getLog().log( + new org.eclipse.core.runtime.Status(IStatus.INFO, Activator + .getPluginId(), NLS.bind( + UIText.RebaseResultDialog_StatusLabel, result + .getStatus().name()))); + return; + } + PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { + public void run() { + Shell shell = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getShell(); + new RebaseResultDialog(shell, repository, result).open(); + } + }); + } + /** * @param shell - * @param repo + * @param repository * @param result */ - public RebaseResultDialog(Shell shell, Repository repo, RebaseResult result) { - super(shell); + private RebaseResultDialog(Shell shell, Repository repository, + RebaseResult result) { + super(shell, UIText.RebaseResultDialog_DialogTitle, INFO, NLS.bind( + UIText.RebaseResultDialog_StatusLabel, result.getStatus() + .name()), MessageDialog.INFORMATION, + new String[] { IDialogConstants.OK_LABEL }, 0); setShellStyle(getShellStyle() | SWT.SHELL_TRIM); - this.repo = repo; + this.repo = repository; this.result = result; } @Override - protected Control createDialogArea(Composite parent) { + protected Control createCustomArea(Composite parent) { + + if (result.getStatus() != Status.STOPPED) { + createToggleButton(parent); + return null; + } Composite main = new Composite(parent, SWT.NONE); - main.setLayout(new GridLayout(2, false)); + main.setLayout(new GridLayout(1, false)); GridDataFactory.fillDefaults().indent(0, 0).grab(true, true).applyTo( main); - Label resultLabel = new Label(main, SWT.NONE); - resultLabel.setText(UIText.RebaseResultDialog_StatusLabel); - Text resultText = new Text(main, SWT.BORDER); - resultText.setText(result.getStatus().toString()); - resultText.setEditable(false); - GridDataFactory.fillDefaults().grab(true, false).applyTo(resultText); + Group commitGroup = new Group(main, SWT.SHADOW_ETCHED_IN); + GridDataFactory.fillDefaults().grab(true, true).applyTo(commitGroup); + commitGroup.setText(UIText.RebaseResultDialog_DetailsGroup); + commitGroup.setLayout(new GridLayout(1, false)); - if (result.getStatus() == Status.STOPPED) { - String diff; - Group commitGroup = new Group(main, SWT.SHADOW_ETCHED_IN); - GridDataFactory.fillDefaults().span(2, 1).grab(true, true).applyTo( - commitGroup); - commitGroup.setText(UIText.RebaseResultDialog_DetailsGroup); - commitGroup.setLayout(new GridLayout(2, false)); - RevWalk rw = new RevWalk(repo); - - Label commitIdLabel = new Label(commitGroup, SWT.NONE); - commitIdLabel.setText(UIText.RebaseResultDialog_CommitIdLabel); - Text commitId = new Text(commitGroup, SWT.READ_ONLY | SWT.BORDER); - GridDataFactory.fillDefaults().grab(true, false).applyTo(commitId); - - Label commitMessageLabel = new Label(commitGroup, SWT.NONE); - commitMessageLabel - .setText(UIText.RebaseResultDialog_CommitMessageLabel); - Text commitMessage = new Text(commitGroup, SWT.READ_ONLY - | SWT.BORDER); - GridDataFactory.fillDefaults().grab(true, false).applyTo( - commitMessage); - try { - // the commits might not have been fully loaded - RevCommit commit = rw.parseCommit(result.getCurrentCommit()); - RevCommit parentCommit = rw.parseCommit(commit.getParent(0)); - commitMessage.setText(commit.getShortMessage()); - commitId.setText(commit.name()); - - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - DiffFormatter df = new DiffFormatter(bos); - df.setRepository(repo); - try { - df.format(commit.getTree(), parentCommit.getTree()); - diff = bos.toString("UTF-8"); //$NON-NLS-1$ - } catch (IOException e) { - diff = null; - } - } catch (Exception e) { - Activator.handleError( - UIText.RebaseResultDialog_DiffCalculationErrorMessage, - e, false); - diff = UIText.RebaseResultDialog_DiffCalculationErrorDisplay; - } - if (diff != null) { - Label diffLabel = new Label(commitGroup, SWT.NONE); - diffLabel.setText(UIText.RebaseResultDialog_DiffDetailsLabel); - GridDataFactory.fillDefaults().span(2, 1).applyTo(diffLabel); - Text diffArea = new Text(commitGroup, SWT.MULTI | SWT.READ_ONLY - | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); - Point size = diffArea.getSize(); - int minHeight = diffArea.getLineHeight() * 10; - GridDataFactory.fillDefaults().span(2, 1).grab(true, true) - .hint(size).minSize(size.x, minHeight) - .applyTo(diffArea); - diffArea.setText(diff); + Label commitIdLabel = new Label(commitGroup, SWT.NONE); + commitIdLabel.setText(UIText.RebaseResultDialog_CommitIdLabel); + Text commitId = new Text(commitGroup, SWT.READ_ONLY | SWT.BORDER); + GridDataFactory.fillDefaults().grab(true, false).applyTo(commitId); + + Label commitMessageLabel = new Label(commitGroup, SWT.NONE); + commitMessageLabel + .setText(UIText.RebaseResultDialog_CommitMessageLabel); + TextViewer commitMessage = new TextViewer(commitGroup, SWT.H_SCROLL + | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.READ_ONLY); + GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 60) + .applyTo(commitMessage.getControl()); + + boolean conflictListFailure = false; + DirCache dc = null; + RevWalk rw = null; + try { + rw = new RevWalk(repo); + // the commits might not have been fully loaded + RevCommit commit = rw.parseCommit(result.getCurrentCommit()); + commitMessage.getTextWidget().setText(commit.getFullMessage()); + commitId.setText(commit.name()); + dc = repo.lockDirCache(); + for (int i = 0; i < dc.getEntryCount(); i++) { + if (dc.getEntry(i).getStage() > 0) + conflictPaths.add(dc.getEntry(i).getPathString()); } - commitGroup.pack(); - applyDialogFont(main); + } catch (IOException e) { + // the file list will be empty + conflictListFailure = true; + } finally { + if (rw != null) + rw.release(); + if (dc != null) + dc.unlock(); + } + + if (conflictListFailure) { + Label failureLabel = new Label(main, SWT.NONE); + failureLabel + .setText(UIText.RebaseResultDialog_ConflictListFailureMessage); + } else { + Label conflictListLabel = new Label(main, SWT.NONE); + conflictListLabel + .setText(UIText.RebaseResultDialog_DiffDetailsLabel); + TableViewer conflictList = new TableViewer(main, SWT.BORDER); + GridDataFactory.fillDefaults().span(2, 1).grab(true, true).applyTo( + conflictList.getTable()); + conflictList.setContentProvider(ArrayContentProvider.getInstance()); + conflictList.setInput(conflictPaths); } + + Group actionGroup = new Group(main, SWT.SHADOW_ETCHED_IN); + GridDataFactory.fillDefaults().grab(true, false).applyTo(actionGroup); + actionGroup.setText(UIText.RebaseResultDialog_ActionGroupTitle); + actionGroup.setLayout(new GridLayout(1, false)); + + startMergeButton = new Button(actionGroup, SWT.RADIO); + startMergeButton.setText(UIText.RebaseResultDialog_StartMergeRadioText); + abortRebaseButton = new Button(actionGroup, SWT.RADIO); + abortRebaseButton + .setText(UIText.RebaseResultDialog_AbortRebaseRadioText); + doNothingButton = new Button(actionGroup, SWT.RADIO); + doNothingButton.setText(UIText.RebaseResultDialog_DoNothingRadioText); + startMergeButton.setSelection(true); + + commitGroup.pack(); + applyDialogFont(main); + return main; } @Override - protected void configureShell(Shell newShell) { - super.configureShell(newShell); - newShell.setText(UIText.RebaseResultDialog_DialogTitle); + protected void buttonPressed(int buttonId) { + // store the preference to hide these dialogs + if (toggleButton != null) + Activator.getDefault().getPreferenceStore().setValue( + UIPreferences.REBASE_HIDE_CONFIRM, + toggleButton.getSelection()); + if (buttonId == IDialogConstants.OK_ID) { + if (result.getStatus() != Status.STOPPED) { + super.buttonPressed(buttonId); + return; + } + if (startMergeButton.getSelection()) { + super.buttonPressed(buttonId); + // open the merge tool + List<IProject> validProjects = new ArrayList<IProject>(); + IProject[] projects = ResourcesPlugin.getWorkspace().getRoot() + .getProjects(); + for (IProject project : projects) { + RepositoryMapping mapping = RepositoryMapping + .getMapping(project); + if (mapping != null && mapping.getRepository().equals(repo)) { + validProjects.add(project); + try { + // make sure to refresh before opening the merge + // tool + project + .refreshLocal(IResource.DEPTH_INFINITE, + null); + } catch (CoreException e) { + Activator.handleError(e.getMessage(), e, false); + } + } + } + List<IResource> resourceList = new ArrayList<IResource>(); + IPath repoWorkdirPath = new Path(repo.getWorkTree().getPath()); + for (String repoPath : conflictPaths) { + IPath filePath = repoWorkdirPath.append(repoPath); + for (IProject project : validProjects) { + if (project.getLocation().isPrefixOf(filePath)) { + IResource res = project.getFile(filePath + .removeFirstSegments(project.getLocation() + .segmentCount())); + resourceList.add(res); + } + } + } + IResource[] resources = new IResource[resourceList.size()]; + resourceList.toArray(resources); + int mergeMode = Activator.getDefault().getPreferenceStore() + .getInt(UIPreferences.MERGE_MODE); + CompareEditorInput input; + if (mergeMode == 0) { + MergeModeDialog dlg = new MergeModeDialog(getParentShell()); + if (dlg.open() != Window.OK) + return; + input = new GitMergeEditorInput(dlg.useWorkspace(), + resources); + } else { + boolean useWorkspace = mergeMode == 1; + input = new GitMergeEditorInput(useWorkspace, resources); + } + CompareUI.openCompareEditor(input); + return; + } else if (abortRebaseButton.getSelection()) { + // abort the rebase + if (result.getStatus() == Status.STOPPED) { + try { + final RebaseOperation op = new RebaseOperation(repo, + Operation.ABORT); + op.execute(null); + + show(op.getResult(), repo); + } catch (CoreException e) { + Activator.handleError(e.getMessage(), e, true); + } + } + } else if (doNothingButton.getSelection()) { + // nothing + } + } + super.buttonPressed(buttonId); + } + + private void createToggleButton(Composite parent) { + boolean toggleState = Activator.getDefault().getPreferenceStore() + .getBoolean(UIPreferences.REBASE_HIDE_CONFIRM); + toggleButton = new Button(parent, SWT.CHECK | SWT.LEFT); + toggleButton.setText(UIText.RebaseResultDialog_ToggleShowButton); + toggleButton.setSelection(toggleState); } -} +}
\ No newline at end of file diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/RepositoriesViewPropertyTester.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/RepositoriesViewPropertyTester.java index d17b38efb1..1b7ee26283 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/RepositoriesViewPropertyTester.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/RepositoriesViewPropertyTester.java @@ -116,9 +116,9 @@ public class RepositoriesViewPropertyTester extends PropertyTester { } } - if (property.equals("isRebasing")) //$NON-NLS-1$ + if (property.equals("canAbortRebase")) //$NON-NLS-1$ switch (node.getRepository().getRepositoryState()) { - case REBASING_MERGE: + case REBASING_INTERACTIVE: return true; default: return false; diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/AbortRebaseCommand.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/AbortRebaseCommand.java index 66b4757b38..6d1d42849a 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/AbortRebaseCommand.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/AbortRebaseCommand.java @@ -77,19 +77,7 @@ public class AbortRebaseCommand extends } }); } else if (result.isOK()) { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - Shell shell = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow() - .getShell(); - new RebaseResultDialog(shell, repository, - rebase.getResult()).open(); - } - }); - } - }); + RebaseResultDialog.show(rebase.getResult(), repository); } } }); diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/RebaseCurrentRefCommand.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/RebaseCurrentRefCommand.java index 872df41135..c7976b42c7 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/RebaseCurrentRefCommand.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/RebaseCurrentRefCommand.java @@ -11,7 +11,6 @@ package org.eclipse.egit.ui.internal.repository.tree.command; import java.io.IOException; -import java.util.concurrent.atomic.AtomicBoolean; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; @@ -32,7 +31,6 @@ import org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jgit.api.RebaseResult; import org.eclipse.jgit.api.RebaseCommand.Operation; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; @@ -52,7 +50,6 @@ public class RebaseCurrentRefCommand extends RepositoryTreeNode node = getSelectedNodes(event).get(0); - final AtomicBoolean abortedDueToConflict = new AtomicBoolean(); final Repository repository = node.getRepository(); Ref ref; @@ -81,14 +78,6 @@ public class RebaseCurrentRefCommand extends protected IStatus run(IProgressMonitor monitor) { try { rebase.execute(monitor); - // TODO for the time being, we will abort immediately once - // we have found a conflict - RebaseResult result = rebase.getResult(); - if (result.getStatus() == org.eclipse.jgit.api.RebaseResult.Status.STOPPED) { - abortedDueToConflict.set(true); - new RebaseOperation(repository, Operation.ABORT) - .execute(monitor); - } } catch (final CoreException e) { try { new RebaseOperation(repository, Operation.ABORT) @@ -123,23 +112,7 @@ public class RebaseCurrentRefCommand extends } }); } else if (result.isOK()) { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - // don't get the shell from the event, as this is - // asynchronous - Shell shell = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getShell(); - if (abortedDueToConflict.get()) - MessageDialog - .openError( - shell, - UIText.RebaseCurrentRefCommand_AbortedDialogTitle, - UIText.RebaseCurrentRefCommand_AbortedDialogMessage); - else - new RebaseResultDialog(shell, repository, - rebase.getResult()).open(); - } - }); + RebaseResultDialog.show(rebase.getResult(), repository); } } }); diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties index 0aa7bd8717..8ecc1e2843 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties @@ -6,7 +6,6 @@ # http://www.eclipse.org/legal/epl-v10.html # ############################################################################### - AbortRebaseCommand_CancelDialogMessage=The Abort operation was canceled AbortRebaseCommand_CancelDialogTitle=Abort of Rebase was canceled AbortRebaseCommand_JobName=Aborting Rebase @@ -142,12 +141,14 @@ GitHistoryPage_ShowAllBranchesMenuLabel=Show all &Branches GitPreferenceRoot_CloningRepoGroupHeader=Cloning Repositories GitPreferenceRoot_DefaultRepoFolderLabel=Default Repository &folder: GitPreferenceRoot_DefaultRepoFolderTooltip=This folder will be suggested as parent folder when cloning a Remote Repository +GitPreferenceRoot_HideConfirmationGroup=Hide confirmation dialogs +GitPreferenceRoot_HideRebaseConfirmationField=R&ebase GitPreferenceRoot_HistoryGroupHeader=History View GitPreferenceRoot_MergeGroupHeader=Merge GitPreferenceRoot_MergeMode_0_Label=Ask the user when the tool is started GitPreferenceRoot_MergeMode_1_Label=Workspace (pre-merged by Git) GitPreferenceRoot_MergeMode_2_Label=Last HEAD (unmerged) -GitPreferenceRoot_MergeModeLabel=Merge Tool Content +GitPreferenceRoot_MergeModeLabel=&Merge Tool Content GitPreferenceRoot_MergeModeTooltip=Determines which content to be displayed on the left side of the merge tool GitPreferenceRoot_RemoteConnectionsGroupHeader=Remote Connections GitPreferenceRoot_RepoChangeScannerGroupHeader=Automatic Refresh @@ -171,14 +172,22 @@ RebaseCurrentRefCommand_AbortedDialogTitle=Rebase aborted RebaseCurrentRefCommand_RebaseCanceledMessage=The Rebase operation was canceled RebaseCurrentRefCommand_RebaseCanceledTitle=Rebase canceled RebaseCurrentRefCommand_RebasingCurrentJobName=Rebasing branch {0} -RebaseResultDialog_CommitIdLabel=Id: -RebaseResultDialog_CommitMessageLabel=Message: +RebaseResultDialog_AbortButton=Abort +RebaseResultDialog_AbortRebaseRadioText=&Abort the Rebase +RebaseResultDialog_ActionGroupTitle=Action to perform +RebaseResultDialog_CommitIdLabel=&Id: +RebaseResultDialog_CommitMessageLabel=&Message: +RebaseResultDialog_ConflictListFailureMessage=Error getting the list of conflicts RebaseResultDialog_DetailsGroup=Commit details RebaseResultDialog_DialogTitle=Rebase Result RebaseResultDialog_DiffCalculationErrorDisplay=An Exception occured while calculating the Diff, please check the Error Log for details RebaseResultDialog_DiffCalculationErrorMessage=Could not calculate Diff of current commit -RebaseResultDialog_DiffDetailsLabel=Diff details: -RebaseResultDialog_StatusLabel=Result status: +RebaseResultDialog_DiffDetailsLabel=&Files with rebase conflicts: +RebaseResultDialog_DoNothingRadioText=Do nothing (return to the &workbench) +RebaseResultDialog_MergeButton=Merge +RebaseResultDialog_StartMergeRadioText=Start Merge &Tool to resolve conflicts +RebaseResultDialog_StatusLabel=Result status: {0} +RebaseResultDialog_ToggleShowButton=Don't show this confirmation dialog again RebaseTargetSelectionDialog_DialogMessage=Select a branch other than the currently checked out branch RebaseTargetSelectionDialog_DialogTitle=Rebase the currently checked out branch onto another branch RebaseTargetSelectionDialog_RebaseButton=&Rebase |