1 /*******************************************************************************
2 * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com>
3 * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * See LICENSE for the full license text, also available.
8 *******************************************************************************/
9 package org
.spearce
.egit
.core
;
11 import org
.eclipse
.core
.resources
.IResourceRuleFactory
;
12 import org
.eclipse
.core
.resources
.team
.IMoveDeleteHook
;
13 import org
.eclipse
.core
.resources
.team
.ResourceRuleFactory
;
14 import org
.eclipse
.core
.runtime
.CoreException
;
15 import org
.eclipse
.team
.core
.RepositoryProvider
;
16 import org
.eclipse
.team
.core
.history
.IFileHistoryProvider
;
17 import org
.spearce
.egit
.core
.internal
.storage
.GitFileHistoryProvider
;
18 import org
.spearce
.egit
.core
.project
.GitProjectData
;
21 * The Team provider class for a Git repository.
23 public class GitProvider
extends RepositoryProvider
{
24 private GitProjectData data
;
26 private GitMoveDeleteHook hook
;
28 private GitFileHistoryProvider historyProvider
;
30 private final IResourceRuleFactory resourceRuleFactory
= new GitResourceRuleFactory();
32 public String
getID() {
33 return getClass().getName();
36 public void configureProject() throws CoreException
{
37 getData().markTeamPrivateResources();
40 public void deconfigure() throws CoreException
{
41 GitProjectData
.delete(getProject());
44 public boolean canHandleLinkedResources() {
49 public boolean canHandleLinkedResourceURI() {
53 public synchronized IMoveDeleteHook
getMoveDeleteHook() {
55 GitProjectData _data
= getData();
57 hook
= new GitMoveDeleteHook(_data
);
63 * @return information about the mapping of an Eclipse project
64 * to a Git repository.
66 public synchronized GitProjectData
getData() {
68 data
= GitProjectData
.get(getProject());
73 public synchronized IFileHistoryProvider
getFileHistoryProvider() {
74 if (historyProvider
== null) {
75 historyProvider
= new GitFileHistoryProvider();
77 return historyProvider
;
81 public IResourceRuleFactory
getRuleFactory() {
82 return resourceRuleFactory
;
85 private static class GitResourceRuleFactory
extends ResourceRuleFactory
{
86 // Use the default rule factory instead of the
87 // pessimistic one by default.