Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Pogorzelski2010-03-09 17:39:32 +0000
committerPawel Pogorzelski2010-03-09 17:39:32 +0000
commit0c9910f45f0f470969d89f951742766b61592fb4 (patch)
treea154be6203dd4b9b705039aefd93098db3b45b82 /bundles/org.eclipse.team.ui/src/org/eclipse
parent44c8667bd768c49dd090e367c42173b3360a3d54 (diff)
downloadeclipse.platform.team-0c9910f45f0f470969d89f951742766b61592fb4.tar.gz
eclipse.platform.team-0c9910f45f0f470969d89f951742766b61592fb4.tar.xz
eclipse.platform.team-0c9910f45f0f470969d89f951742766b61592fb4.zip
Bug 300348 - [Sync View][Apply Patch] Add Patch Options when sync'ing with patch
Diffstat (limited to 'bundles/org.eclipse.team.ui/src/org/eclipse')
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java11
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/actions.properties18
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorAction.java52
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorDialog.java157
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/GererateRejFileAction.java42
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/IgnoreLeadingPathSegmentsAction.java80
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ReversePatchAction.java52
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties17
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelSynchronizeParticipant.java48
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriber.java18
10 files changed, 479 insertions, 16 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java
index d59b583b0..5a6e1bd01 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java
@@ -724,6 +724,17 @@ public class TeamUIMessages extends NLS {
public static String PatchInaccessibleProjectsPage_selectExisting;
public static String PatchInaccessibleProjectsPage_deselectAll;
public static String PatchInaccessibleProjectsPage_openingProjects;
+
+ public static String IgnoreLeadingPathSegmentsDialog_title;
+ public static String IgnoreLeadingPathSegmentsDialog_message;
+ public static String IgnoreLeadingPathSegmentsDialog_notANumber;
+ public static String IgnoreLeadingPathSegmentsDialog_numberOutOfRange;
+
+ public static String FuzzFactorDialog_title;
+ public static String FuzzFactorDialog_message;
+ public static String FuzzFactorDialog_guess;
+ public static String FuzzFactorDialog_notANumber;
+ public static String FuzzFactorDialog_numberOutOfRange;
public static String NotFound;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/actions.properties b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/actions.properties
index 87825a3d9..eca2da352 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/actions.properties
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/actions.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2007 IBM Corporation and others.
+# Copyright (c) 2000, 2010 IBM Corporation and others.
# 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
@@ -105,6 +105,22 @@ action.replaceAll.tooltip=Replace the local elements with the corresponding remo
action.replaceAll.description=Replace All
action.replaceAll.image=checkout_action.gif
+action.reversePatch.label=Re&verse Patch
+action.reversePatch.tooltip=Rollbacks the changes introduced by the patch
+action.reversePatch.description=Reverse Patch
+
+action.generateRejFile.label=Ge&nerate .rej File
+action.generateRejFile.tooltip=Generate .rej file
+action.generateRejFile.description=Generate .rej File
+
+action.fuzzFactor.label=&Fuzz Factor...
+action.fuzzFactor.tooltip=Fuzz factor
+action.fuzzFactor.description=Fuzz Factor
+
+action.ignoreLeadingPathSegments.label=Ign&ore Leading Path Segments...
+action.ignoreLeadingPathSegments.tooltip=Ignore leading path segments
+action.ignoreLeadingPathSegments.description=Ignore Leading Path Segments
+
action.markAsMerged.label=Mark &as Merged
action.merge.label=&Merge
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorAction.java
new file mode 100644
index 000000000..9907f181c
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorAction.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.mapping;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler;
+import org.eclipse.team.internal.ui.synchronize.patch.*;
+import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
+
+public class FuzzFactorAction extends Action {
+
+ private ISynchronizePageConfiguration configuration;
+ private ApplyPatchModelSynchronizeParticipant participant;
+ private ApplyPatchSubscriberMergeContext context;
+ private ApplyPatchSubscriber subscriber;
+
+ public FuzzFactorAction(ISynchronizePageConfiguration configuration) {
+ this.configuration = configuration;
+ participant = (ApplyPatchModelSynchronizeParticipant) configuration
+ .getParticipant();
+ context = (ApplyPatchSubscriberMergeContext) participant.getContext();
+ subscriber = (ApplyPatchSubscriber) context.getSubscriber();
+ }
+
+ public void run() {
+ FuzzFactorDialog dialog = new FuzzFactorDialog(Display.getCurrent()
+ .getActiveShell(), subscriber.getPatcher());
+ if (dialog.open() == Window.OK) {
+ int oldValue = subscriber.getPatcher().getFuzz();
+ int newValue = dialog.getFuzzFactor();
+ if (newValue != oldValue) {
+ SubscriberDiffTreeEventHandler handler = (SubscriberDiffTreeEventHandler) context
+ .getAdapter(SubscriberDiffTreeEventHandler.class);
+ handler.reset();
+ subscriber.getPatcher().setFuzz(newValue);
+ participant.refresh(configuration.getSite().getWorkbenchSite(),
+ context.getScope().getMappings());
+ }
+ }
+ }
+
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorDialog.java
new file mode 100644
index 000000000..47b66bfe8
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/FuzzFactorDialog.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.mapping;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.compare.internal.patch.WorkspacePatcher;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.resource.StringConverter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.team.internal.ui.TeamUIMessages;
+import org.eclipse.ui.PlatformUI;
+
+public class FuzzFactorDialog extends Dialog {
+
+ private Text valueText;
+ private Text errorMessageText;
+
+ private WorkspacePatcher patcher;
+ private int fuzzFactor;
+
+ public FuzzFactorDialog(Shell parentShell, WorkspacePatcher patcher) {
+ super(parentShell);
+ this.patcher = patcher;
+ }
+
+ public int getFuzzFactor() {
+ return fuzzFactor;
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ applyDialogFont(composite);
+
+ Label label = new Label(composite, SWT.WRAP);
+ label.setText(TeamUIMessages.FuzzFactorDialog_message);
+ GridData data = new GridData();
+ data.horizontalSpan = 2;
+ label.setLayoutData(data);
+ label.setFont(parent.getFont());
+
+ valueText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ data = new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.HORIZONTAL_ALIGN_FILL);
+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+ valueText.setLayoutData(data);
+ valueText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ validateInput();
+ }
+ });
+ fuzzFactor = patcher.getFuzz();
+ if (fuzzFactor >= 0)
+ valueText.setText(new Integer(fuzzFactor).toString());
+
+ Button guessButton = new Button(composite, SWT.NONE);
+ guessButton.setText(TeamUIMessages.FuzzFactorDialog_guess);
+ data = new GridData();
+ guessButton.setLayoutData(data);
+ guessButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ patcher.setFuzz(-1);
+ int fuzz = guessFuzzFactor();
+ if (fuzz >= 0) {
+ String value = new Integer(fuzz).toString();
+ valueText.setText(value);
+ }
+ }
+ });
+
+ errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
+ errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.HORIZONTAL_ALIGN_FILL));
+ errorMessageText.setBackground(errorMessageText.getDisplay()
+ .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+
+ validateInput();
+
+ applyDialogFont(composite);
+ return composite;
+ }
+
+ private void validateInput() {
+ String message = null;
+ String value = valueText.getText();
+ try {
+ fuzzFactor = Integer.parseInt(value);
+ if (fuzzFactor < 0)
+ message = TeamUIMessages.FuzzFactorDialog_numberOutOfRange;
+ } catch (NumberFormatException x) {
+ message = TeamUIMessages.FuzzFactorDialog_notANumber;
+ }
+ setErrorMessage(message);
+ }
+
+ private void setErrorMessage(String errorMessage) {
+ if (errorMessageText != null && !errorMessageText.isDisposed()) {
+ errorMessageText.setText(errorMessage == null ? " \n " //$NON-NLS-1$
+ : errorMessage);
+ boolean hasError = errorMessage != null
+ && (StringConverter.removeWhiteSpaces(errorMessage))
+ .length() > 0;
+ errorMessageText.setEnabled(hasError);
+ errorMessageText.setVisible(hasError);
+ errorMessageText.getParent().update();
+ Control button = getButton(IDialogConstants.OK_ID);
+ if (button != null) {
+ button.setEnabled(errorMessage == null);
+ }
+ }
+ }
+
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(TeamUIMessages.FuzzFactorDialog_title);
+ }
+
+ private int guessFuzzFactor() {
+ final int[] result = new int[] { -1 };
+ try {
+ PlatformUI.getWorkbench().getProgressService().run(true, true,
+ new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ result[0] = patcher.guessFuzzFactor(monitor);
+ }
+ });
+ } catch (InvocationTargetException ex) {
+ // NeedWork
+ } catch (InterruptedException ex) {
+ // NeedWork
+ }
+ return result[0];
+ }
+
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/GererateRejFileAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/GererateRejFileAction.java
new file mode 100644
index 000000000..23dc6bca8
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/GererateRejFileAction.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.mapping;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.team.internal.ui.synchronize.patch.*;
+import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
+
+public class GererateRejFileAction extends Action {
+
+ private ApplyPatchSubscriber subscriber;
+
+ public GererateRejFileAction(ISynchronizePageConfiguration configuration) {
+ super("", AS_CHECK_BOX); //$NON-NLS-1$
+ ApplyPatchModelSynchronizeParticipant participant = (ApplyPatchModelSynchronizeParticipant) configuration
+ .getParticipant();
+ ApplyPatchSubscriberMergeContext context = (ApplyPatchSubscriberMergeContext) participant
+ .getContext();
+ subscriber = (ApplyPatchSubscriber) context.getSubscriber();
+ }
+
+ public boolean isChecked() {
+ return subscriber.getPatcher().isGenerateRejectFile();
+ }
+
+ public void run() {
+ boolean oldValue = subscriber.getPatcher().isGenerateRejectFile();
+ subscriber.getPatcher().setGenerateRejectFile(!oldValue);
+
+ firePropertyChange(CHECKED, new Boolean(oldValue), new Boolean(
+ !oldValue));
+ }
+
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/IgnoreLeadingPathSegmentsAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/IgnoreLeadingPathSegmentsAction.java
new file mode 100644
index 000000000..9cebc11b7
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/IgnoreLeadingPathSegmentsAction.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.mapping;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler;
+import org.eclipse.team.internal.ui.TeamUIMessages;
+import org.eclipse.team.internal.ui.synchronize.patch.*;
+import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
+
+public class IgnoreLeadingPathSegmentsAction extends Action {
+
+ private ISynchronizePageConfiguration configuration;
+ private ApplyPatchModelSynchronizeParticipant participant;
+ private ApplyPatchSubscriberMergeContext context;
+ private ApplyPatchSubscriber subscriber;
+ private int maxValue;
+
+ public IgnoreLeadingPathSegmentsAction(
+ ISynchronizePageConfiguration configuration) {
+ this.configuration = configuration;
+ participant = (ApplyPatchModelSynchronizeParticipant) configuration
+ .getParticipant();
+ context = (ApplyPatchSubscriberMergeContext) participant.getContext();
+ subscriber = (ApplyPatchSubscriber) context.getSubscriber();
+ }
+
+ public boolean isEnabled() {
+ return !subscriber.getPatcher().isWorkspacePatch();
+ }
+
+ public void run() {
+ int oldValue = subscriber.getPatcher().getStripPrefixSegments();
+ maxValue = subscriber.getPatcher().calculatePrefixSegmentCount() - 1;
+
+ InputDialog dlg = new InputDialog(
+ Display.getCurrent().getActiveShell(),
+ TeamUIMessages.IgnoreLeadingPathSegmentsDialog_title, NLS.bind(
+ TeamUIMessages.IgnoreLeadingPathSegmentsDialog_message,
+ new Integer(maxValue)), new Integer(oldValue)
+ .toString(), new IInputValidator() {
+ public String isValid(String input) {
+ try {
+ int i = Integer.parseInt(input);
+ if (i < 0 || i > maxValue)
+ return TeamUIMessages.IgnoreLeadingPathSegmentsDialog_numberOutOfRange;
+ } catch (NumberFormatException x) {
+ return TeamUIMessages.IgnoreLeadingPathSegmentsDialog_notANumber;
+ }
+ return null;
+ }
+ });
+
+ if (dlg.open() == Window.OK) {
+ String input = dlg.getValue();
+ int newValue = Integer.parseInt(input);
+ if (newValue != oldValue) {
+ SubscriberDiffTreeEventHandler handler = (SubscriberDiffTreeEventHandler) context
+ .getAdapter(SubscriberDiffTreeEventHandler.class);
+ handler.reset();
+ subscriber.getPatcher().setStripPrefixSegments(newValue);
+ participant.refresh(configuration.getSite().getWorkbenchSite(),
+ context.getScope().getMappings());
+ }
+ }
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ReversePatchAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ReversePatchAction.java
new file mode 100644
index 000000000..27ddc8547
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/mapping/ReversePatchAction.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ui.mapping;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler;
+import org.eclipse.team.internal.ui.synchronize.patch.*;
+import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
+
+public class ReversePatchAction extends Action {
+
+ private ISynchronizePageConfiguration configuration;
+ private ApplyPatchModelSynchronizeParticipant participant;
+ private ApplyPatchSubscriberMergeContext context;
+ private ApplyPatchSubscriber subscriber;
+
+ public ReversePatchAction(ISynchronizePageConfiguration configuration) {
+ super("", AS_CHECK_BOX); //$NON-NLS-1$
+ this.configuration = configuration;
+ participant = (ApplyPatchModelSynchronizeParticipant) configuration
+ .getParticipant();
+ context = (ApplyPatchSubscriberMergeContext) participant.getContext();
+ subscriber = (ApplyPatchSubscriber) context.getSubscriber();
+ }
+
+ public boolean isChecked() {
+ return subscriber.getPatcher().isReversed();
+ }
+
+ public void run() {
+ boolean oldValue = subscriber.getPatcher().isReversed();
+ subscriber.getPatcher().setReversed(!oldValue);
+
+ SubscriberDiffTreeEventHandler handler = (SubscriberDiffTreeEventHandler) context
+ .getAdapter(SubscriberDiffTreeEventHandler.class);
+ handler.reset();
+ participant.refresh(configuration.getSite().getWorkbenchSite(), context
+ .getScope().getMappings());
+
+ firePropertyChange(CHECKED, new Boolean(oldValue), new Boolean(
+ !oldValue));
+ }
+
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
index 0f2d6a729..48d75e71b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
@@ -584,4 +584,19 @@ PatchInaccessibleProjectsPage_message=Select projects to open for applying the p
PatchInaccessibleProjectsPage_projectDoesNotExistInWorkspace={0} (Project does not exist in workspace)
PatchInaccessibleProjectsPage_selectExisting=Select Existing
PatchInaccessibleProjectsPage_deselectAll=Deselect All
-PatchInaccessibleProjectsPage_openingProjects=Opening projects \ No newline at end of file
+PatchInaccessibleProjectsPage_openingProjects=Opening projects
+#
+# IgnoreLeadingPathSegmentsDialog
+#
+IgnoreLeadingPathSegmentsDialog_title=Ignore Leading Path Segments
+IgnoreLeadingPathSegmentsDialog_message=Enter path segments to ignore (0..{0})
+IgnoreLeadingPathSegmentsDialog_notANumber=Not a number
+IgnoreLeadingPathSegmentsDialog_numberOutOfRange=Number out of range
+#
+# FuzzFactorDialog
+#
+FuzzFactorDialog_title=Fuzz Factor
+FuzzFactorDialog_message=Enter Fuzz Factor
+FuzzFactorDialog_guess=Guess
+FuzzFactorDialog_notANumber=Not a number
+FuzzFactorDialog_numberOutOfRange=Number out of range \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelSynchronizeParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelSynchronizeParticipant.java
index 90db2ab7b..52366cfe4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelSynchronizeParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelSynchronizeParticipant.java
@@ -13,15 +13,15 @@ package org.eclipse.team.internal.ui.synchronize.patch;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.resources.mapping.ModelProvider;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.*;
import org.eclipse.team.core.mapping.provider.SynchronizationContext;
import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.mapping.ModelSynchronizePage;
+import org.eclipse.team.internal.ui.mapping.*;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.mapping.ISynchronizationCompareAdapter;
import org.eclipse.team.ui.mapping.SynchronizationActionProvider;
import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.ui.IActionBars;
public class ApplyPatchModelSynchronizeParticipant extends
ModelSynchronizeParticipant {
@@ -69,7 +69,42 @@ public class ApplyPatchModelSynchronizeParticipant extends
}
super.addToContextMenu(mergeActionId, action, manager);
}
- }
+
+ public void fillActionBars(IActionBars actionBars) {
+ if (actionBars != null) {
+ IMenuManager menu = actionBars.getMenuManager();
+ ReversePatchAction reversePatchAction = new ReversePatchAction(
+ getConfiguration());
+ appendToGroup(menu,
+ ISynchronizePageConfiguration.PREFERENCES_GROUP,
+ reversePatchAction);
+ Utils.initAction(reversePatchAction, "action.reversePatch."); //$NON-NLS-1$
+ FuzzFactorAction fuzzFactor = new FuzzFactorAction(
+ getConfiguration());
+ appendToGroup(menu,
+ ISynchronizePageConfiguration.PREFERENCES_GROUP,
+ fuzzFactor);
+ Utils.initAction(fuzzFactor, "action.fuzzFactor."); //$NON-NLS-1$
+ IgnoreLeadingPathSegmentsAction ignoreAction = new IgnoreLeadingPathSegmentsAction(
+ getConfiguration());
+// appendToGroup(menu,
+// ISynchronizePageConfiguration.PREFERENCES_GROUP,
+// ignoreAction);
+ Utils.initAction(ignoreAction,
+ "action.ignoreLeadingPathSegments."); //$NON-NLS-1$
+ GererateRejFileAction generateAction = new GererateRejFileAction(
+ getConfiguration());
+ appendToGroup(menu,
+ ISynchronizePageConfiguration.PREFERENCES_GROUP,
+ generateAction);
+ Utils.initAction(generateAction, "action.generateRejFile."); //$NON-NLS-1$
+ appendToGroup(menu,
+ ISynchronizePageConfiguration.PREFERENCES_GROUP,
+ new Separator());
+ }
+ super.fillActionBars(actionBars);
+ }
+ };
public ModelProvider[] getEnabledModelProviders() {
ModelProvider[] enabledProviders = super.getEnabledModelProviders();
@@ -89,10 +124,11 @@ public class ApplyPatchModelSynchronizeParticipant extends
extended[extended.length - 1] = provider;
return extended;
}
-
+
public ICompareInput asCompareInput(Object object) {
// consult adapter first
- ISynchronizationCompareAdapter adapter = Utils.getCompareAdapter(object);
+ ISynchronizationCompareAdapter adapter = Utils
+ .getCompareAdapter(object);
if (adapter != null)
return adapter.asCompareInput(getContext(), object);
if (object instanceof ICompareInput) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriber.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriber.java
index eeaa7a5a6..54efeb575 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriber.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriber.java
@@ -50,12 +50,12 @@ public class ApplyPatchSubscriber extends Subscriber {
return IN_SYNC;
}
}
-
+ int kind = super.calculateKind();
// mark diffs with problems as conflicts
if (getRemote() != null
&& getPatcher().getDiffResult(((PatchedFileVariant)getRemote()).getDiff()).containsProblems())
- return CONFLICTING;
- return super.calculateKind();
+ kind |= CONFLICTING;
+ return kind;
}
}
@@ -83,11 +83,13 @@ public class ApplyPatchSubscriber extends Subscriber {
try {
FilePatch2 diff = (FilePatch2) PatchModelProvider.getPatchObject(resource, getPatcher());
// use null as remote variant for deletions
- IResourceVariant variant = null;
+ IResourceVariant remote = null;
if (diff.getDiffType(patcher.isReversed()) != FilePatch2.DELETION)
- variant = new PatchedFileVariant(getPatcher(), diff);
- IResourceVariant base = resource.exists() ? new LocalResourceVariant(resource) : null;
- SyncInfo info = new ApplyPatchSyncInfo(resource, base, variant, getResourceComparator());
+ remote = new PatchedFileVariant(getPatcher(), diff);
+ IResourceVariant base = null;
+ if (diff.getDiffType(patcher.isReversed()) != FilePatch2.ADDITION)
+ base = new LocalResourceVariant(resource);
+ SyncInfo info = new ApplyPatchSyncInfo(resource, base, remote, getResourceComparator());
info.init();
return info;
} catch (CoreException e) {
@@ -162,7 +164,7 @@ public class ApplyPatchSubscriber extends Subscriber {
return (IResource[]) roots.toArray(new IResource[0]);
}
- WorkspacePatcher getPatcher() {
+ public WorkspacePatcher getPatcher() {
return patcher;
}

Back to the top