diff options
author | Benjamin Muskalla | 2011-07-07 23:13:44 +0000 |
---|---|---|
committer | Stefan Lay | 2011-07-13 14:12:55 +0000 |
commit | b556604880a8b10d1f7d14d0a95e030a23101a9e (patch) | |
tree | b23cc7b9465b5892a2a72370c6a801c0cedcec88 /org.eclipse.egit.ui/src/org/eclipse/egit/ui | |
parent | 335215b8441567cdbd3a70846c6b8c259e7aad29 (diff) | |
download | egit-b556604880a8b10d1f7d14d0a95e030a23101a9e.tar.gz egit-b556604880a8b10d1f7d14d0a95e030a23101a9e.tar.xz egit-b556604880a8b10d1f7d14d0a95e030a23101a9e.zip |
Replace dialog should have correct labels
Currently, the Replace with Dialog has the wrong labels (Compare...)
Change-Id: I2e6afb0a820e94d0ef749b3144d7b3d1a4792ccf
Signed-off-by: Benjamin Muskalla <benjamin.muskalla@tasktop.com>
Diffstat (limited to 'org.eclipse.egit.ui/src/org/eclipse/egit/ui')
4 files changed, 93 insertions, 5 deletions
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 4be6bb8be9..a0425d955d 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 @@ -667,6 +667,18 @@ public class UIText extends NLS { public static String RebaseTargetSelectionDialog_RebaseTitle; /** */ + public static String ReplaceTargetSelectionDialog_ReplaceButton; + + /** */ + public static String ReplaceTargetSelectionDialog_ReplaceMessage; + + /** */ + public static String ReplaceTargetSelectionDialog_ReplaceTitle; + + /** */ + public static String ReplaceTargetSelectionDialog_ReplaceWindowTitle; + + /** */ public static String RepositoryPropertySource_EditConfigButton; /** */ diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ReplaceWithRefActionHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ReplaceWithRefActionHandler.java index 086a9ab3b4..3776c6117d 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ReplaceWithRefActionHandler.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/ReplaceWithRefActionHandler.java @@ -7,6 +7,7 @@ * * Contributors: * Kevin Sawicki (GitHub Inc.) - initial API and implementation + * Benjamin Muskalla (Tasktop Technologies) *******************************************************************************/ package org.eclipse.egit.ui.internal.actions; @@ -14,8 +15,10 @@ import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.resources.IResource; import org.eclipse.egit.core.op.DiscardChangesOperation; -import org.eclipse.egit.ui.internal.dialogs.CompareTargetSelectionDialog; +import org.eclipse.egit.ui.internal.dialogs.ReplaceTargetSelectionDialog; import org.eclipse.jface.window.Window; +import org.eclipse.jgit.lib.Repository; +import org.eclipse.swt.widgets.Shell; /** * Replace with ref action handler @@ -26,10 +29,12 @@ public class ReplaceWithRefActionHandler extends DiscardChangesActionHandler { protected DiscardChangesOperation createOperation(ExecutionEvent event) throws ExecutionException { final IResource[] resources = getSelectedResources(event); - CompareTargetSelectionDialog dlg = new CompareTargetSelectionDialog( - getShell(event), getRepository(true, event), - resources.length == 1 ? resources[0].getFullPath().toString() - : null); + Shell shell = getShell(event); + Repository repository = getRepository(true, event); + final String pathString = resources.length == 1 ? resources[0].getFullPath() + .toString() : null; + ReplaceTargetSelectionDialog dlg = new ReplaceTargetSelectionDialog( + shell, repository, pathString); return dlg.open() == Window.OK ? new DiscardChangesOperation(resources, dlg.getRefName()) : null; } diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/ReplaceTargetSelectionDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/ReplaceTargetSelectionDialog.java new file mode 100644 index 0000000000..991793168c --- /dev/null +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/ReplaceTargetSelectionDialog.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2011 Tasktop Technologies. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Benjamin Muskalla (Tasktop Technologies) - initial implementation + *******************************************************************************/ +package org.eclipse.egit.ui.internal.dialogs; + +import org.eclipse.egit.ui.UIText; +import org.eclipse.jface.window.Window; +import org.eclipse.jgit.lib.Repository; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; + +/** + * Dialog for selecting a compare target. + * + */ +public class ReplaceTargetSelectionDialog extends AbstractBranchSelectionDialog { + private final String pathString; + + /** + * @param parentShell + * @param repo + * @param pathString + */ + public ReplaceTargetSelectionDialog(Shell parentShell, Repository repo, + String pathString) { + super(parentShell, repo, SHOW_LOCAL_BRANCHES | SHOW_REMOTE_BRANCHES + | SHOW_TAGS | SHOW_REFERENCES | EXPAND_LOCAL_BRANCHES_NODE + | SELECT_CURRENT_REF); + this.pathString = pathString; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + getButton(Window.OK).setText( + UIText.ReplaceTargetSelectionDialog_ReplaceButton); + } + + @Override + protected String getMessageText() { + return UIText.ReplaceTargetSelectionDialog_ReplaceMessage; + } + + @Override + protected String getTitle() { + return NLS.bind(UIText.ReplaceTargetSelectionDialog_ReplaceTitle, + pathString); + } + + @Override + protected String getWindowTitle() { + return UIText.ReplaceTargetSelectionDialog_ReplaceWindowTitle; + } + + @Override + protected void refNameSelected(String refName) { + getButton(Window.OK).setEnabled(refName != null); + } +} 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 753bc2b9d5..34785d38fa 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 @@ -269,6 +269,10 @@ RebaseTargetSelectionDialog_DialogMessage=Select a branch other than the current RebaseTargetSelectionDialog_DialogTitle=Rebase the currently checked out branch onto another branch RebaseTargetSelectionDialog_RebaseButton=&Rebase RebaseTargetSelectionDialog_RebaseTitle=Rebase: {0} +ReplaceTargetSelectionDialog_ReplaceButton=&Replace +ReplaceTargetSelectionDialog_ReplaceMessage=Select a branch, tag, or reference to replace the resource with +ReplaceTargetSelectionDialog_ReplaceTitle=Replace "{0}" with a Branch, Tag, or Reference" +ReplaceTargetSelectionDialog_ReplaceWindowTitle=Replace RepositoryAction_errorFindingRepo=Could not find a repository associated with this project RepositoryAction_errorFindingRepoTitle=Cannot Find Repository RepositoryAction_multiRepoSelection=Cannot perform reset on multiple repositories simultaneously.\n\nPlease select items from only one repository. |