Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2010-01-26 06:08:16 -0500
committerTomasz Zarna2010-01-26 06:08:16 -0500
commit88d90a307f0a6f22b954b72cdad11019a95dfd95 (patch)
tree55a64ff26970cb53c703ecd53fcafe57de097728
parentf36704fe0214bec4c7d8d8373b29dcfe09c0a1ac (diff)
downloadeclipse.platform.team-branch_20091215_bug236169.tar.gz
eclipse.platform.team-branch_20091215_bug236169.tar.xz
eclipse.platform.team-branch_20091215_bug236169.zip
bug 300787: [Sync View][Apply Patch] Remove merge actions from compare editor opened for "Patch Contents" modelbranch_20091215_bug236169
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelCompareEditorInput.java52
2 files changed, 59 insertions, 2 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
index 75e49af6c..411b1f0a9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 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
@@ -27,6 +27,8 @@ import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.mapping.ModelCompareEditorInput;
import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement;
+import org.eclipse.team.internal.ui.synchronize.patch.ApplyPatchModelCompareEditorInput;
+import org.eclipse.team.internal.ui.synchronize.patch.PatchModelProvider;
import org.eclipse.team.ui.mapping.ISynchronizationCompareInput;
import org.eclipse.team.ui.synchronize.*;
import org.eclipse.ui.*;
@@ -110,7 +112,10 @@ public class OpenInCompareAction extends Action {
ICompareInput input = msp.asCompareInput(object);
IWorkbenchPage workbenchPage = getWorkbenchPage(site);
if (input != null && workbenchPage != null && isOkToOpen(site, participant, input)) {
- return openCompareEditor(workbenchPage, new ModelCompareEditorInput(msp, input, workbenchPage, configuration), keepFocus, site, reuseEditorIfPossible);
+ if (configuration.getProperty(ModelSynchronizeParticipant.P_VISIBLE_MODEL_PROVIDER).equals(PatchModelProvider.ID))
+ return openCompareEditor(workbenchPage, new ApplyPatchModelCompareEditorInput(msp, input, workbenchPage, configuration), keepFocus, site, reuseEditorIfPossible);
+ else
+ return openCompareEditor(workbenchPage, new ModelCompareEditorInput(msp, input, workbenchPage, configuration), keepFocus, site, reuseEditorIfPossible);
}
}
return null;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelCompareEditorInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelCompareEditorInput.java
new file mode 100644
index 000000000..019741bb6
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelCompareEditorInput.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.synchronize.patch;
+
+import org.eclipse.compare.structuremergeviewer.ICompareInput;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.team.internal.ui.mapping.ModelCompareEditorInput;
+import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
+import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant;
+import org.eclipse.ui.IWorkbenchPage;
+
+public class ApplyPatchModelCompareEditorInput extends ModelCompareEditorInput {
+
+ public ApplyPatchModelCompareEditorInput(
+ ModelSynchronizeParticipant participant, ICompareInput input,
+ IWorkbenchPage page,
+ ISynchronizePageConfiguration synchronizeConfiguration) {
+ super(participant, input, page, synchronizeConfiguration);
+ }
+
+ protected void handleMenuAboutToShow(IMenuManager manager) {
+ // add nothing for now, but when bug 300221 is fixed add 'Merge' only
+ /*
+ StructuredSelection selection = new StructuredSelection(((IResourceProvider)getCompareInput()).getResource());
+
+ final ResourceMergeHandler mergeHandler = new ResourceMergeHandler(getSynchronizeConfiguration(), false);
+ mergeHandler.updateEnablement(selection);
+ Action mergeAction = new Action(TeamUIMessages.ModelCompareEditorInput_1) {
+ public void run() {
+ try {
+ mergeHandler.execute(new ExecutionEvent());
+ } catch (ExecutionException e) {
+ TeamUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
+ }
+ }
+ };
+ Utils.initAction(mergeAction, "action.merge."); //$NON-NLS-1$
+ mergeAction.setEnabled(mergeAction.isEnabled());
+
+ manager.insertAfter(IWorkbenchActionConstants.MB_ADDITIONS, new Separator("merge")); //$NON-NLS-1$
+ manager.insertAfter("merge", mergeAction); //$NON-NLS-1$
+ */
+ }
+}

Back to the top