KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ui > actions > ApplyPatchAction


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.team.internal.ui.actions;
12
13 import java.lang.reflect.InvocationTargetException JavaDoc;
14
15 import org.eclipse.compare.patch.ApplyPatchOperation;
16 import org.eclipse.core.resources.IResource;
17 import org.eclipse.jface.action.IAction;
18 import org.eclipse.swt.custom.BusyIndicator;
19 import org.eclipse.swt.widgets.Display;
20
21 public class ApplyPatchAction extends TeamAction {
22
23     public boolean isEnabled() {
24         return true;
25     }
26     
27     protected void execute(IAction action) throws InvocationTargetException JavaDoc,
28             InterruptedException JavaDoc {
29         IResource[] resources = getSelectedResources();
30         IResource resource = null;
31         if (resources.length > 0) {
32             resource = resources[0];
33         }
34         ApplyPatchOperation op = new ApplyPatchOperation(getTargetPart(), resource);
35         BusyIndicator.showWhile(Display.getDefault(), op);
36     }
37
38 }
39
Popular Tags