diff options
author | Michael Valenta | 2006-10-26 13:38:39 +0000 |
---|---|---|
committer | Michael Valenta | 2006-10-26 13:38:39 +0000 |
commit | 11a5ccdf45223eae40f83dbbb9cbec56faeba4a5 (patch) | |
tree | cef245074b4ee0421c3166524860a8324d779747 | |
parent | c2c49ae019e9b53f5878ef02e6d6227f6c169240 (diff) | |
download | eclipse.platform.team-11a5ccdf45223eae40f83dbbb9cbec56faeba4a5.tar.gz eclipse.platform.team-11a5ccdf45223eae40f83dbbb9cbec56faeba4a5.tar.xz eclipse.platform.team-11a5ccdf45223eae40f83dbbb9cbec56faeba4a5.zip |
Bug 101252 [Actions] Key binding for Apply patch is missing
7 files changed, 83 insertions, 2 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java index a4fd8f29f..dbccf84dc 100644 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java +++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java @@ -36,7 +36,7 @@ public class CompareWithPatchAction extends BaseCompareAction implements IObject protected void run(ISelection selection) { IResource firstResource = Utilities.getFirstResource(selection); - final ApplyPatchOperation patchOp = new ApplyPatchOperation( targetPart, null ,firstResource, null, null); + final ApplyPatchOperation patchOp = new ApplyPatchOperation( targetPart, firstResource); targetPart.getSite().getShell().getDisplay().asyncExec(new Runnable(){ public void run() { diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java index 1da6cf45f..972cc1428 100644 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java +++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java @@ -97,6 +97,19 @@ public class ApplyPatchOperation implements Runnable { } /** + * Create an operation for the given part and resource. This method is a convenience + * method that calls {@link #ApplyPatchOperation(IWorkbenchPart, IStorage, IResource, CompareConfiguration, CompareConfiguration)} + * with null for the other parameters. + * @param targetPart an IResource which the patch is to be applied to or <code>null</code> + * @param resource an IResource which the patch is to be applied to or <code>null</code> + * @see #ApplyPatchOperation(IWorkbenchPart, IStorage, IResource, CompareConfiguration, CompareConfiguration) + */ + public ApplyPatchOperation(IWorkbenchPart targetPart, IResource resource) { + this(targetPart, null, resource, null, null); + } + + /** + * Open the Apply Patch wizard using the values associated with this operation. * This method must be called from the UI thread. */ public void openWizard() { diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java index a4fd8f29f..dbccf84dc 100644 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java +++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/CompareWithPatchAction.java @@ -36,7 +36,7 @@ public class CompareWithPatchAction extends BaseCompareAction implements IObject protected void run(ISelection selection) { IResource firstResource = Utilities.getFirstResource(selection); - final ApplyPatchOperation patchOp = new ApplyPatchOperation( targetPart, null ,firstResource, null, null); + final ApplyPatchOperation patchOp = new ApplyPatchOperation( targetPart, firstResource); targetPart.getSite().getShell().getDisplay().asyncExec(new Runnable(){ public void run() { diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java index 1da6cf45f..972cc1428 100644 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java +++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java @@ -97,6 +97,19 @@ public class ApplyPatchOperation implements Runnable { } /** + * Create an operation for the given part and resource. This method is a convenience + * method that calls {@link #ApplyPatchOperation(IWorkbenchPart, IStorage, IResource, CompareConfiguration, CompareConfiguration)} + * with null for the other parameters. + * @param targetPart an IResource which the patch is to be applied to or <code>null</code> + * @param resource an IResource which the patch is to be applied to or <code>null</code> + * @see #ApplyPatchOperation(IWorkbenchPart, IStorage, IResource, CompareConfiguration, CompareConfiguration) + */ + public ApplyPatchOperation(IWorkbenchPart targetPart, IResource resource) { + this(targetPart, null, resource, null, null); + } + + /** + * Open the Apply Patch wizard using the values associated with this operation. * This method must be called from the UI thread. */ public void openWizard() { diff --git a/bundles/org.eclipse.team.ui/plugin.properties b/bundles/org.eclipse.team.ui/plugin.properties index 5edff3e26..5c041d3ba 100644 --- a/bundles/org.eclipse.team.ui/plugin.properties +++ b/bundles/org.eclipse.team.ui/plugin.properties @@ -26,6 +26,11 @@ IgnorePreferencePage.name=Ignored Resources ConfigureProject.label=&Share Project... ConfigureProject.tooltip=Share the project with others using a version and configuration management system. +ApplyPatch.label=Appl&y Patch... +ApplyPatch.tootip=Apply a patch to one or more workspace projects. +Command.applyPatch.name=Apply Patch... +Command.applyPatch.description=Apply a patch to one or more workspace projects. + ImportProjectSet.label=Import Project &Set... TeamGroupMenu.label=T&eam diff --git a/bundles/org.eclipse.team.ui/plugin.xml b/bundles/org.eclipse.team.ui/plugin.xml index 52dd07626..866daccd7 100644 --- a/bundles/org.eclipse.team.ui/plugin.xml +++ b/bundles/org.eclipse.team.ui/plugin.xml @@ -284,6 +284,12 @@ id="org.eclipse.team.ui.synchronizeLast"> </command> <command + name="%Command.applyPatch.name" + categoryId="org.eclipse.team.ui.category.team" + description="%Command.applyPatch.description" + id="org.eclipse.team.ui.applyPatch"> + </command> + <command name="%Synchronizing.perspective" description="%Synchronizing.openPerspectiveDescription" categoryId="org.eclipse.ui.category.perspectives" @@ -338,6 +344,14 @@ class="org.eclipse.team.internal.ui.actions.ConfigureProjectAction" menubarPath="project/open.ext" id="org.eclipse.team.ui.ConfigureProject"/> + <action + allowLabelUpdate="true" + class="org.eclipse.team.internal.ui.actions.ApplyPatchAction" + definitionId="org.eclipse.team.ui.applyPatch" + id="org.eclipse.team.ui.ApplyPatchAction" + label="%ApplyPatch.label" + menubarPath="project/additions" + tooltip="%ApplyPatch.tooltip"/> </actionSet> </extension> diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ApplyPatchAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ApplyPatchAction.java new file mode 100644 index 000000000..7d55e0519 --- /dev/null +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ApplyPatchAction.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2006 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.actions; + +import org.eclipse.compare.patch.ApplyPatchOperation; +import org.eclipse.core.resources.IResource; +import org.eclipse.jface.action.IAction; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.widgets.Display; +import org.eclipse.team.core.TeamException; + +public class ApplyPatchAction extends TeamAction { + + protected boolean isEnabled() throws TeamException { + return true; + } + + public void run(IAction action) { + IResource[] resources = getSelectedResources(); + IResource resource = null; + if (resources.length > 0) { + resource = resources[0]; + } + ApplyPatchOperation op = new ApplyPatchOperation(getTargetPart(), resource); + BusyIndicator.showWhile(Display.getDefault(), op); + } + +} |