Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-11-22 16:50:54 +0000
committerMichael Valenta2004-11-22 16:50:54 +0000
commit7666b96088ce01214957e58627d31978f6819622 (patch)
treef6bf95a25d8444cab804c15f830ae9bcfeb89cf4
parentd66a67845692b8e869bfffa599fd1048ce3591d5 (diff)
downloadeclipse.platform.team-7666b96088ce01214957e58627d31978f6819622.tar.gz
eclipse.platform.team-7666b96088ce01214957e58627d31978f6819622.tar.xz
eclipse.platform.team-7666b96088ce01214957e58627d31978f6819622.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties27
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java62
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java51
6 files changed, 106 insertions, 44 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
index c2873e163..795c1c833 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
@@ -24,8 +24,7 @@ public class MergeAction extends WorkspaceAction {
final Shell shell = getShell();
shell.getDisplay().syncExec(new Runnable() {
public void run() {
- MergeWizard wizard = new MergeWizard();
- wizard.setResources(getSelectedResources());
+ MergeWizard wizard = new MergeWizard(getTargetPart(), getSelectedResources());
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.open();
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index ae7b7b5b3..abcdd02ef 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -424,17 +424,23 @@ MergeAction.saveChanges=You have unsaved changes that will be saved before the a
MergeEditorInput.title=Merge {0} with {1}
-MergeWizardEndPage.branches=Branches
-MergeWizardEndPage.description=This is the version or branch that contains the work you would like to merge.
-MergeWizardEndPage.duplicateTagSelected=Cannot select {0} because it has already been selected as the start tag.
-
-MergeWizardStartPage.description=This is the version you created when you branched.
-
MergeWizard.title=Merge
-MergeWizard.start=Select the merge start point
-MergeWizard.end=Select where you want to merge the changes from
-MergeWizard.0=&Select start tag
-MergeWizard.1=&Select end tag
+MergeWizard.0=Select the merge points
+MergeWizard.1=Specify the branch or version to be merged and the common base version.
+MergeWizardPage.0=Preview the merge in the &synchronize view
+MergeWizardPage.1=Perform the merge into the local &workspace
+MergeWizardPage.2=&Branch or version to be merged (end tag):
+MergeWizardPage.3=Br&owse...
+MergeWizardPage.4=Choose End Tag
+MergeWizardPage.5=&Select end tag
+MergeWizardPage.6=Common base &version (start tag):
+MergeWizardPage.7=Bro&wse...
+MergeWizardPage.8=Choose Start Tag
+MergeWizardPage.9=&Select start tag
+MergeWizardPage.10=The specified end tag is not known to exist. Either enter a different tag or refresh the known tags.
+MergeWizardPage.11=The specified start tag is not known to exist. Either enter a different tag or refresh the known tags.
+MergeWizardPage.12=The start and end tags cannot be the same.
+MergeWizardPage.13=A start tag is required for previewing a merge in the synchronize view.
MergeWizard.preparing=Preparing merge wizard
MergeWizard.preparingStart=Fetching tags for start page
MergeWizard.preparingEnd=Fetching tags for end page
@@ -639,6 +645,7 @@ TagRefreshButtonArea.1=Perform Deep Search
TagRefreshButtonArea.2=Configure Manually
TagRefreshButtonArea.3=Cancel
TagRefreshButtonArea.4=Tags were not found for {0} using the auto-refresh files and a shallow cvs log operation. You can choose to search using a deep cvs log operation, to manually configure the tags or to cancel.
+TagRefreshButtonArea.5=Refreshing tags
TagAction.enterTag=Please enter a version tag:
TagAction.moveTag=&Move tag if it already exists
TagRootElement.0=Dates
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java
index 9b8ee483e..fe158424a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagContentAssistProcessor.java
@@ -30,7 +30,6 @@ import org.eclipse.ui.contentassist.ContentAssistHandler;
public class TagContentAssistProcessor implements ISubjectControlContentAssistProcessor {
private FilteredTagList tags;
- private String lastError;
private Map images = new HashMap();
public static void createContentAssistant(Text text, TagSource tagSource, int includeFlags) {
@@ -92,11 +91,9 @@ public class TagContentAssistProcessor implements ISubjectControlContentAssistPr
CompletionProposal proposal = new CompletionProposal(name, 0, docLength, name.length(), image, name, null, null);
proposals.add(proposal);
}
- lastError = null;
return (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[proposals.size()]);
}
}
- lastError = "No matching tags found";
return null;
}
@@ -140,7 +137,7 @@ public class TagContentAssistProcessor implements ISubjectControlContentAssistPr
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage()
*/
public String getErrorMessage() {
- return lastError;
+ return null;
}
/* (non-Javadoc)
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java
index 36a88572c..a4506ed9f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java
@@ -99,7 +99,7 @@ public class TagRefreshButtonArea extends DialogArea {
getRunnableContext().run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
- monitor.beginTask("Refreshing tags", 100);
+ monitor.beginTask(Policy.bind("TagRefreshButtonArea.5"), 100); //$NON-NLS-1$
CVSTag[] tags = tagSource.refresh(false, Policy.subMonitorFor(monitor, 70));
if (tags.length == 0 && promptForBestEffort()) {
tagSource.refresh(true, Policy.subMonitorFor(monitor, 30));
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java
index 845ec81b0..ebeb27d4b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizard.java
@@ -11,27 +11,41 @@
package org.eclipse.team.internal.ccvs.ui.wizards;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.core.client.Command;
+import org.eclipse.team.internal.ccvs.core.client.Update;
import org.eclipse.team.internal.ccvs.ui.*;
+import org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation;
import org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant;
import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.ui.IWorkbenchPart;
public class MergeWizard extends Wizard {
MergeWizardPage page;
IResource[] resources;
+ private final IWorkbenchPart part;
+
+ public MergeWizard(IWorkbenchPart part, IResource[] resources) {
+ this.part = part;
+ this.resources = resources;
+ }
public void addPages() {
setNeedsProgressMonitor(true);
TagSource tagSource = TagSource.create(resources);
setWindowTitle(Policy.bind("MergeWizard.title")); //$NON-NLS-1$
ImageDescriptor mergeImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_MERGE);
- page = new MergeWizardPage("mergePage", "Select the merge points", mergeImage, "Specify the branch or version to merge from and the common base.", tagSource);
+ page = new MergeWizardPage("mergePage", Policy.bind("MergeWizard.0"), mergeImage, Policy.bind("MergeWizard.1"), tagSource); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
addPage(page);
}
@@ -41,23 +55,41 @@ public class MergeWizard extends Wizard {
public boolean performFinish() {
CVSTag startTag = page.getStartTag();
- CVSTag endTag = page.getEndTag();
+ CVSTag endTag = page.getEndTag();
- // First check if there is an existing matching participant, if so then re-use it
- MergeSynchronizeParticipant participant = MergeSynchronizeParticipant.getMatchingParticipant(resources, startTag, endTag);
- if(participant == null) {
- CVSMergeSubscriber s = new CVSMergeSubscriber(resources, startTag, endTag);
- participant = new MergeSynchronizeParticipant(s);
- TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
+ if (startTag == null || !page.isPreview()) {
+ // Perform the update (merge) in the background
+ UpdateOperation op = new UpdateOperation(getPart(), resources, getLocalOptions(startTag, endTag), null);
+ try {
+ op.run();
+ } catch (InvocationTargetException e) {
+ CVSUIPlugin.openError(getShell(), null, null, e);
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+ } else {
+ // First check if there is an existing matching participant, if so then re-use it
+ MergeSynchronizeParticipant participant = MergeSynchronizeParticipant.getMatchingParticipant(resources, startTag, endTag);
+ if(participant == null) {
+ CVSMergeSubscriber s = new CVSMergeSubscriber(resources, startTag, endTag);
+ participant = new MergeSynchronizeParticipant(s);
+ TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
+ }
+ participant.refresh(resources, Policy.bind("Participant.merging"), Policy.bind("Participant.mergingDetail", participant.getName()), null); //$NON-NLS-1$ //$NON-NLS-2$
}
- participant.refresh(resources, Policy.bind("Participant.merging"), Policy.bind("Participant.mergingDetail", participant.getName()), null); //$NON-NLS-1$ //$NON-NLS-2$
return true;
}
- /*
- * Set the resources that should be merged.
- */
- public void setResources(IResource[] resources) {
- this.resources = resources;
- }
+ private Command.LocalOption[] getLocalOptions(CVSTag startTag, CVSTag endTag) {
+ List options = new ArrayList();
+ if (startTag != null) {
+ options.add(Command.makeArgumentOption(Update.JOIN, startTag.getName()));
+ }
+ options.add(Command.makeArgumentOption(Update.JOIN, endTag.getName()));
+ return (Command.LocalOption[]) options.toArray(new Command.LocalOption[options.size()]);
+ }
+
+ private IWorkbenchPart getPart() {
+ return part;
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java
index c8e808d91..045503d93 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/MergeWizardPage.java
@@ -18,6 +18,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.*;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
+import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.tags.*;
public class MergeWizardPage extends CVSWizardPage {
@@ -30,6 +31,9 @@ public class MergeWizardPage extends CVSWizardPage {
private TagRefreshButtonArea tagRefreshArea;
private CVSTag startTag;
private CVSTag endTag;
+ private Button previewButton;
+ private Button noPreviewButton;
+ protected boolean preview = true;
public MergeWizardPage(String pageName, String title, ImageDescriptor titleImage, String description, TagSource tagSource) {
super(pageName, title, titleImage, description);
@@ -45,12 +49,29 @@ public class MergeWizardPage extends CVSWizardPage {
Composite mainArea = createComposite(composite, 2, true);
createEndTagArea(mainArea);
createStartTagArea(mainArea);
+ createPreviewOptionArea(mainArea);
+
createTagRefreshArea(composite);
Dialog.applyDialogFont(composite);
setControl(composite);
}
+ private void createPreviewOptionArea(Composite mainArea) {
+ previewButton = createRadioButton(mainArea, Policy.bind("MergeWizardPage.0"), 2); //$NON-NLS-1$
+ noPreviewButton = createRadioButton(mainArea, Policy.bind("MergeWizardPage.1"), 2); //$NON-NLS-1$
+ SelectionAdapter selectionAdapter = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ preview = previewButton.getSelection();
+ updateEnablements();
+ }
+ };
+ previewButton.setSelection(preview);
+ noPreviewButton.setSelection(!preview);
+ previewButton.addSelectionListener(selectionAdapter);
+ noPreviewButton.addSelectionListener(selectionAdapter);
+ }
+
private void createTagRefreshArea(Composite parent) {
tagRefreshArea = new TagRefreshButtonArea(getShell(), getTagSource());
tagRefreshArea.setRunnableContext(getContainer());
@@ -58,7 +79,7 @@ public class MergeWizardPage extends CVSWizardPage {
}
private void createEndTagArea(Composite parent) {
- createWrappingLabel(parent, "Enter the &branch or version being merged (end tag):", 0, 2);
+ createWrappingLabel(parent, Policy.bind("MergeWizardPage.2"), 0, 2); //$NON-NLS-1$
endTagField = createTextField(parent);
endTagField.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
@@ -66,12 +87,12 @@ public class MergeWizardPage extends CVSWizardPage {
}
});
TagContentAssistProcessor.createContentAssistant(endTagField, tagSource, TagSelectionArea.INCLUDE_ALL_TAGS);
- endTagBrowseButton = createPushButton(parent, "Br&owse...");
+ endTagBrowseButton = createPushButton(parent, Policy.bind("MergeWizardPage.3")); //$NON-NLS-1$
endTagBrowseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TagSelectionDialog dialog = new TagSelectionDialog(getShell(), getTagSource(),
- "Choose End Tag",
- "&Select end tag",
+ Policy.bind("MergeWizardPage.4"), //$NON-NLS-1$
+ Policy.bind("MergeWizardPage.5"), //$NON-NLS-1$
TagSelectionDialog.INCLUDE_ALL_TAGS,
false, IHelpContextIds.MERGE_END_PAGE);
if (dialog.open() == Dialog.OK) {
@@ -83,7 +104,7 @@ public class MergeWizardPage extends CVSWizardPage {
}
private void createStartTagArea(Composite parent) {
- createWrappingLabel(parent, "Enter the &version that is the common base (start tag):", 0, 2);
+ createWrappingLabel(parent, Policy.bind("MergeWizardPage.6"), 0, 2); //$NON-NLS-1$
startTagField = createTextField(parent);
startTagField.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
@@ -91,12 +112,12 @@ public class MergeWizardPage extends CVSWizardPage {
}
});
TagContentAssistProcessor.createContentAssistant(startTagField, tagSource, TagSelectionArea.INCLUDE_VERSIONS | TagSelectionArea.INCLUDE_DATES);
- startTagBrowseButton = createPushButton(parent, "Bro&wse...");
+ startTagBrowseButton = createPushButton(parent, Policy.bind("MergeWizardPage.7")); //$NON-NLS-1$
startTagBrowseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TagSelectionDialog dialog = new TagSelectionDialog(getShell(), getTagSource(),
- "Choose Start Tag",
- "&Select start tag",
+ Policy.bind("MergeWizardPage.8"), //$NON-NLS-1$
+ Policy.bind("MergeWizardPage.9"), //$NON-NLS-1$
TagSelectionDialog.INCLUDE_VERSIONS,
false, IHelpContextIds.MERGE_START_PAGE);
if (dialog.open() == Dialog.OK) {
@@ -194,15 +215,17 @@ public class MergeWizardPage extends CVSWizardPage {
private void updateEnablements() {
if (endTag == null && endTagField.getText().length() > 0) {
- setErrorMessage("The specified end tag is not known to exist. Either enter a different tag or refresh the known tags.");
+ setErrorMessage(Policy.bind("MergeWizardPage.10")); //$NON-NLS-1$
} else if (startTag == null && startTagField.getText().length() > 0) {
- setErrorMessage("The specified start tag is not known to exist. Either enter a different tag or refresh the known tags.");
+ setErrorMessage(Policy.bind("MergeWizardPage.11")); //$NON-NLS-1$
} else if (endTag != null && startTag != null && startTag.equals(endTag)) {
- setErrorMessage("The start and end tags are the same.");
+ setErrorMessage(Policy.bind("MergeWizardPage.12")); //$NON-NLS-1$
+ } else if (startTag == null && endTag != null && preview) {
+ setErrorMessage(Policy.bind("MergeWizardPage.13")); //$NON-NLS-1$
} else {
setErrorMessage(null);
}
- setPageComplete(startTag != null && endTag!= null && !startTag.equals(endTag));
+ setPageComplete((startTag != null || !preview) && endTag != null && (startTag == null || !startTag.equals(endTag)));
}
protected TagSource getTagSource() {
@@ -223,4 +246,8 @@ public class MergeWizardPage extends CVSWizardPage {
public CVSTag getEndTag() {
return endTag;
}
+
+ public boolean isPreview() {
+ return preview;
+ }
}

Back to the top