Use Set instead of array to keep track of change listeners
[egit/torarne.git] / org.spearce.egit.core / src / org / spearce / egit / core / GitProvider.java
bloba16aca9523506d7302971aa907a6ca4b850682a2
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.team.IMoveDeleteHook;
12 import org.eclipse.core.runtime.CoreException;
13 import org.eclipse.team.core.RepositoryProvider;
14 import org.eclipse.team.core.history.IFileHistoryProvider;
15 import org.spearce.egit.core.internal.storage.GitFileHistoryProvider;
16 import org.spearce.egit.core.project.GitProjectData;
18 /**
19 * The Team provider class for a Git repository.
21 public class GitProvider extends RepositoryProvider {
22 private GitProjectData data;
24 private GitMoveDeleteHook hook;
26 private GitFileHistoryProvider historyProvider;
28 public String getID() {
29 return getClass().getName();
32 public void configureProject() throws CoreException {
33 getData().markTeamPrivateResources();
36 public void deconfigure() throws CoreException {
37 GitProjectData.delete(getProject());
40 public boolean canHandleLinkedResources() {
41 return true;
44 @Override
45 public boolean canHandleLinkedResourceURI() {
46 return true;
49 public synchronized IMoveDeleteHook getMoveDeleteHook() {
50 if (hook == null) {
51 hook = new GitMoveDeleteHook(getData());
53 return hook;
56 /**
57 * @return information about the mapping of an Eclipse project
58 * to a Git repository.
60 public synchronized GitProjectData getData() {
61 if (data == null) {
62 data = GitProjectData.get(getProject());
64 return data;
67 public synchronized IFileHistoryProvider getFileHistoryProvider() {
68 if (historyProvider == null) {
69 historyProvider = new GitFileHistoryProvider();
71 return historyProvider;