blob: bdaa4eb41c9c8792a729794663a0dd7d31feeae9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/*******************************************************************************
* Copyright (C) 2011-2012, Tomasz Zarna <Tomasz.Zarna@pl.ibm.com>
*
* 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
*******************************************************************************/
package org.eclipse.egit.ui.internal.actions;
import java.util.Arrays;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IResource;
import org.eclipse.egit.ui.internal.patch.PatchOperationUI;
import org.eclipse.jgit.lib.Repository;
/**
* The "Create Patch" action.
*/
public class CreatePatchActionHandler extends RepositoryActionHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
final Repository repository = getRepository(true, event);
// assert all resources map to the same repository
if (repository == null)
return null;
IResource[] resources = getSelectedResources();
PatchOperationUI.createPatch(getPart(event), getRepository(),
Arrays.asList(resources)).start();
return null;
}
@Override
public boolean isEnabled() {
return getRepository() != null;
}
}
|