Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2002-03-14 22:34:19 +0000
committerJean Michel-Lemieux2002-03-14 22:34:19 +0000
commitb015f7e5d19d76e88b0eb54aca9686108b591579 (patch)
tree9a2f6018c674cd7d0fe6186e47cfc4fd8a96ebaf
parent54f2a35c4512aeafaa6fd97eb820bbdb394c0e38 (diff)
downloadeclipse.platform.team-b015f7e5d19d76e88b0eb54aca9686108b591579.tar.gz
eclipse.platform.team-b015f7e5d19d76e88b0eb54aca9686108b591579.tar.xz
eclipse.platform.team-b015f7e5d19d76e88b0eb54aca9686108b591579.zip
Integrating new team.core API
-rw-r--r--bundles/org.eclipse.team.core/plugin.xml2
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamManager.java147
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamNature.java60
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamProviderTests.java25
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java143
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java149
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/StandardOperations.java (renamed from bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamProvider.java)97
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamPlugin.java292
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/FileModificationValidator.java43
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/FileTypeRegistry.java17
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/IgnoreInfo.java24
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/Policy.java4
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/TeamManager.java388
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/messages.properties10
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/Assert.java (renamed from bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/Assert.java)12
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteSyncElement.java23
-rw-r--r--bundles/org.eclipse.team.cvs.core/plugin.xml6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/ccvs/core/CVSRepositoryProviderType.java31
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProvider.java25
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java56
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java40
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IResourceStateChangeListener.java (renamed from bundles/org.eclipse.team.core/src/org/eclipse/team/core/IResourceStateChangeListener.java)2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionManager.java12
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionWriter.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceDeltaSyncHandler.java11
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceDeltaVisitor.java13
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java11
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorationRunnable.java16
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java19
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryDropAdapter.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java11
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagSelectionDialog.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java11
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RemoveRootAction.java10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java11
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java11
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardEndPage.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/UpdateSyncAction.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileOperation.java10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SetKeywordSubstitutionOperation.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IgnorePreferencePage.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/CheckInAction.java18
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/CheckOutAction.java19
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/ConfigureProjectAction.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/DeconfigureProjectAction.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/DeleteAction.java19
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/GetAction.java19
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/TeamAction.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/UndoCheckOutAction.java21
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/Print Averaged Log Summary.launch10
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/Print Log Differences.launch10
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/Print Raw Log Summary.launch10
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java16
74 files changed, 936 insertions, 1111 deletions
diff --git a/bundles/org.eclipse.team.core/plugin.xml b/bundles/org.eclipse.team.core/plugin.xml
index 575e5f67a..c8145a623 100644
--- a/bundles/org.eclipse.team.core/plugin.xml
+++ b/bundles/org.eclipse.team.core/plugin.xml
@@ -17,7 +17,7 @@
</library>
</runtime>
-<extension-point id="providers" name="Providers"/>
+<extension-point id="repository-provider-type" name="Repository Provider Types"/>
<extension-point id="fileTypes" name="File Types Registry"/>
<extension-point id="ignore" name="Global Ignore Registry"/>
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamManager.java
deleted file mode 100644
index a5ad02ba8..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamManager.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package org.eclipse.team.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.Properties;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.QualifiedName;
-
-/**
- * The <code>ITeamManager</code> is the basis for team provider management
- * in the platform. There is only one team manager per running platform. All
- * registered providers exist in the context of this manager. The manager provides
- * the following services to clients:
- * <p>
- * <ul>
- * <li>find the <code>ITeamProvider</code> associated with
- * a project.</li>
- *
- * <li>associate one provider nature at a time to a project.</li>
- *
- * <li>remove a project from being associated with a provider's nature.</li>
- *
- * @see ITeamProvider
- */
-public interface ITeamManager {
-
- /**
- * Called to associate a project with a given provider. The Team plug-in will remember
- * the association between workbench sessions.
- * <p>
- * This method allows headless application (e.g. tests, scripts) to create specific providers
- * programatically. Refer to the provider's documentation for the properties that are required
- * for initializing a provider programatically.</p>
- * <p>
- * Example usage:
- * <pre>
- * Properties properties = new Properties();
- * properties.set("location", "http://www.share.com/~team");
- * properties.set("httpUser", "team");
- * properties.set("httpPass", "teampass");
- * ...
- * plugin.setProvider(project, "org.eclipse.team.providers.someteam_nature", properties, monitor);
- * </pre></p>
- * <p>
- * Warning: A client using this method is hard coding provider specific details into
- * their implementations.</p>
- *
- * @param project to associate with a specific provider type identified by the natureId.
- * @param natureId that identifies the provider to associate with the project.
- * @param configuration required to initialize the provider. The contents of the configuration
- * is provider specific. Can be <code>null</code> if the provider is configured using another
- * mechanism.
- *
- * @exception TeamException if the project cannot be associated with the provider.
- * Possible reasons are:
- * <ul>
- * <li>provider is already associated with a provider. A client must call
- * <code>removeProvider</code> before associating a project with
- * another provider.</li>
- * <li>provider could not be configured.</li>
- * </ul></p>
- */
- public void setProvider(IProject project, String natureId, Properties configuration, IProgressMonitor progress) throws TeamException;
-
- /**
- * Answers the provider associated with this resource's project. Returns <code>null</code>
- * if the project is not associated with a provider.
- *
- * @param resource for which to return its associated provider
- *
- * @return the team provider instance associated with the resource's project, or <code>null</code>
- * if the resource's project is not associated with a provider.
- */
- public ITeamProvider getProvider(IResource resource);
-
- /**
- * Un-associate this project with its provider. If the project is not associated with
- * a provider this method has no effect.
- *
- * @param project to remote the associate to its provider.
- *
- * @exception TeamException if the provider cannot be removed from the project. Possible
- * reasons are:
- * <ul>
- * <li>error removing the nature id</li>
- * </ul>
- */
- public void removeProvider(IProject project, IProgressMonitor progress) throws TeamException;
-
- /**
- * Adds the given listener for provider state change events to this workspace.
- * Has no effect if an identical listener is already registered for these events.
- * <p>
- * Once registered, a listener starts receiving notification of changes to resources states
- * (e.g. checked in/checked out...) in the workspace the listener continues to receive
- * notifications until it is replaced or removed.</p>
- * <p>
- *
- * @param listener the listener
- * @see IResourceStateChangeListener
- * @see #removeResourceStateChangeListener
- */
- public void addResourceStateChangeListener(IResourceStateChangeListener listener);
-
- /**
- * Removes the given resource state change listener from this manager.
- * Has no effect if an identical listener is not registered.
- *
- * @param listener the listener
- * @see IResourceStateChangeListener
- * @see #addResourceStateChangeListener
- */
- public void removeResourceStateChangeListener(IResourceStateChangeListener listener);
-
- /**
- * Notify listeners about state changes to the given resources.
- *
- * [Note: The changed state event is purposely vague. For now it is only
- * a hint to listeners that they should query the provider to determine the
- * resources new team state.]
- *
- * @param resources that have changed state.
- */
- public void broadcastResourceStateChanges(IResource[] resources);
-
- /**
- * Returns the list of global ignore patterns.
- *
- * @return ignore patterns
- */
- public IIgnoreInfo[] getGlobalIgnore();
-
- /**
- * Sets the list of ignore patterns. These are persisted between workspace sessions.
- *
- * @param patterns an array of file name patterns (e.g. *.exe)
- * @param enabled an array of pattern enablements
- */
- public void setGlobalIgnore(String[] patterns, boolean[] enabled);
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamNature.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamNature.java
deleted file mode 100644
index c0e1ed58e..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamNature.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.team.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.Properties;
-
-import org.eclipse.core.resources.IProjectNature;
-
-/**
- * An interface that provides a team centric nature for providers. Each
- * provider must have a class that implements this interface and provide
- * an nature's extension point with this class as the <code>run</code>
- * parameter.
- * <p>
- * A runtime instance of this class will be created for each project that
- * is associated with a provider. The implementing class must take
- * advantage of the lifecycle of natures and conform to the operation
- * specification in <code>IProjectNature</code> interface.</p>
- * <p>
- * When a project nature is re-created at runtime (e.g. the workbench
- * was shutdown and re-started) the <code>setProject()</code>
- * method will be called and the team nature must re-configure itself
- * by reading any saved meta information.</p>
- *
- * @see IProjectNature
- * @see ITeamManager
- * @see ITeamProvider
- */
-public interface ITeamNature extends IProjectNature {
-
- /**
- * Returns a team provider for the given project.
- * <p>
- * The returned provider can be used immediately to perform team
- * operations.
- * </p>
- *
- * @return the <code>ITeamProvider</code> to which this project
- * nature applies.
- *
- * @throws TeamException if the provider cannot be found.
- */
- public ITeamProvider getProvider() throws TeamException;
-
- /**
- * Configures this project nature given some provider specific configuration
- * information specified as properties.
- *
- * @param configuration the properties used to configure the project.
- *
- * @throws TeamException if the provider configuraton fails. Also, if the provider
- * does not support creating providers programmatically it should throw an exception.
- *
- * @see ITeamManager#setProvider(IProject, String, Properties, IProgressMonitor)
- */
- public void configureProvider(Properties configuration) throws TeamException;
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamProviderTests.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamProviderTests.java
deleted file mode 100644
index 5f4a7898a..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamProviderTests.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.team.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Team plugins can optionally implement this interface to allow running of their providers
- * against the generic provider test framework.
- */
-public interface ITeamProviderTests {
- /**
- * Allows the test framework to inform the provider to run all further operations
- * in a unique remote folder. This will provide individual tests with isolated sandboxes.
- * In addition, using isolated sandboxes for tests allows browsing of the test results
- * and is valuable for debugging failing tests. Without this support, the test framework
- * will have to clear the remote location before each test, purging previous test
- * results.
- *
- * @param name of the remote folder in which to perform provider operations.
- */
- public void setTestLocation(String name);
-}
-
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
new file mode 100644
index 000000000..6a49a3f8c
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
@@ -0,0 +1,143 @@
+package org.eclipse.team.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.resources.IFileModificationValidator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.team.core.*;
+import org.eclipse.team.core.internal.Policy;
+
+/**
+ * A concrete subclass of <code>RepositoryProvider</code> is created for each
+ * project that is shared via a repository.
+ *
+ * @see RepositoryProviderType
+ *
+ * @since 2.0
+ */
+public abstract class RepositoryProvider implements IProjectNature {
+
+ /**
+ * Default constructor required for the resources plugin to instantiate this class from a
+ * extension definition.
+ */
+ public RepositoryProvider() {
+ }
+
+ /**
+ * Returns a <code>RepositoryProviderType</code> that describes the type of this provider.
+ *
+ * @return the <code>RepositoryProviderType</code> of this provider
+ * @see RepositoryProviderType
+ */
+ abstract public RepositoryProviderType getProviderType();
+
+ /**
+ * Configures the nature for the given project. This method is called after <code>setProject</code>
+ * and before the nature is added to the project. If an exception is generated during configuration
+ * of the project the nature will not be assigned to the project.
+ *
+ * @throws CoreException if the configuration fails.
+ */
+ abstract public void configureProject() throws CoreException;
+
+ /**
+ * Configures the nature for the given project. This method is called after <code>setProject</code>
+ * and before the nature is added to the project.
+ * <p>
+ * The default behavior for <code>RepositoryProvider</code> subclasses is to fail the configuration
+ * if a provider is already associated with the given project. Subclasses cannot override this method
+ * but must instead override <code>configureProject</code>.
+ *
+ * @throws CoreException if this method fails. If the configuration fails the nature will not be added
+ * to the project.
+ * @see IProjectNature#configure
+ */
+ final public void configure() throws CoreException {
+ RepositoryProvider provider = RepositoryProviderType.getProvider(getProject());
+ // Core Bug 11395
+ // When configure is called the nature has already been assigned to the project. This check will always
+ // fail. Also, if configure fails the nature is still added to the project.
+ //if(provider!=null) {
+ // throw new CoreException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, "A provider is already associated with this project: " + provider, null));
+ //}
+ // Alternate slower check
+ RepositoryProviderType[] types = RepositoryProviderType.getAllProviderTypes();
+ int count = 0;
+ for (int i = 0; i < types.length; i++) {
+ if(getProject().getNature(types[i].getID())!=null) {
+ count++;
+ }
+ }
+ if(count>1) {
+ try {
+ TeamPlugin.removeNatureFromProject(getProject(), getProviderType().getID(), null);
+ } catch(TeamException e) {
+ throw new CoreException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("RepositoryProvider_Error_removing_nature_from_project___1") + provider, null)); //$NON-NLS-1$
+ }
+ throw new CoreException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("RepositoryProvider_Too_many_providers_associated_with_project___2") + provider, null)); //$NON-NLS-1$
+ }
+ configureProject();
+ }
+
+ /**
+ * Returns <code>true</code> if this provider is of the given type id and <code>false</code>
+ * otherwise.
+ */
+ public boolean isOfType(String id) {
+ return getProviderType().getID().equals(id);
+ }
+
+ /**
+ * Returns an object which implements a set of provider neutral operations for this
+ * provider. Answers <code>null</code> if the provider does not wish to support these
+ * operations.
+ * <p>
+ * The <code>StandardOperations</code> class exposes a basic repository model that
+ * providers may implement to allow third-party plugins to perform repository operations
+ * programmatically. For example, a code generation tool may want to get source
+ * files before generating the code, and check-in the results. If a provider plugin does
+ * not adhere to the <i>semantics</i> of the <code>StandardOperations</code> class
+ * as described, the provider will not be useable programmatically by other third-party
+ * plugins.</p>
+ *
+ * @return the repository operations or <code>null</code> if the provider does not
+ * support provider neutral operations.
+ */
+ public StandardOperations getStandardOperations() {
+ return null;
+ }
+
+ /**
+ * Returns an <code>IFileModificationValidator</code> for pre-checking operations
+ * that modify the contents of files.
+ * Returns <code>null</code> if the provider does not wish to participate in
+ * file modification validation.
+ *
+ * @see org.eclipse.core.resources.IFileModificationValidator
+ */
+
+ public IFileModificationValidator getFileModificationValidator() {
+ return null;
+ }
+
+ /**
+ * Returns a brief description of this provider. The exact details of the
+ * representation are unspecified and subject to change, but the following
+ * may be regarded as typical:
+ *
+ * "SampleProject:org.eclipse.team.cvs.provider"
+ *
+ * @return a string description of this provider
+ */
+ public String toString() {
+ return getProject().getName() + ":" + getProviderType(); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java
new file mode 100644
index 000000000..1c865b34d
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java
@@ -0,0 +1,149 @@
+package org.eclipse.team.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.team.core.internal.Policy;
+
+/**
+ * Describes a type of repository provider snf provides
+ *
+ * @see RepositoryProvider
+ */
+abstract public class RepositoryProviderType {
+
+ // contains a list of registered provider types keyed by provider type id.
+ // {keys = String (ids) values = RepositoryProviderType
+ private static final Map providerTypes = new HashMap();
+
+ /**
+ * Default constructor required for the team plugin to instantiate this class from a
+ * extension definition.
+ */
+ public RepositoryProviderType() {
+ }
+
+ /**
+ * Registers a provider type. This method is not intended to be called by clients and should only be
+ * called by the team plugin.
+ *
+ * @throws TeamException if the provider type is already registered.
+ */
+ final public static void addProviderType(RepositoryProviderType providerType) throws TeamException {
+ if(providerTypes.containsKey(providerType.getID())) {
+ throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("RepositoryProviderTypeduplicate_provider_found_in_plugin.xml___1") + providerType.getID(), null)); //$NON-NLS-1$
+ } else {
+ providerTypes.put(providerType.getID(), providerType);
+ }
+ }
+
+ /**
+ * Returns all known (registered) <code>RepositoryProviderType</code>.
+ *
+ * @return an array of registered <code>RepositoryProviderType</code> instances.
+ */
+ final public static RepositoryProviderType[] getAllProviderTypes() {
+ return (RepositoryProviderType[]) providerTypes.values().toArray(new RepositoryProviderType[providerTypes.size()]);
+ }
+
+ /**
+ * Returns the provider for a given IProject or <code>null</code> if a provider is not associated with
+ * the project. This assumes that only one repository provider can be associated with a project at a
+ * time.
+ *
+ * @return a repository provider for the project or <code>null</code> if the project is not
+ * associated with a provider.
+ */
+ final public static RepositoryProvider getProvider(IProject project) {
+ RepositoryProviderType[] allTypes = getAllProviderTypes();
+ for (int i = 0; i < allTypes.length; i++) {
+ return allTypes[i].getInstance(project);
+ }
+ return null;
+ }
+
+ /**
+ * Returns the provider type instance with the given id or <code>null</code> if a provider type
+ * with that id is not registered.
+ *
+ * @return a provider type with the given id or <code>null</code> if a provider with that id
+ * is not registered.
+ */
+ final public static RepositoryProviderType getProviderType(String id) {
+ return (RepositoryProviderType) providerTypes.get(id);
+ }
+
+ /**
+ * Returns a provider of type the receiver if associated with the given project or <code>null</code>
+ * if the project is not associated with a provider of that type.
+ *
+ * @return the repository provider
+ */
+ final public RepositoryProvider getInstance(IProject project) {
+ String id = getID();
+ try {
+ if(project.isOpen()) {
+ return (RepositoryProvider)project.getNature(id);
+ }
+ } catch(ClassCastException e) {
+ TeamPlugin.log(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("RepositoryProviderTypeRepositoryProvider_assigned_to_the_project_must_be_a_subclass_of_RepositoryProvider___2") + id, e)); //$NON-NLS-1$
+ } catch(CoreException ex) {
+ // would happen if provider nature id is not registered with the resources plugin
+ TeamPlugin.log(new Status(IStatus.WARNING, TeamPlugin.ID, 0, Policy.bind("RepositoryProviderTypeRepositoryProvider_not_registered_as_a_nature_id___3") + id, ex)); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ /**
+ * Returns the unique identifier for this provider type.
+ * For example, org.eclipse.team.repotype.provider.
+ * This identifier must match the <code>IProjectNature</code> ID of
+ * the corresponding <code>RepositoryProvider</code>.
+ *
+ * @return the id
+ */
+ abstract public String getID();
+
+ /**
+ * Returns all instances of the providers of this type.
+ *
+ * @return an array of repository providers
+ */
+ public RepositoryProvider[] getAllInstances() {
+ // traverse projects in workspace and return the list of project that have our id as the nature id.
+ List projectsWithMyId = new ArrayList();
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for (int i = 0; i < projects.length; i++) {
+ RepositoryProvider provider = getInstance(projects[i]);
+ if(provider!=null) {
+ projectsWithMyId.add(provider);
+ }
+ }
+ return (RepositoryProvider[]) projectsWithMyId.toArray(new RepositoryProvider[projectsWithMyId.size()]);
+ }
+
+ /**
+ * Returns a description of this provider type. The exact details of the
+ * representation are unspecified and subject to change, but the following
+ * may be regarded as typical:
+ *
+ * "org.eclipse.team.cvs.provider"
+ *
+ * @return a string description of this provider type
+ */
+ public String toString() {
+ return getID();
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/StandardOperations.java
index 28bb97944..77e0d95c8 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ITeamProvider.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/StandardOperations.java
@@ -1,54 +1,17 @@
-package org.eclipse.team.core;
-
/*
- * (c) Copyright IBM Corp. 2000, 2001.
+ * (c) Copyright 2001 MyCorporation.
* All Rights Reserved.
*/
- import org.eclipse.core.resources.IFile;
+package org.eclipse.team.core;
+
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
- /**
- * The <code>ITeamProvider</code> interface exposes a basic team model that
- * providers should implement to allow third-party plug-ins to perform team operations
- * programmatically. For example, a code generation tool may want to get source
- * files before generating the code, and check-in the results. If a team plugin does
- * not adhere to the <i>semantics</i> of the <code>ITeamProvider</code> interface
- * as described below, the provider will not be useable programmatically by other
- * third-party plug-ins.
- * <p>
- * All the methods take a <code>IProgressMonitor</code> parameter that allows the
- * implementation to provide feedback on long running operations (e.g., those involving
- * large resources, multiple resources or numerous server round-trips). Cancellation is
- * provided by the progress monitor. When a user cancels an operation the resources
- * <em>must</em> be left in a consistent state, even when the operations has not
- * been fully completed. Implementations should throw the
- * <code>org.eclipse.core.runtime.OperationCanceledException</code> after ensuring
- * the consistent state of the workspace.</p>
- * <p>
- * A number of methods also take a '<code>depth</code>' parameter. In these methods
- * the <code>depth</code> parameter applies independently to each element of the
- * <code>resources</code> array. It is used to optimise the case of applying a method to
- * numerous container resources in the same hierarchy. If the <code>depth</code> value
- * is <code>IResource.DEPTH_ZERO</code> the method is only applied to the given
- * container (and not any resources in that container). If the depth value is
- * <code>IResource.DEPTH_ONE </code> then the method is applied to all non-container
- * resources in the given container. If the depth parameter value is
- * <code>IResource.DEPTH_INFINITE</code> then the method is applied to all file
- * resources in the given container and all sub-containers of the given container.</p>
- * <p>
- * <em>Note:</em> The depth parameter values are consistent with their definition in <code>
- * IResource</code>, however, <i>there are currently no API calls that apply to containers, so
- * specifying an operation to <code>IResource.DEPTH_ZERO</code> will not have an effect
- * on any resources.</i>
- *
- * @see ITeamNature
- * @see ITeamManager
- */
-public interface ITeamProvider {
- /**
+public class StandardOperations {
+/**
* Updates the local resource to have the same content as the corresponding remote
* resource. Where the local resource does not exist, this method will create it.
* <p>
@@ -77,7 +40,8 @@ public interface ITeamProvider {
* <li>UNABLE</li>
* </ul>
*/
- public void get(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException;
+ public void get(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException {
+ }
/**
* Changes the state of the local resource from checked-in to checked-out and transfers the content
@@ -111,7 +75,8 @@ public interface ITeamProvider {
* </ul>
* @see checkin(IResource[], int, IProgressMonitor)
*/
- public void checkout(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException;
+ public void checkout(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException {
+ }
/**
* Transfers the content of the local resource to the corresponding remote resource, and changes the
@@ -144,7 +109,8 @@ public interface ITeamProvider {
* </ul>
* @see checkout(IResource[], int, IProgressMonitor)
*/
- public void checkin(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException;
+ public void checkin(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException {
+ }
/**
* Changes the state of the local resource from checked-out to checked-in without updating the contents
@@ -176,7 +142,8 @@ public interface ITeamProvider {
* @see checkin(IResource)
* @see uncheckout(IResource)
*/
- public void uncheckout(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException;
+ public void uncheckout(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException {
+ }
/**
* Deletes the remote resource corresponding to the given local resource.
@@ -206,7 +173,8 @@ public interface ITeamProvider {
* <li>UNABLE</li>
* </ul>
*/
- public void delete(IResource[] resources, IProgressMonitor progress) throws TeamException;
+ public void delete(IResource[] resources, IProgressMonitor progress) throws TeamException {
+ }
/**
* Informs the provider that a local resource's name or path has changed.
@@ -229,7 +197,8 @@ public interface ITeamProvider {
* <li>UNABLE</li>
* </ul>
*/
- public void moved(IPath source, IResource target, IProgressMonitor progress) throws TeamException;
+ public void moved(IPath source, IResource target, IProgressMonitor progress) throws TeamException {
+ }
/*
* Implementor's Note:
@@ -253,7 +222,9 @@ public interface ITeamProvider {
* @see checkout(IResource[], int, IProgressMonitor)
* @see refreshState(IResource[], int, IProgressMonitor)
*/
- public boolean isCheckedOut(IResource resource);
+ public boolean isCheckedOut(IResource resource) {
+ return false;
+ }
/**
* Answers whether the resource has a corresponding remote resource.
@@ -269,7 +240,9 @@ public interface ITeamProvider {
* @see checkin(IResource[], int, IProgressMonitor)
* @see refreshState(IResource[], int, IProgressMonitor)
*/
- public boolean hasRemote(IResource resource);
+ public boolean hasRemote(IResource resource) {
+ return false;
+ }
/**
* Answer if the local resource currently has a different timestamp to the base timestamp
@@ -279,13 +252,17 @@ public interface ITeamProvider {
* @return <code>true</code> if the resource has a different modification
* timestamp, and <code>false</code> otherwise.
*/
- public boolean isDirty(IResource resource);
+ public boolean isDirty(IResource resource) {
+ return false;
+ }
/**
* Answers true if the base of the given resource is different to the
* released state of the given resource.
*/
- public boolean isOutOfDate(IResource resource);
+ public boolean isOutOfDate(IResource resource) {
+ return false;
+ }
/**
* Allows the provider to refresh resource state information for a resource.
@@ -309,14 +286,6 @@ public interface ITeamProvider {
* <li>UNABLE</li>
* </ul>
*/
- public void refreshState(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException;
-
- /*
- * @see IFileModificationValidator#validateEdit(IFile[], Object)
- */
- public IStatus validateEdit(IFile[] files, Object context);
- /*
- * @see IFileModificationValidator#validateSave(IFile)
- */
- public IStatus validateSave(IFile file);
-} \ No newline at end of file
+ public void refreshState(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException {
+ }
+}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamPlugin.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamPlugin.java
index 049e8da63..d256ac334 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamPlugin.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamPlugin.java
@@ -5,45 +5,69 @@ package org.eclipse.team.core;
* All Rights Reserved.
*/
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.EOFException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IPluginDescriptor;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.team.core.internal.FileTypeRegistry;
import org.eclipse.team.core.internal.Policy;
-import org.eclipse.team.core.internal.TeamManager;
/**
* <code>TeamPlugin</code> is the plug-in runtime class for the Team
* resource management plugin.
* <p>
* This plugin provides a lightweight registration and lookup service for
- * associating projects with providers. The registration mechanism is
- * based on the platform's project natures. Using projects natures allows
- * manipulating a project in a nature-specific way, for example UI
- * contributions can be made conditional based on the nature of a project.
+ * managing global ignores patterns and file type associations. Also it
+ * serves as a boot strap for registration of RepositoryProviderType classes.
* </p>
*
- * @see ITeamNature
- * @see ITeamProvider
- * @see ITeamManager
+ * @see RepositoryProvider
+ * @see RepositoryProviderType
*/
final public class TeamPlugin extends Plugin {
// The id of the core team plug-in
- public static final String ID = "org.eclipse.team.core";
+ public static final String ID = "org.eclipse.team.core"; //$NON-NLS-1$
// The id of the providers extension point
- public static final String PROVIDER_EXTENSION = "providers";
+ private static final String PROVIDER_EXTENSION = "repository-provider-type"; //$NON-NLS-1$
// The id of the file types extension point
- public static final String FILE_TYPES_EXTENSION = "fileTypes";
+ private static final String FILE_TYPES_EXTENSION = "fileTypes"; //$NON-NLS-1$
// The id of the global ignore extension point
- public static final String IGNORE_EXTENSION = "ignore";
-
- // The team manager - manages relationships between projects and providers
- private static TeamManager manager;
+ private static final String IGNORE_EXTENSION = "ignore"; //$NON-NLS-1$
+
+ // File name of the persisted global ignore patterns
+ private final static String GLOBALIGNORE_FILE = ".globalIgnores"; //$NON-NLS-1$
+
+ // The ignore list that is read at startup from the persisted file
+ private static Map globalIgnore = new HashMap(11);
// The file type registry
private static FileTypeRegistry registry;
@@ -64,13 +88,16 @@ final public class TeamPlugin extends Plugin {
*/
public void startup() throws CoreException {
try {
- Policy.localize("org.eclipse.team.core.internal.messages");
-
- manager = new TeamManager();
- manager.startup();
-
+ Policy.localize("org.eclipse.team.core.internal.messages"); //$NON-NLS-1$
registry = new FileTypeRegistry();
registry.startup();
+
+ // XXX forces loading of all repository plugins, may instead want to
+ // lazilly initialize plugin descriptors then on demand, create the executable
+ // extension.
+ initializeRepositoryProviderTypes();
+ readState();
+ initializePluginIgnores();
} catch(TeamException e) {
throw new CoreException(e.getStatus());
}
@@ -93,13 +120,6 @@ final public class TeamPlugin extends Plugin {
}
/**
- * Returns the team manager.
- */
- public static ITeamManager getManager() {
- return manager;
- }
-
- /**
* Returns the file type registry.
*/
public static IFileTypeRegistry getFileTypeRegistry() {
@@ -112,4 +132,222 @@ final public class TeamPlugin extends Plugin {
public static void log(int severity, String message, Throwable e) {
plugin.getLog().log(new Status(severity, ID, 0, message, e));
}
+
+ /**
+ * Returns the plug-in's log
+ */
+ public static void log(IStatus status) {
+ plugin.getLog().log(status);
+ }
+
+ /**
+ * Returns the list of global ignores.
+ */
+ public IIgnoreInfo[] getGlobalIgnore() {
+ IIgnoreInfo[] result = new IIgnoreInfo[globalIgnore.size()];
+ Iterator e = globalIgnore.keySet().iterator();
+ int i = 0;
+ while (e.hasNext() ) {
+ final String pattern = (String)e.next();
+ final boolean enabled = ((Boolean)globalIgnore.get(pattern)).booleanValue();
+ result[i++] = new IIgnoreInfo() {
+ private String p = pattern;
+ private boolean e = enabled;
+ public String getPattern() {
+ return p;
+ }
+ public boolean getEnabled() {
+ return e;
+ }
+ };
+ }
+ return result;
+ }
+
+ /**
+ * Add patterns to the list of global ignores.
+ */
+ public void setGlobalIgnore(String[] patterns, boolean[] enabled) {
+ globalIgnore = new Hashtable(11);
+ for (int i = 0; i < patterns.length; i++) {
+ globalIgnore.put(patterns[i], new Boolean(enabled[i]));
+ }
+ try {
+ // make sure that we update our state on disk
+ savePluginState();
+ } catch (TeamException ex) {
+ TeamPlugin.log(IStatus.WARNING, Policy.bind("TeamPlugin_setting_global_ignore_7"), ex); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Utility for adding a nature to a project.
+ */
+ static public void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws TeamException {
+ try {
+ IProjectDescription description = proj.getDescription();
+ String[] prevNatures= description.getNatureIds();
+ String[] newNatures= new String[prevNatures.length + 1];
+ System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
+ newNatures[prevNatures.length]= natureId;
+ description.setNatureIds(newNatures);
+ proj.setDescription(description, monitor);
+ } catch(CoreException e) {
+ throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("manager.errorSettingNature", //$NON-NLS-1$
+ proj.getName(), natureId), e));
+ }
+ }
+
+ /**
+ * Utility for removing a project nature.
+ */
+ static public void removeNatureFromProject(IProject proj, String natureId, IProgressMonitor monitor) throws TeamException {
+ try {
+ IProjectDescription description = proj.getDescription();
+ String[] prevNatures= description.getNatureIds();
+ List newNatures = new ArrayList(Arrays.asList(prevNatures));
+ newNatures.remove(natureId);
+ description.setNatureIds((String[])newNatures.toArray(new String[newNatures.size()]));
+ proj.setDescription(description, monitor);
+ } catch(CoreException e) {
+ throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("manager.errorRemovingNature", //$NON-NLS-1$
+ proj.getName(), natureId), e));
+ }
+ }
+
+ /**
+ * Find and initialize all the registered providers
+ */
+ private void initializeRepositoryProviderTypes() throws TeamException {
+
+ IExtensionPoint extensionPoint = Platform.getPluginRegistry().getExtensionPoint(TeamPlugin.ID, TeamPlugin.PROVIDER_EXTENSION);
+ if (extensionPoint == null) {
+ throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("manager.providerExtensionNotFound"), null)); //$NON-NLS-1$
+ }
+
+ IExtension[] extensions = extensionPoint.getExtensions();
+ if (extensions.length == 0)
+ return;
+ for (int i = 0; i < extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configs = extension.getConfigurationElements();
+ if (configs.length == 0) {
+ // there is no configuration element
+ // log as an error but continue to instantiate other executable extensions.
+ TeamPlugin.log(IStatus.ERROR, Policy.bind("manager.providerNoConfigElems", extension.getUniqueIdentifier()), null); //$NON-NLS-1$
+ continue;
+ }
+ IConfigurationElement config = configs[0];
+ String configName = config.getName();
+ if (!"repository".equals(config.getName())) { //$NON-NLS-1$
+ String message = Policy.bind("resources.natureFormat", configName); //$NON-NLS-1$
+ throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, message, null));
+ }
+
+ try {
+ RepositoryProviderType providerType = (RepositoryProviderType) config.createExecutableExtension("provider-type"); //$NON-NLS-1$
+ RepositoryProviderType.addProviderType(providerType);
+ } catch (ClassCastException e) {
+ String message = Policy.bind("resources.natureImplement", configName); //$NON-NLS-1$
+ throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, message, null));
+ } catch (CoreException e){
+ String message = Policy.bind("resources.natureImplement", configName); //$NON-NLS-1$
+ throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, message, null));
+ }
+ }
+ }
+
+ /*
+ * Reads the ignores currently defined by extensions.
+ */
+ private void initializePluginIgnores() {
+ TeamPlugin plugin = TeamPlugin.getPlugin();
+ if (plugin != null) {
+ IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint(TeamPlugin.IGNORE_EXTENSION);
+ if (extension != null) {
+ IExtension[] extensions = extension.getExtensions();
+ for (int i = 0; i < extensions.length; i++) {
+ IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
+ for (int j = 0; j < configElements.length; j++) {
+ String pattern = configElements[j].getAttribute("pattern"); //$NON-NLS-1$
+ if (pattern != null) {
+ String selected = configElements[j].getAttribute("selected"); //$NON-NLS-1$
+ boolean enabled = selected != null && selected.equalsIgnoreCase("true"); //$NON-NLS-1$
+ // if this ignore doesn't already exist, add it to the global list
+ if (!globalIgnore.containsKey(pattern)) {
+ globalIgnore.put(pattern, new Boolean(enabled));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * Save global ignore file
+ */
+ private void savePluginState() throws TeamException {
+ // save global ignore list to disk
+ IPath pluginStateLocation = TeamPlugin.getPlugin().getStateLocation();
+ File tempFile = pluginStateLocation.append(GLOBALIGNORE_FILE + ".tmp").toFile(); //$NON-NLS-1$
+ File stateFile = pluginStateLocation.append(GLOBALIGNORE_FILE).toFile();
+ try {
+ DataOutputStream dos = new DataOutputStream(new FileOutputStream(tempFile));
+ writeState(dos);
+ dos.close();
+ if (stateFile.exists())
+ stateFile.delete();
+ boolean renamed = tempFile.renameTo(stateFile);
+ if (!renamed)
+ throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("TeamPlugin_renaming_21"), null)); //$NON-NLS-1$
+ } catch (IOException ex) {
+ throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("TeamPlugin_closing_stream_22"), ex)); //$NON-NLS-1$
+ }
+ }
+
+ /*
+ * Write the global ignores to the stream
+ */
+ private void writeState(DataOutputStream dos) throws IOException {
+ // write the global ignore list
+ int ignoreLength = globalIgnore.size();
+ dos.writeInt(ignoreLength);
+ Iterator e = globalIgnore.keySet().iterator();
+ while (e.hasNext()) {
+ String pattern = (String)e.next();
+ boolean enabled = ((Boolean)globalIgnore.get(pattern)).booleanValue();
+ dos.writeUTF(pattern);
+ dos.writeBoolean(enabled);
+ }
+ }
+
+ private void readState() throws TeamException {
+ // read saved repositories list and ignore list from disk, only if the file exists
+ IPath pluginStateLocation = TeamPlugin.getPlugin().getStateLocation().append(GLOBALIGNORE_FILE);
+ File f = pluginStateLocation.toFile();
+ if(f.exists()) {
+ try {
+ DataInputStream dis = new DataInputStream(new FileInputStream(f));
+ globalIgnore = new Hashtable(11);
+ int ignoreCount = 0;
+ try {
+ ignoreCount = dis.readInt();
+ } catch (EOFException e) {
+ // Ignore the exception, it will occur if there are no ignore
+ // patterns stored in the provider state file.
+ return;
+ }
+ for (int i = 0; i < ignoreCount; i++) {
+ String pattern = dis.readUTF();
+ boolean enabled = dis.readBoolean();
+ globalIgnore.put(pattern, new Boolean(enabled));
+ }
+ } catch(FileNotFoundException e) {
+ // not a fatal error, there just happens not to be any state to read
+ } catch (IOException ex) {
+ throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("TeamPlugin_closing_stream_23"), ex)); //$NON-NLS-1$
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/FileModificationValidator.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/FileModificationValidator.java
index 61fee8f09..ebd30963c 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/FileModificationValidator.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/FileModificationValidator.java
@@ -10,13 +10,13 @@ import org.eclipse.core.resources.IFileModificationValidator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamPlugin;
public class FileModificationValidator implements IFileModificationValidator {
- private static final Status OK = new Status(Status.OK, TeamPlugin.ID, Status.OK, Policy.bind("FileModificationValidator.ok"), null);
- private static final Status READ_ONLY = new Status(Status.ERROR, TeamPlugin.ID, Status.ERROR, Policy.bind("FileModificationValidator.isReadOnly"), null);
+ private static final Status OK = new Status(Status.OK, TeamPlugin.ID, Status.OK, Policy.bind("FileModificationValidator.ok"), null); //$NON-NLS-1$
+ private static final Status READ_ONLY = new Status(Status.ERROR, TeamPlugin.ID, Status.ERROR, Policy.bind("FileModificationValidator.isReadOnly"), null); //$NON-NLS-1$
/*
* @see IFileModificationValidator#validateEdit(IFile[], Object)
@@ -26,34 +26,39 @@ public class FileModificationValidator implements IFileModificationValidator {
IStatus[] result = new IStatus[files.length];
// Optimization so we don't create a new IFile[] each time
IFile[] fileArray = new IFile[1];
- ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < files.length; i++) {
IFile file = files[i];
- ITeamProvider provider = manager.getProvider(file.getProject());
- if (provider == null) {
- result[i] =
- (file.isReadOnly())
- ? READ_ONLY
- : OK;
- } else {
- fileArray[0] = file;
- result[i] = provider.validateEdit(fileArray, context);
+ RepositoryProvider provider = RepositoryProviderType.getProvider(file.getProject());
+ IFileModificationValidator validator = null;
+ if (provider != null) {
+ validator = provider.getFileModificationValidator();
+ if(validator!=null) {
+ fileArray[0] = file;
+ result[i] = validator.validateEdit(fileArray, context);
+ }
+ }
+
+ if(validator==null) {
+ result[i] = (file.isReadOnly()) ? READ_ONLY : OK;
}
}
if (result.length == 1) {
return result[0];
}
- return new MultiStatus(TeamPlugin.ID, 0, result, Policy.bind("FileModificationValidator.validateEdit"), null);
+ return new MultiStatus(TeamPlugin.ID, 0, result, Policy.bind("FileModificationValidator.validateEdit"), null); //$NON-NLS-1$
}
/*
* @see IFileModificationValidator#validateSave(IFile)
*/
public IStatus validateSave(IFile file) {
- ITeamProvider provider = TeamPlugin.getManager().getProvider(file.getProject());
- if (provider == null) {
- return OK;
+ RepositoryProvider provider = RepositoryProviderType.getProvider(file.getProject());
+ if (provider != null) {
+ IFileModificationValidator validator = provider.getFileModificationValidator();
+ if(validator!=null) {
+ return validator.validateSave(file);
+ }
}
- return provider.validateSave(file);
+ return OK;
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/FileTypeRegistry.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/FileTypeRegistry.java
index 7e09a27c4..8abbd49bd 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/FileTypeRegistry.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/FileTypeRegistry.java
@@ -28,7 +28,10 @@ import org.eclipse.team.core.TeamPlugin;
*/
public class FileTypeRegistry implements IFileTypeRegistry {
// Constant for the saved state file name
- private static final String STATE_FILE = ".fileTypes";
+ private static final String STATE_FILE = ".fileTypes"; //$NON-NLS-1$
+
+ // The id of the file types extension point
+ private static final String FILE_TYPES_EXTENSION = "fileTypes"; //$NON-NLS-1$
// Keys: file extensions. Values: Integers
private Hashtable table;
@@ -90,20 +93,20 @@ public class FileTypeRegistry implements IFileTypeRegistry {
private void initializePluginPatterns() {
TeamPlugin plugin = TeamPlugin.getPlugin();
if (plugin != null) {
- IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint(TeamPlugin.FILE_TYPES_EXTENSION);
+ IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint(FILE_TYPES_EXTENSION);
if (extension != null) {
IExtension[] extensions = extension.getExtensions();
for (int i = 0; i < extensions.length; i++) {
IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
for (int j = 0; j < configElements.length; j++) {
- String ext = configElements[j].getAttribute("extension");
+ String ext = configElements[j].getAttribute("extension"); //$NON-NLS-1$
if (ext != null) {
- String type = configElements[j].getAttribute("type");
+ String type = configElements[j].getAttribute("type"); //$NON-NLS-1$
// If the extension doesn't already exist, add it.
if (!containsExtension(ext)) {
- if (type.equals("text")) {
+ if (type.equals("text")) { //$NON-NLS-1$
setValue(ext, TEXT);
- } else if (type.equals("binary")) {
+ } else if (type.equals("binary")) { //$NON-NLS-1$
setValue(ext, BINARY);
}
}
@@ -176,7 +179,7 @@ public class FileTypeRegistry implements IFileTypeRegistry {
*/
private void savePluginState() {
IPath pluginStateLocation = TeamPlugin.getPlugin().getStateLocation();
- File tempFile = pluginStateLocation.append(STATE_FILE + ".tmp").toFile();
+ File tempFile = pluginStateLocation.append(STATE_FILE + ".tmp").toFile(); //$NON-NLS-1$
File stateFile = pluginStateLocation.append(STATE_FILE).toFile();
try {
DataOutputStream dos = new DataOutputStream(new FileOutputStream(tempFile));
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/IgnoreInfo.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/IgnoreInfo.java
deleted file mode 100644
index 53398acb8..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/IgnoreInfo.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.team.core.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.team.core.IIgnoreInfo;
-
-public class IgnoreInfo implements IIgnoreInfo {
- private String pattern;
- private boolean enabled;
-
- IgnoreInfo(String pattern, boolean enabled) {
- this.pattern = pattern;
- this.enabled = enabled;
- }
- public String getPattern() {
- return pattern;
- }
- public boolean getEnabled() {
- return enabled;
- }
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/Policy.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/Policy.java
index f429d24cd..f6eda9292 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/Policy.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/Policy.java
@@ -50,7 +50,7 @@ public class Policy {
} catch (MissingResourceException e) {
return key;
} catch (NullPointerException e) {
- return "!" + key + "!";
+ return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -64,7 +64,7 @@ public class Policy {
} catch (MissingResourceException e) {
return key;
} catch (NullPointerException e) {
- return "!" + key + "!";
+ return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/TeamManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/TeamManager.java
deleted file mode 100644
index bed847b6b..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/TeamManager.java
+++ /dev/null
@@ -1,388 +0,0 @@
-package org.eclipse.team.core.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.EOFException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.team.core.IIgnoreInfo;
-import org.eclipse.team.core.IResourceStateChangeListener;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamNature;
-import org.eclipse.team.core.ITeamProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
-
-public class TeamManager implements ITeamManager {
-
- private final static String ATT_NATUREID = "natureId";
- private final static String GLOBALIGNORE_FILE = ".globalIgnores";
-
- private static List natureIdsRegistry = new ArrayList(5);
- private static List listeners = new ArrayList(5);
- private static Map globalIgnore = new HashMap(11);
-
- /**
- * Start the team manager.
- *
- * If this method throws an exception, it is taken as an indication that
- * the manager initialization has failed; as a result, the client should consider
- * team support disabled.
- */
- public void startup() throws TeamException {
- initializeProviders();
- readState();
- initializePluginIgnores();
- }
-
- protected boolean alreadyMapped(IProject project) {
- try {
- String[] natures = project.getDescription().getNatureIds();
- for (int i = 0; i < natures.length; i++) {
- if(natureIdsRegistry.contains(natures[i]))
- return true;
- }
- } catch(CoreException e) {
- // fall through
- }
- return false;
- }
-
- protected String getFirstProviderNatureId(IProject project) {
- try {
- String[] natures = project.getDescription().getNatureIds();
- for (int i = 0; i < natures.length; i++) {
- if(natureIdsRegistry.contains(natures[i]))
- return natures[i];
- }
- } catch(CoreException e) {
- // fall through
- }
- return null;
- }
-
- /**
- * @see ITeamManager#setProvider(IProject, String, IProgressMonitor)
- */
- public void setProvider(IProject project, String natureId, Properties configuration, IProgressMonitor progress) throws TeamException {
-
- if(alreadyMapped(project)) {
- throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("manager.providerAlreadyMapped",
- project.getName(), natureId), null));
- }
-
- if(!natureIdsRegistry.contains(natureId)) {
- throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("manager.notTeamNature",
- natureId), null));
- }
-
- addNatureToProject(project, natureId, progress);
-
- if(configuration!=null) {
- setConfiguration(project, natureId, configuration, progress);
- }
- }
-
- protected void setConfiguration(IProject project, String natureId, Properties properties, IProgressMonitor progress) throws TeamException {
- try {
- ITeamNature teamNature = (ITeamNature)project.getNature(natureId);
- teamNature.configureProvider(properties);
- } catch(ClassCastException e) {
- throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("manager.teamNatureBadType",
- project.getName(), natureId), null));
- } catch(CoreException e) {
- throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("manager.cannotGetDescription",
- project.getName(), natureId), null));
-
- }
- }
-
- /**
- * @see ITeamManager#getProvider(IResource resource)
- */
- public ITeamProvider getProvider(IResource resource) {
- IProject project = resource.getProject();
- String natureId = getFirstProviderNatureId(project);
-
- if(natureId==null) {
- return null;
- }
-
- try {
- ITeamNature teamNature = (ITeamNature)project.getNature(natureId);
- return teamNature.getProvider();
- } catch(ClassCastException e) {
- return null;
- } catch(CoreException e) {
- return null;
- } catch(TeamException e) {
- return null;
- }
- }
-
- /**
- * Un-associate this project with its provider. If the project is not associated with
- * a provider this method has no effect.
- *
- * @param project to remote the associate to its provider.
- */
- public void removeProvider(IProject project, IProgressMonitor progress) throws TeamException {
- String natureId = getFirstProviderNatureId(project);
- if(natureId==null) {
- return;
- } else {
- removeNatureFromProject(project, natureId, progress);
- }
- }
-
- /**
- * Utility for adding a nature to a project
- */
- protected void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws TeamException {
- try {
- IProjectDescription description = proj.getDescription();
- String[] prevNatures= description.getNatureIds();
- String[] newNatures= new String[prevNatures.length + 1];
- System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
- newNatures[prevNatures.length]= natureId;
- description.setNatureIds(newNatures);
- proj.setDescription(description, monitor);
- } catch(CoreException e) {
- throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("manager.errorSettingNature",
- proj.getName(), natureId), e));
- }
- }
-
- protected void removeNatureFromProject(IProject proj, String natureId, IProgressMonitor monitor) throws TeamException {
- try {
- IProjectDescription description = proj.getDescription();
- String[] prevNatures= description.getNatureIds();
- List newNatures = new ArrayList(Arrays.asList(prevNatures));
- newNatures.remove(natureId);
- description.setNatureIds((String[])newNatures.toArray(new String[newNatures.size()]));
- proj.setDescription(description, monitor);
- } catch(CoreException e) {
- throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("manager.errorRemovingNature",
- proj.getName(), natureId), e));
- }
- }
-
- /**
- * Find and initialize all the registered providers
- */
- private void initializeProviders() throws TeamException {
-
- IExtensionPoint extensionPoint = Platform.getPluginRegistry().getExtensionPoint(TeamPlugin.ID, TeamPlugin.PROVIDER_EXTENSION);
- if (extensionPoint == null) {
- throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, Policy.bind("manager.providerExtensionNotFound"), null));
- }
-
- IExtension[] extensions = extensionPoint.getExtensions();
- if (extensions.length == 0)
- return;
- for (int i = 0; i < extensions.length; i++) {
- IExtension extension = extensions[i];
- IConfigurationElement[] configs = extension.getConfigurationElements();
- if (configs.length == 0) {
- // there is no configuration element
- // log as an error but continue to instantiate other executable extensions.
- TeamPlugin.log(IStatus.ERROR, Policy.bind("manager.providerNoConfigElems", extension.getUniqueIdentifier()), null);
- continue;
- }
- IConfigurationElement config = configs[0];
- if(config.getName().equalsIgnoreCase(TeamPlugin.PROVIDER_EXTENSION)){
- String natureId = config.getAttribute(ATT_NATUREID);
-
- if(natureId!=null) {
- natureIdsRegistry.add(natureId);
- } else {
- // failed to instantiate executable extension.
- // log the error but continue to instantiate other executable extensions.
- TeamPlugin.log(IStatus.ERROR, Policy.bind("manager.cannotBadFormat", extension.getUniqueIdentifier()), null);
- continue;
- }
- }
- }
- }
-
- /*
- * @see ITeamManager#addResourceStateChangeListener(IResourceStateChangeListener)
- */
- public void addResourceStateChangeListener(IResourceStateChangeListener listener) {
- listeners.add(listener);
- }
-
- /*
- * @see ITeamManager#removeResourceStateChangeListener(IResourceStateChangeListener)
- */
- public void removeResourceStateChangeListener(IResourceStateChangeListener listener) {
- listeners.remove(listener);
- }
-
- /*
- * @see ITeamManager#broadcastResourceStateChanges(IResource[])
- */
- public void broadcastResourceStateChanges(final IResource[] resources) {
- for(Iterator it=listeners.iterator(); it.hasNext();) {
- final IResourceStateChangeListener listener = (IResourceStateChangeListener)it.next();
- ISafeRunnable code = new ISafeRunnable() {
- public void run() throws Exception {
- listener.resourceStateChanged(resources);
- }
- public void handleException(Throwable e) {
- // don't log the exception....it is already being logged in Platform#run
- }
- };
- Platform.run(code);
- }
- }
-
- public IIgnoreInfo[] getGlobalIgnore() {
- IIgnoreInfo[] result = new IIgnoreInfo[globalIgnore.size()];
- Iterator e = globalIgnore.keySet().iterator();
- int i = 0;
- while (e.hasNext() ) {
- String pattern = (String)e.next();
- boolean enabled = ((Boolean)globalIgnore.get(pattern)).booleanValue();
- result[i++] = new IgnoreInfo(pattern, enabled);
- }
- return result;
- }
-
- public void setGlobalIgnore(String[] patterns, boolean[] enabled) {
- globalIgnore = new Hashtable(11);
- for (int i = 0; i < patterns.length; i++) {
- globalIgnore.put(patterns[i], new Boolean(enabled[i]));
- }
- try {
- // make sure that we update our state on disk
- savePluginState();
- } catch (TeamException ex) {
- TeamPlugin.log(IStatus.WARNING, "setting global ignore", ex);
- }
- }
-
- /*
- * Reads the ignores currently defined by extensions.
- */
- private void initializePluginIgnores() {
- TeamPlugin plugin = TeamPlugin.getPlugin();
- if (plugin != null) {
- IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint(TeamPlugin.IGNORE_EXTENSION);
- if (extension != null) {
- IExtension[] extensions = extension.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- String pattern = configElements[j].getAttribute("pattern");
- if (pattern != null) {
- String selected = configElements[j].getAttribute("selected");
- boolean enabled = selected != null && selected.equalsIgnoreCase("true");
- // if this ignore doesn't already exist, add it to the global list
- if (!globalIgnore.containsKey(pattern)) {
- globalIgnore.put(pattern, new Boolean(enabled));
- }
- }
- }
- }
- }
- }
- }
-
- /*
- * Save global ignore file
- */
- private void savePluginState() throws TeamException {
- // save global ignore list to disk
- IPath pluginStateLocation = TeamPlugin.getPlugin().getStateLocation();
- File tempFile = pluginStateLocation.append(GLOBALIGNORE_FILE + ".tmp").toFile();
- File stateFile = pluginStateLocation.append(GLOBALIGNORE_FILE).toFile();
- try {
- DataOutputStream dos = new DataOutputStream(new FileOutputStream(tempFile));
- writeState(dos);
- dos.close();
- if (stateFile.exists())
- stateFile.delete();
- boolean renamed = tempFile.renameTo(stateFile);
- if (!renamed)
- throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, "renaming", null));
- } catch (IOException ex) {
- throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, "closing stream", ex));
- }
- }
-
- /*
- * Write the global ignores to the stream
- */
- private void writeState(DataOutputStream dos) throws IOException {
- // write the global ignore list
- int ignoreLength = globalIgnore.size();
- dos.writeInt(ignoreLength);
- Iterator e = globalIgnore.keySet().iterator();
- while (e.hasNext()) {
- String pattern = (String)e.next();
- boolean enabled = ((Boolean)globalIgnore.get(pattern)).booleanValue();
- dos.writeUTF(pattern);
- dos.writeBoolean(enabled);
- }
- }
-
- private void readState() throws TeamException {
- // read saved repositories list and ignore list from disk, only if the file exists
- IPath pluginStateLocation = TeamPlugin.getPlugin().getStateLocation().append(GLOBALIGNORE_FILE);
- File f = pluginStateLocation.toFile();
- if(f.exists()) {
- try {
- DataInputStream dis = new DataInputStream(new FileInputStream(f));
- globalIgnore = new Hashtable(11);
- int ignoreCount = 0;
- try {
- ignoreCount = dis.readInt();
- } catch (EOFException e) {
- // Ignore the exception, it will occur if there are no ignore
- // patterns stored in the provider state file.
- return;
- }
- for (int i = 0; i < ignoreCount; i++) {
- String pattern = dis.readUTF();
- boolean enabled = dis.readBoolean();
- globalIgnore.put(pattern, new Boolean(enabled));
- }
- } catch(FileNotFoundException e) {
- // not a fatal error, there just happens not to be any state to read
- } catch (IOException ex) {
- throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, 0, "closing stream", ex));
- }
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/messages.properties b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/messages.properties
index 24861f038..47cd4dfee 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/messages.properties
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/messages.properties
@@ -19,3 +19,13 @@ manager.coreException=Error creating validator decorator: core exception
FileModificationValidator.validateEdit=Validate Edit
FileModificationValidator.isReadOnly=File is Read Only.
FileModificationValidator.ok=OK
+
+RepositoryProvider_Error_removing_nature_from_project___1=Error removing nature from project:
+RepositoryProvider_Too_many_providers_associated_with_project___2=Too many providers associated with project:
+RepositoryProviderTypeduplicate_provider_found_in_plugin.xml___1=duplicate provider found in plugin.xml:
+RepositoryProviderTypeRepositoryProvider_assigned_to_the_project_must_be_a_subclass_of_RepositoryProvider___2=RepositoryProvider assigned to the project must be a subclass of RepositoryProvider:
+RepositoryProviderTypeRepositoryProvider_not_registered_as_a_nature_id___3=RepositoryProvider not registered as a nature id:
+TeamPlugin_setting_global_ignore_7=setting global ignore
+TeamPlugin_renaming_21=renaming
+TeamPlugin_closing_stream_22=closing stream
+TeamPlugin_closing_stream_23=closing stream
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/Assert.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/Assert.java
index 88aff54cc..0f19040dd 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/internal/Assert.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/Assert.java
@@ -1,4 +1,4 @@
-package org.eclipse.team.core.internal;
+package org.eclipse.team.core.sync;
/*
* (c) Copyright IBM Corp. 2000, 2001.
@@ -28,7 +28,7 @@ private Assert() {
* @exception IllegalArgumentException if the legality test failed
*/
public static boolean isLegal(boolean expression) {
- return isLegal(expression, ""/*nonNLS*/);
+ return isLegal(expression, ""); //$NON-NLS-1$
}
/** Asserts that an argument is legal. If the given boolean is
* not <code>true</code>, an <code>IllegalArgumentException</code>
@@ -53,7 +53,7 @@ public static boolean isLegal(boolean expression, String message) {
* @exception IllegalArgumentException if the object is <code>null</code>
*/
public static void isNotNull(Object object) {
- isNotNull(object, ""/*nonNLS*/);
+ isNotNull(object, ""/*nonNLS*/); //$NON-NLS-1$
}
/** Asserts that the given object is not <code>null</code>. If this
* is not the case, some kind of unchecked exception is thrown.
@@ -65,7 +65,7 @@ public static void isNotNull(Object object) {
*/
public static void isNotNull(Object object, String message) {
if (object == null)
- throw new AssertionFailedException("null argument:" /*non NLS*/ + message);
+ throw new AssertionFailedException("null argument:" /*non NLS*/ + message); //$NON-NLS-1$
}
/** Asserts that the given boolean is <code>true</code>. If this
* is not the case, some kind of unchecked exception is thrown.
@@ -75,7 +75,7 @@ public static void isNotNull(Object object, String message) {
* if the check fails)
*/
public static boolean isTrue(boolean expression) {
- return isTrue(expression, ""/*nonNLS*/);
+ return isTrue(expression, ""/*nonNLS*/); //$NON-NLS-1$
}
/** Asserts that the given boolean is <code>true</code>. If this
* is not the case, some kind of unchecked exception is thrown.
@@ -88,7 +88,7 @@ public static boolean isTrue(boolean expression) {
*/
public static boolean isTrue(boolean expression, String message) {
if (!expression)
- throw new AssertionFailedException("assert failed:" /*non NLS*/ + message);
+ throw new AssertionFailedException("assert failed:" /*non NLS*/ + message); //$NON-NLS-1$
return expression;
}
/**
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteSyncElement.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteSyncElement.java
index 6aef71f3f..3ffd4be20 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteSyncElement.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteSyncElement.java
@@ -25,7 +25,6 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.internal.Assert;
/**
* A standard abstract class that provides implementations for interesting
@@ -369,25 +368,25 @@ public abstract class RemoteSyncElement extends LocalSyncElement implements IRem
*/
public String toString() {
StringBuffer buffer = new StringBuffer();
- buffer.append(getName() + "[");
+ buffer.append(getName() + "["); //$NON-NLS-1$
int kind = getSyncKind(GRANULARITY_TIMESTAMP, null);
if(kind==IN_SYNC) {
- buffer.append("in-sync");
+ buffer.append("in-sync"); //$NON-NLS-1$
} else {
switch(kind & DIRECTION_MASK) {
- case CONFLICTING: buffer.append("conflicting"); break;
- case OUTGOING: buffer.append("outgoing"); break;
- case INCOMING: buffer.append("incoming"); break;
+ case CONFLICTING: buffer.append("conflicting"); break; //$NON-NLS-1$
+ case OUTGOING: buffer.append("outgoing"); break; //$NON-NLS-1$
+ case INCOMING: buffer.append("incoming"); break; //$NON-NLS-1$
}
switch(kind & DIRECTION_MASK) {
- case CHANGE: buffer.append("change"); break;
- case ADDITION: buffer.append("addition"); break;
- case DELETION: buffer.append("deletion"); break;
+ case CHANGE: buffer.append("change"); break; //$NON-NLS-1$
+ case ADDITION: buffer.append("addition"); break; //$NON-NLS-1$
+ case DELETION: buffer.append("deletion"); break; //$NON-NLS-1$
}
- if((kind & MANUAL_CONFLICT) != 0) buffer.append("{manual}");
- if((kind & AUTOMERGE_CONFLICT) != 0) buffer.append("{auto}");
+ if((kind & MANUAL_CONFLICT) != 0) buffer.append("{manual}"); //$NON-NLS-1$
+ if((kind & AUTOMERGE_CONFLICT) != 0) buffer.append("{auto}"); //$NON-NLS-1$
}
- buffer.append("]");
+ buffer.append("]"); //$NON-NLS-1$
return buffer.toString();
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/plugin.xml b/bundles/org.eclipse.team.cvs.core/plugin.xml
index 462a77d2a..3d1a367d1 100644
--- a/bundles/org.eclipse.team.cvs.core/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.core/plugin.xml
@@ -40,8 +40,10 @@
</extension>
<!-- *************** Team Provider **************** -->
- <extension id="CVSProvider" point="org.eclipse.team.core.providers">
- <providers natureId="org.eclipse.team.cvs.core.cvsnature"/>
+ <extension point="org.eclipse.team.core.repository-provider-type" id="cvs-provider-type">
+ <repository>
+ <provider-type class="org.eclipse.team.ccvs.core.CVSRepositoryProviderType"/>
+ </repository>
</extension>
<!-- *************** Project Nature **************** -->
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/ccvs/core/CVSRepositoryProviderType.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/ccvs/core/CVSRepositoryProviderType.java
new file mode 100644
index 000000000..b98bd27ae
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/ccvs/core/CVSRepositoryProviderType.java
@@ -0,0 +1,31 @@
+package org.eclipse.team.ccvs.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.team.core.RepositoryProviderType;
+
+public class CVSRepositoryProviderType extends RepositoryProviderType {
+
+ private static CVSRepositoryProviderType instance;
+
+ public CVSRepositoryProviderType() {
+ instance = this;
+ }
+
+ /*
+ * Returns the one and only instance of the CVS repository type.
+ */
+ public static CVSRepositoryProviderType getInstance() {
+ return instance;
+ }
+
+ /*
+ * @see RepositoryProviderType#getID()
+ */
+ public String getID() {
+ return CVSProviderPlugin.getTypeId();
+ }
+}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProvider.java
index 7242e206e..c72db56e1 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProvider.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProvider.java
@@ -24,7 +24,6 @@ import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -33,11 +32,9 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-import org.eclipse.team.ccvs.core.*;
import org.eclipse.team.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.ccvs.core.CVSStatus;
import org.eclipse.team.ccvs.core.CVSTag;
-import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSFolder;
import org.eclipse.team.ccvs.core.ICVSListener;
import org.eclipse.team.ccvs.core.ICVSProvider;
@@ -45,8 +42,8 @@ import org.eclipse.team.ccvs.core.ICVSRemoteFolder;
import org.eclipse.team.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.ccvs.core.IConnectionMethod;
import org.eclipse.team.core.IFileTypeRegistry;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.client.Checkout;
@@ -166,8 +163,8 @@ public class CVSProvider implements ICVSProvider {
IProject project = projects[i];
// Register the project with Team
// (unless the project already has the proper nature from the project meta-information)
- if (!project.getDescription().hasNature(CVSProviderPlugin.NATURE_ID)) {
- TeamPlugin.getManager().setProvider(project, CVSProviderPlugin.NATURE_ID, null, Policy.subMonitorFor(monitor, 10));
+ if (!project.getDescription().hasNature(CVSProviderPlugin.getTypeId())) {
+ TeamPlugin.addNatureToProject(project, CVSProviderPlugin.getTypeId(), Policy.subMonitorFor(monitor, 100));
}
}
@@ -460,8 +457,8 @@ public class CVSProvider implements ICVSProvider {
// Register the project with Team
// (unless the project already has the proper nature from the project meta-information)
try {
- if (!project.getDescription().hasNature(CVSProviderPlugin.NATURE_ID)) {
- TeamPlugin.getManager().setProvider(project, CVSProviderPlugin.NATURE_ID, null, Policy.subMonitorFor(monitor, 1));
+ if (!project.getDescription().hasNature(CVSProviderPlugin.getTypeId())) {
+ TeamPlugin.addNatureToProject(project, CVSProviderPlugin.getTypeId(), Policy.subMonitorFor(monitor, 1));
}
} catch (CoreException e) {
throw wrapException(e);
@@ -537,8 +534,8 @@ public class CVSProvider implements ICVSProvider {
// Register the project with Team
// (unless the project already has the proper nature from the project meta-information)
try {
- if (!project.getDescription().hasNature(CVSProviderPlugin.NATURE_ID))
- TeamPlugin.getManager().setProvider(project, CVSProviderPlugin.NATURE_ID, null, monitor);
+ if (!project.getDescription().hasNature(CVSProviderPlugin.getTypeId()))
+ TeamPlugin.addNatureToProject(project, CVSProviderPlugin.getTypeId(), monitor);
} catch (CoreException e) {
throw wrapException(e);
}
@@ -583,11 +580,9 @@ public class CVSProvider implements ICVSProvider {
// If the file did not exist, then prime the list of repositories with
// the providers with which the projects in the workspace are shared.
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < projects.length; i++) {
- ITeamProvider provider = manager.getProvider(projects[i]);
- if (provider instanceof CVSTeamProvider) {
- CVSTeamProvider cvsProvider = (CVSTeamProvider)provider;
+ RepositoryProvider provider = RepositoryProviderType.getProvider(projects[i]);
+ if (provider!=null && provider.isOfType(CVSProviderPlugin.getTypeId())) {
ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(projects[i]);
FolderSyncInfo info = folder.getFolderSyncInfo();
if (info != null) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
index 7d651678f..d67375238 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
@@ -5,6 +5,10 @@ package org.eclipse.team.ccvs.core;
* All Rights Reserved.
*/
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
@@ -13,11 +17,13 @@ import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPluginDescriptor;
+import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSProvider;
import org.eclipse.team.internal.ccvs.core.Policy;
@@ -62,7 +68,7 @@ public class CVSProviderPlugin extends Plugin {
*
* @see org.eclipse.core.resources.IProject#hasNature
*/
- public static final String NATURE_ID = ID + ".cvsnature"; //$NON-NLS-1$
+ private static final String NATURE_ID = ID + ".cvsnature"; //$NON-NLS-1$
/**
* Constructor for CVSProviderPlugin.
@@ -102,6 +108,13 @@ public class CVSProviderPlugin extends Plugin {
}
/**
+ * Answers the repository provider type id for the cvs plugin
+ */
+ public static String getTypeId() {
+ return NATURE_ID;
+ }
+
+ /**
* Should the CVS adapter prune empty directories
*/
public boolean getPruneEmptyDirectories() {
@@ -188,8 +201,8 @@ public class CVSProviderPlugin extends Plugin {
if (resource.getType() == IResource.PROJECT) {
IProject project = (IProject)resource;
// Get the team provider for the project and
- ITeamProvider provider = TeamPlugin.getManager().getProvider(project);
- if (!(provider instanceof CVSTeamProvider)) continue;
+ RepositoryProvider provider = RepositoryProviderType.getProvider(project);
+ if(provider==null || !provider.isOfType(NATURE_ID)) continue;
/* Check if the project description changed. */
if ((delta.getFlags() & IResourceDelta.DESCRIPTION) != 0) {
/* The project description changed. Write the file. */
@@ -262,6 +275,39 @@ public class CVSProviderPlugin extends Plugin {
public void setFetchAbsentDirectories(boolean fetchAbsentDirectories) {
this.fetchAbsentDirectories = fetchAbsentDirectories;
}
+
+ private static List listeners = new ArrayList();
+
+ /*
+ * @see ITeamManager#addResourceStateChangeListener(IResourceStateChangeListener)
+ */
+ public static void addResourceStateChangeListener(IResourceStateChangeListener listener) {
+ listeners.add(listener);
+ }
+ /*
+ * @see ITeamManager#removeResourceStateChangeListener(IResourceStateChangeListener)
+ */
+ public static void removeResourceStateChangeListener(IResourceStateChangeListener listener) {
+ listeners.remove(listener);
+ }
+
+ /*
+ * @see ITeamManager#broadcastResourceStateChanges(IResource[])
+ */
+ public static void broadcastResourceStateChanges(final IResource[] resources) {
+ for(Iterator it=listeners.iterator(); it.hasNext();) {
+ final IResourceStateChangeListener listener = (IResourceStateChangeListener)it.next();
+ ISafeRunnable code = new ISafeRunnable() {
+ public void run() throws Exception {
+ listener.resourceStateChanged(resources);
+ }
+ public void handleException(Throwable e) {
+ // don't log the exception....it is already being logged in Platform#run
+ }
+ };
+ Platform.run(code);
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
index 8ed13506d..4b96083e1 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
@@ -17,7 +17,6 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Properties;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -33,8 +32,8 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.team.core.IFileTypeRegistry;
-import org.eclipse.team.core.ITeamNature;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.core.sync.IRemoteSyncElement;
@@ -89,7 +88,7 @@ import org.eclipse.team.internal.ccvs.core.util.Assert;
* We currently write the files to disk and do a refreshLocal to
* have them appear in Eclipse. This may be changed in the future.
*/
-public class CVSTeamProvider implements ITeamNature, ITeamProvider {
+public class CVSTeamProvider extends RepositoryProvider {
private static final int CR_BYTE = 0x0D;
private static final int LF_BYTE = 0x0A;
private static final boolean IS_CRLF_PLATFORM = Arrays.equals(
@@ -106,11 +105,7 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
public CVSTeamProvider() {
}
- /**
- * @see IProjectNature#configure()
- */
- public void configure() throws CoreException {
- }
+
/**
* @see IProjectNature#deconfigure()
@@ -125,11 +120,7 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
return project;
}
- /**
- * @see ITeamNature#configureProvider(Properties)
- */
- public void configureProvider(Properties configuration) throws TeamException {
- }
+
/**
* @see IProjectNature#setProject(IProject)
@@ -148,15 +139,7 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
}
}
- /**
- * @see ITeamNature#getProvider()
- */
- public ITeamProvider getProvider() throws TeamException {
- if (workspaceRoot == null) {
- throw new TeamException(new Status(IStatus.ERROR, CVSProviderPlugin.ID, TeamException.UNABLE, Policy.bind("CVSTeamProvider.initializationFailed", new Object[]{project.getName()}), null)); //$NON-NLS-1$
- }
- return this;
- }
+
/**
* Add the given resources to the project.
@@ -422,12 +405,11 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
// Build the arguments list
String[] arguments = getValidArguments(resources, options);
- IStatus status;
Session s = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot());
progress.beginTask(null, 100);
try {
s.open(Policy.subMonitorFor(progress, 20));
- status = Command.DIFF.execute(s,
+ Command.DIFF.execute(s,
Command.NO_GLOBAL_OPTIONS,
options,
arguments,
@@ -979,7 +961,13 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
// and creating an array of IStatus!
return new Status(IStatus.ERROR, CVSProviderPlugin.ID, TeamException.UNABLE, getMessageFor(e), e);
}
-
+
+ public RepositoryProviderType getProviderType() {
+ return CVSRepositoryProviderType.getInstance();
+ }
+
+ public void configureProject() throws CoreException {
+ }
/**
* Sets the keyword substitution mode for the specified resources.
* <p>
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IResourceStateChangeListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IResourceStateChangeListener.java
index f6af03595..d75dcba64 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IResourceStateChangeListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IResourceStateChangeListener.java
@@ -1,4 +1,4 @@
-package org.eclipse.team.core;
+package org.eclipse.team.ccvs.core;
/*
* (c) Copyright IBM Corp. 2000, 2001.
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java
index 61ec5d373..2f81af991 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java
@@ -123,7 +123,7 @@ abstract class EclipseResource implements ICVSResource {
} catch(CVSException e) {
cvsIgnorePatterns = null;
}
- IIgnoreInfo[] ignorePatterns = TeamPlugin.getManager().getGlobalIgnore();
+ IIgnoreInfo[] ignorePatterns = TeamPlugin.getPlugin().getGlobalIgnore();
for (int i = 0; i < ignorePatterns.length; i++) {
IIgnoreInfo info = ignorePatterns[i];
if(info.getEnabled()) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
index a8a129925..00ec5b04b 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
@@ -156,7 +156,7 @@ public class EclipseSynchronizer {
// broadcast changes to unmanaged children - they are the only candidates for being ignored
List possibleIgnores = new ArrayList();
accumulateNonManagedChildren(resource, possibleIgnores);
- TeamPlugin.getManager().broadcastResourceStateChanges((IResource[])possibleIgnores.toArray(new IResource[possibleIgnores.size()]));
+ CVSProviderPlugin.broadcastResourceStateChanges((IResource[])possibleIgnores.toArray(new IResource[possibleIgnores.size()]));
}
private void accumulateNonManagedChildren(IContainer folder, List possibleIgnores) throws CVSException {
@@ -265,7 +265,7 @@ public class EclipseSynchronizer {
changedResources.addAll(changedFolders);
IResource[] resources = (IResource[]) changedResources.toArray(
new IResource[changedResources.size()]);
- TeamPlugin.getManager().broadcastResourceStateChanges(resources);
+ CVSProviderPlugin.broadcastResourceStateChanges(resources);
changedResources.clear();
changedFolders.clear();
} finally {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
index 23c28497e..68510d18b 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
@@ -566,8 +566,6 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
try {
children = new ICVSRemoteResource[] {child};
- final IProgressMonitor progress = Policy.monitorFor(monitor);
-
// Create the listener for remote files and folders
final boolean[] exists = new boolean[] {true};
IUpdateMessageListener listener = new IUpdateMessageListener() {
@@ -601,7 +599,7 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
s.open(monitor);
try {
// Perform a "cvs -n update -d -r tagName fileName" with custom message and error handlers
- IStatus status = Command.UPDATE.execute(s,
+ Command.UPDATE.execute(s,
new GlobalOption[] { Command.DO_NOT_CHANGE },
(LocalOption[]) localOptions.toArray(new LocalOption[localOptions.size()]),
new String[] { child.getName() },
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionManager.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionManager.java
index d2acb009b..7352733c7 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionManager.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionManager.java
@@ -27,7 +27,8 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.team.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.CVSException;
@@ -147,9 +148,9 @@ public class ProjectDescriptionManager {
Util.logError(Policy.bind("ProjectDescriptionManager.unableToSetDescription"), ex); //$NON-NLS-1$
}
// Make sure we have the cvs nature (the above read may have removed it)
- if (!project.getDescription().hasNature(CVSProviderPlugin.NATURE_ID)) {
+ if (!project.getDescription().hasNature(CVSProviderPlugin.getTypeId())) {
try {
- TeamPlugin.getManager().setProvider(project, CVSProviderPlugin.NATURE_ID, null, progress);
+ TeamPlugin.addNatureToProject(project, CVSProviderPlugin.getTypeId(), progress);
} catch (TeamException ex) {
// Failing to set the provider is probably due to a missing nature.
// Other natures are still set
@@ -196,9 +197,8 @@ public class ProjectDescriptionManager {
IResource resource = delta.getResource();
if (resource.getType() == IResource.PROJECT) {
IProject project = (IProject)resource;
- ITeamProvider provider = TeamPlugin.getManager().getProvider(project);
- if (! (provider instanceof CVSTeamProvider))
- continue;
+ RepositoryProvider provider = RepositoryProviderType.getProvider(project);
+ if (provider!=null && !provider.isOfType(CVSProviderPlugin.getTypeId())) continue;
// First, check if the .vcm_meta file for the project is in the delta.
IResourceDelta[] children = delta.getAffectedChildren(IResourceDelta.REMOVED | IResourceDelta.ADDED | IResourceDelta.CHANGED);
boolean inSync = false;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionWriter.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionWriter.java
index edb34000f..ae1a44687 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionWriter.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionWriter.java
@@ -70,7 +70,7 @@ public class ProjectDescriptionWriter {
String[] natures = desc.getNatureIds();
for (int i = 0; i < natures.length; i++) {
- if ( ! natures[i].equals(CVSProviderPlugin.NATURE_ID))
+ if ( ! natures[i].equals(CVSProviderPlugin.getTypeId()))
writer.println("\t<nature id=\"" + getEscaped(natures[i]) + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceDeltaSyncHandler.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceDeltaSyncHandler.java
index 3dfe66858..0058a9bbc 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceDeltaSyncHandler.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceDeltaSyncHandler.java
@@ -17,11 +17,10 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.team.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSFile;
import org.eclipse.team.ccvs.core.ICVSFolder;
-import org.eclipse.team.core.ITeamProvider;
-import org.eclipse.team.core.TeamPlugin;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
@@ -196,16 +195,16 @@ public class ResourceDeltaSyncHandler implements IResourceDeltaVisitor {
for (int i = 0; i < projectDeltas.length; i++) {
IResourceDelta delta = projectDeltas[i];
IResource resource = delta.getResource();
- ITeamProvider provider = TeamPlugin.getManager().getProvider(resource);
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resource.getProject());
// if a project is moved the originating project will not be associated with the CVS provider
// however listeners will probably still be interested in the move delta.
if ((delta.getFlags() & IResourceDelta.MOVED_TO) > 0) {
IResource destination = getResourceFor(resource.getProject(), resource, delta.getMovedToPath());
- provider = TeamPlugin.getManager().getProvider(destination);
+ provider = RepositoryProviderType.getProvider(destination.getProject());
}
- if (provider instanceof CVSTeamProvider) {
+ if(provider!=null && provider.isOfType(CVSProviderPlugin.getTypeId())) {
delta.accept(visitor);
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceDeltaVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceDeltaVisitor.java
index e60be5be5..f35448889 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceDeltaVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResourceDeltaVisitor.java
@@ -20,9 +20,9 @@ import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.team.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.core.ITeamProvider;
-import org.eclipse.team.core.TeamPlugin;
+import org.eclipse.team.ccvs.core.CVSProviderPlugin;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.internal.ccvs.core.Policy;
public abstract class ResourceDeltaVisitor implements IResourceDeltaVisitor {
@@ -46,16 +46,17 @@ public abstract class ResourceDeltaVisitor implements IResourceDeltaVisitor {
for (int i = 0; i < projectDeltas.length; i++) {
IResourceDelta delta = projectDeltas[i];
IResource resource = delta.getResource();
- ITeamProvider provider = TeamPlugin.getManager().getProvider(resource);
+
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resource.getProject());
// if a project is moved the originating project will not be associated with the CVS provider
// however listeners will probably still be interested in the move delta.
if ((delta.getFlags() & IResourceDelta.MOVED_TO) > 0) {
IResource destination = getResourceFor(resource.getProject(), resource, delta.getMovedToPath());
- provider = TeamPlugin.getManager().getProvider(destination);
+ provider = RepositoryProviderType.getProvider(destination.getProject());
}
- if (provider instanceof CVSTeamProvider) {
+ if(provider != null && provider.isOfType(CVSProviderPlugin.getTypeId())) {
delta.accept(visitor);
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java
index fc2e6f167..01529f8c0 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java
@@ -32,9 +32,7 @@ import org.eclipse.team.ccvs.core.ICVSFile;
import org.eclipse.team.ccvs.core.ICVSRemoteFolder;
import org.eclipse.team.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.ccvs.core.ICVSResource;
-import org.eclipse.team.core.ITeamProvider;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
@@ -312,15 +310,6 @@ public class CVSCompareEditorInput extends CompareEditorInput {
try {
monitor.beginTask(Policy.bind("CVSCompareEditorInput.comparing"), 30);
- // get the CVS provider if one exists
- if (left instanceof ResourceNode) {
- IResource resource = ((ResourceNode)left).getResource();
- ITeamProvider p = TeamPlugin.getManager().getProvider(resource);
- if(p != null && p instanceof CVSTeamProvider) {
- cvsProvider = (CVSTeamProvider)p;
- }
- }
-
// do the diff
IProgressMonitor sub = new SubProgressMonitor(monitor, 30);
try {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java
index a5a3c6275..58025d4cf 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java
@@ -62,7 +62,6 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation;
public class CVSCompareRevisionsInput extends CompareEditorInput {
IFile resource;
- CVSTeamProvider provider;
ICVSRemoteFile currentEdition;
ILogEntry[] editions;
TableViewer viewer;
@@ -200,7 +199,6 @@ public class CVSCompareRevisionsInput extends CompareEditorInput {
public CVSCompareRevisionsInput(IFile resource, ILogEntry[] editions) {
super(new CompareConfiguration());
this.resource = resource;
- this.provider = (CVSTeamProvider)TeamPlugin.getManager().getProvider(resource.getProject());
this.editions = editions;
updateCurrentEdition();
initializeActions();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorationRunnable.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorationRunnable.java
index 7ba31ad73..f70481884 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorationRunnable.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorationRunnable.java
@@ -28,8 +28,8 @@ import org.eclipse.team.ccvs.core.ICVSFile;
import org.eclipse.team.ccvs.core.ICVSFolder;
import org.eclipse.team.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.ccvs.core.ICVSResource;
-import org.eclipse.team.core.ITeamProvider;
-import org.eclipse.team.core.TeamPlugin;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
@@ -117,8 +117,8 @@ public class CVSDecorationRunnable implements Runnable {
// with a CVS provider. This could happen if the team nature was removed
// between the time the decoration event was posted to the thread and the time
// the thread processes the decoration.
- ITeamProvider provider = TeamPlugin.getManager().getProvider(resource);
- if(!resource.exists() || provider==null || !(provider instanceof CVSTeamProvider)) {
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resource.getProject());
+ if(!resource.exists() || provider==null || !provider.isOfType(CVSProviderPlugin.getTypeId())) {
return null;
}
@@ -132,12 +132,12 @@ public class CVSDecorationRunnable implements Runnable {
}
// compute decorations
- CVSDecoration decoration = computeTextLabelFor(resource, isDirty, provider);
- decoration.setOverlays(computeLabelOverlaysFor(resource, isDirty, provider));
+ CVSDecoration decoration = computeTextLabelFor(resource, isDirty);
+ decoration.setOverlays(computeLabelOverlaysFor(resource, isDirty, (CVSTeamProvider)provider));
return decoration;
}
- private CVSDecoration computeTextLabelFor(IResource resource, boolean isDirty, ITeamProvider provider) {
+ private CVSDecoration computeTextLabelFor(IResource resource, boolean isDirty) {
Map bindings = new HashMap(3);
String format = ""; //$NON-NLS-1$
IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
@@ -213,7 +213,7 @@ public class CVSDecorationRunnable implements Runnable {
}
}
- private List computeLabelOverlaysFor(IResource resource, boolean isDirty, ITeamProvider provider) {
+ private List computeLabelOverlaysFor(IResource resource, boolean isDirty, CVSTeamProvider provider) {
List overlays = new ArrayList(3);
IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java
index 7f6313a2a..0f5d48760 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java
@@ -28,10 +28,11 @@ import org.eclipse.jface.viewers.LabelProviderChangedEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.team.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.core.IResourceStateChangeListener;
-import org.eclipse.team.core.ITeamProvider;
-import org.eclipse.team.core.TeamPlugin;
+import org.eclipse.team.ccvs.core.IResourceStateChangeListener;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.internal.ccvs.core.CVSProvider;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
@@ -95,9 +96,7 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
// thread that calculates the decoration for a resource
decoratorUpdateThread = new Thread(new CVSDecorationRunnable(this), "CVS"); //$NON-NLS-1$
decoratorUpdateThread.start();
-
- // listener for cvs state change (e.g. any sync info changes)
- TeamPlugin.getManager().addResourceStateChangeListener(this);
+ CVSProviderPlugin.addResourceStateChangeListener(this);
// listener for workspace resource changes
changeListener = new ChangeListener();
@@ -292,7 +291,7 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
return true;
}
});
- TeamPlugin.getManager().broadcastResourceStateChanges((IResource[]) resources.toArray(new IResource[resources.size()]));
+ CVSProviderPlugin.broadcastResourceStateChanges((IResource[]) resources.toArray(new IResource[resources.size()]));
} catch (CoreException e) {
}
}
@@ -326,8 +325,8 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
* will be ignored by the decorator.
*/
private static CVSTeamProvider getCVSProviderFor(IResource resource) {
- ITeamProvider p = TeamPlugin.getManager().getProvider(resource);
- if (p == null || !(p instanceof CVSTeamProvider)) {
+ RepositoryProvider p = RepositoryProviderType.getProvider(resource.getProject());
+ if (p == null || !p.isOfType(CVSProviderPlugin.getTypeId())) {
return null;
}
return (CVSTeamProvider) p;
@@ -392,7 +391,7 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
// unregister change listeners
changeListener.deregister();
- TeamPlugin.getManager().removeResourceStateChangeListener(this);
+ CVSProviderPlugin.removeResourceStateChangeListener(this);
// dispose of images created as overlays
decoratorNeedsUpdating.clear();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java
index 09affe19e..2832e082a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPropertiesPage.java
@@ -36,8 +36,8 @@ import org.eclipse.team.ccvs.core.ICVSFolder;
import org.eclipse.team.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.ccvs.core.IUserInfo;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.wizards.UpdateWizard;
import org.eclipse.ui.dialogs.PropertyPage;
@@ -202,7 +202,7 @@ public class CVSPropertiesPage extends PropertyPage {
private void initializeValues() {
passwordChanged = false;
- provider = (CVSTeamProvider)TeamPlugin.getManager().getProvider(project);
+ provider = (CVSTeamProvider)RepositoryProviderType.getProvider(project);
if (provider == null) return;
CVSWorkspaceRoot cvsRoot = provider.getCVSWorkspaceRoot();
@@ -242,7 +242,7 @@ public class CVSPropertiesPage extends PropertyPage {
}
private void initializeTag() {
- provider = (CVSTeamProvider)TeamPlugin.getManager().getProvider(project);
+ provider = (CVSTeamProvider)RepositoryProviderType.getProvider(project);
if (provider == null) return;
CVSWorkspaceRoot cvsRoot = provider.getCVSWorkspaceRoot();
try {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryDropAdapter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryDropAdapter.java
index 6d515cce9..498571788 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryDropAdapter.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryDropAdapter.java
@@ -7,19 +7,11 @@ package org.eclipse.team.internal.ccvs.ui;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.ViewerDropAdapter;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.team.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.core.ITeamProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.ui.part.ResourceTransfer;
public class HistoryDropAdapter extends ViewerDropAdapter {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
index 04a4ceabf..5d0071215 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
@@ -13,7 +13,6 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
@@ -58,15 +57,17 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.team.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.ccvs.core.CVSTag;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSRemoteFile;
import org.eclipse.team.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.ccvs.core.ILogEntry;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
+import org.eclipse.team.internal.ccvs.ui.CVSCompareRevisionsInput.HistoryLabelProvider;
import org.eclipse.team.internal.ccvs.ui.actions.OpenLogEntryAction;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.ISelectionListener;
@@ -639,8 +640,8 @@ public class HistoryView extends ViewPart implements ISelectionListener {
if (resource instanceof IFile) {
IFile file = (IFile)resource;
this.file = file;
- ITeamProvider teamProvider = TeamPlugin.getManager().getProvider(file.getProject());
- if (teamProvider != null && teamProvider instanceof CVSTeamProvider) {
+ RepositoryProvider teamProvider = RepositoryProviderType.getProvider(file.getProject());
+ if (teamProvider != null && teamProvider.isOfType(CVSProviderPlugin.getTypeId())) {
this.provider = (CVSTeamProvider)teamProvider;
try {
ICVSRemoteResource remoteResource = CVSWorkspaceRoot.getRemoteResourceFor(file);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java
index c929c56d8..463ae0dda 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java
@@ -36,9 +36,9 @@ import org.eclipse.team.ccvs.core.ICVSRemoteFile;
import org.eclipse.team.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.ccvs.core.ILogEntry;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.core.sync.IRemoteSyncElement;
import org.eclipse.team.internal.ccvs.core.client.Command;
@@ -496,7 +496,7 @@ public class RepositoryManager {
private Hashtable getProviderMapping(IResource[] resources) {
Hashtable result = new Hashtable();
for (int i = 0; i < resources.length; i++) {
- ITeamProvider provider = TeamPlugin.getManager().getProvider(resources[i].getProject());
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resources[i].getProject());
List list = (List)result.get(provider);
if (list == null) {
list = new ArrayList();
@@ -513,7 +513,7 @@ public class RepositoryManager {
private Hashtable getProviderMapping(IRemoteSyncElement[] elements) {
Hashtable result = new Hashtable();
for (int i = 0; i < elements.length; i++) {
- ITeamProvider provider = TeamPlugin.getManager().getProvider(elements[i].getLocal().getProject());
+ RepositoryProvider provider = RepositoryProviderType.getProvider(elements[i].getLocal().getProject());
List list = (List)result.get(provider);
if (list == null) {
list = new ArrayList();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagSelectionDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagSelectionDialog.java
index 8db8c5c52..109ee330c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagSelectionDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagSelectionDialog.java
@@ -38,8 +38,8 @@ import org.eclipse.swt.widgets.Tree;
import org.eclipse.team.ccvs.core.CVSTag;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSRemoteFolder;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.merge.ProjectElement;
import org.eclipse.team.internal.ccvs.ui.merge.TagElement;
@@ -201,7 +201,7 @@ public class TagSelectionDialog extends Dialog {
try {
monitor.beginTask(Policy.bind("TagSelectionDialog.fetching"), 100);
monitor.subTask(Policy.bind("TagSelectionDialog.preparing"));
- CVSTeamProvider provider = (CVSTeamProvider)TeamPlugin.getManager().getProvider(resource);
+ CVSTeamProvider provider = (CVSTeamProvider)RepositoryProviderType.getProvider(resource.getProject());
monitor.worked(50);
monitor.subTask(Policy.bind("TagSelectionDialog.fetching"));
tagTree.setInput(new ProjectElement((ICVSRemoteFolder)CVSWorkspaceRoot.getRemoteResourceFor(resource.getProject()), getShell()));
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
index c60407907..92333a316 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
@@ -18,10 +18,9 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSFolder;
import org.eclipse.team.ccvs.core.ICVSResource;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.ui.actions.TeamAction;
@@ -66,9 +65,8 @@ public class AddAction extends TeamAction {
protected boolean isEnabled() throws TeamException {
IResource[] resources = getSelectedResources();
if (resources.length == 0) return false;
- ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
- ITeamProvider provider = manager.getProvider(resources[i].getProject());
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resources[i].getProject());
if(provider == null) return false;
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
if(cvsResource.isFolder()) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
index 2f08cec9a..89e60d1b9 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
@@ -10,10 +10,9 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.ccvs.core.ICVSResource;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.wizards.BranchWizard;
import org.eclipse.team.ui.actions.TeamAction;
@@ -43,10 +42,9 @@ public class BranchAction extends TeamAction {
protected boolean isEnabled() throws TeamException {
IResource[] resources = getSelectedResources();
if (resources.length == 0) return false;
- ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
- ITeamProvider provider = manager.getProvider(resource.getProject());
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resource.getProject());
if (provider == null) return false;
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
if (resource.getType()!=IResource.PROJECT&&!cvsResource.isManaged()) return false;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
index 855420295..acedc7821 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
@@ -11,10 +11,9 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.team.ccvs.core.ICVSResource;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
@@ -52,10 +51,9 @@ public class CommitAction extends TeamAction {
protected boolean isEnabled() throws TeamException {
IResource[] resources = getSelectedResources();
if (resources.length == 0) return false;
- ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
- ITeamProvider provider = manager.getProvider(resource.getProject());
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resource.getProject());
if (provider == null) return false;
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
if (resource.getType()!=IResource.PROJECT&&!cvsResource.isManaged()) return false;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
index c64606197..69bda2d63 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
@@ -10,7 +10,6 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.compare.CompareUI;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
@@ -19,9 +18,8 @@ import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSFolder;
import org.eclipse.team.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.ccvs.core.ICVSResource;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
@@ -52,9 +50,6 @@ public class CompareWithRemoteAction extends TeamAction {
IResource[] resources = getSelectedResources();
if (resources.length != 1) return;
resource[0] = resources[0];
-
- CVSTeamProvider provider = (CVSTeamProvider)TeamPlugin.getManager().getProvider(resources[0].getProject());
-
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource[0]);
if (cvsResource.isFolder()) {
FolderSyncInfo folderInfo = ((ICVSFolder)cvsResource).getFolderSyncInfo();
@@ -104,8 +99,8 @@ public class CompareWithRemoteAction extends TeamAction {
protected boolean isEnabled() {
IResource[] resources = getSelectedResources();
if (resources.length != 1) return false;
- ITeamProvider provider = TeamPlugin.getManager().getProvider(resources[0].getProject());
- if (provider == null) return false;
+ CVSTeamProvider provider = (CVSTeamProvider)RepositoryProviderType.getProvider(resources[0].getProject());
+ if(provider==null) return false;
return provider.hasRemote(resources[0]);
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
index 3a1916e44..f697eab4f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
@@ -11,16 +11,13 @@ import org.eclipse.compare.CompareUI;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSRemoteFile;
import org.eclipse.team.ccvs.core.ICVSResource;
import org.eclipse.team.ccvs.core.ILogEntry;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.CVSCompareRevisionsInput;
import org.eclipse.team.internal.ccvs.ui.Policy;
@@ -35,7 +32,6 @@ public class CompareWithRevisionAction extends TeamAction {
if (resources.length != 1) return null;
if (!(resources[0] instanceof IFile)) return null;
IFile file = (IFile)resources[0];
- CVSTeamProvider provider = (CVSTeamProvider)TeamPlugin.getManager().getProvider(file.getProject());
try {
return (ICVSRemoteFile)CVSWorkspaceRoot.getRemoteResourceFor(file);
} catch (TeamException e) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
index a68fe38cc..42fef423b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
@@ -47,8 +47,6 @@ public class CompareWithTagAction extends TeamAction {
IResource[] resources = getSelectedResources();
if (resources.length != 1) return;
resource[0] = resources[0];
-
- CVSTeamProvider provider = (CVSTeamProvider)TeamPlugin.getManager().getProvider(resource[0].getProject());
TagSelectionDialog dialog = new TagSelectionDialog(getShell(), resource[0]);
dialog.setBlockOnOpen(true);
int result = dialog.open();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java
index 8fb198a4d..faef3e963 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java
@@ -12,9 +12,8 @@ import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard;
import org.eclipse.team.ui.actions.TeamAction;
@@ -32,9 +31,10 @@ public class GenerateDiffFileAction extends TeamAction {
*/
protected boolean checkSharing(IResource[] resources) throws CoreException {
for (int i = 0; i < resources.length; i++) {
- ITeamProvider provider = TeamPlugin.getManager().getProvider(resources[i]);
- if (!(provider instanceof CVSTeamProvider))
+ CVSTeamProvider provider = (CVSTeamProvider)RepositoryProviderType.getProvider(resources[i].getProject());
+ if (provider==null) {
return false;
+ }
}
return true;
}
@@ -43,7 +43,6 @@ public class GenerateDiffFileAction extends TeamAction {
*/
public void run(IAction action) {
final String title = Policy.bind("GenerateCVSDiff.title");
- final String message = Policy.bind("GenerateCVSDiff.pageTitle");
try {
final IResource[] resources = getSelectedResources();
if (!checkSharing(resources)) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
index c5151d216..5fe3662d7 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
@@ -6,16 +6,10 @@ package org.eclipse.team.internal.ccvs.ui.actions;
*/
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamProvider;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
-import org.eclipse.team.internal.ccvs.ui.merge.*;
import org.eclipse.team.internal.ccvs.ui.merge.MergeWizard;
import org.eclipse.team.ui.actions.TeamAction;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RemoveRootAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RemoveRootAction.java
index 0bb9cdcc4..cfa032c46 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RemoveRootAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RemoveRootAction.java
@@ -23,10 +23,9 @@ import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSProvider;
import org.eclipse.team.ccvs.core.ICVSRemoteFile;
import org.eclipse.team.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.ui.actions.TeamAction;
@@ -81,10 +80,9 @@ public class RemoveRootAction extends TeamAction {
// Check if any projects are shared with the repository
boolean shared = false;
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- ITeamManager manager = TeamPlugin.getManager();
for (int j = 0; j < projects.length; j++) {
- ITeamProvider teamProvider = manager.getProvider(projects[j]);
- if (teamProvider instanceof CVSTeamProvider) {
+ RepositoryProvider teamProvider = RepositoryProviderType.getProvider(projects[j]);
+ if (teamProvider.isOfType(CVSProviderPlugin.getTypeId())) {
CVSTeamProvider cvsProvider = (CVSTeamProvider)teamProvider;
if (cvsProvider.getCVSWorkspaceRoot().getRemoteLocation().equals(roots[i])) {
shared = true;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
index 3a628196d..49ceee52b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
@@ -16,13 +16,9 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
@@ -36,7 +32,6 @@ public class ReplaceWithRemoteAction extends ReplaceWithAction {
List targetResources = new ArrayList();
for (int i = 0; i < candidateResources.length; i++) {
IResource resource = candidateResources[i];
- CVSTeamProvider provider = (CVSTeamProvider)TeamPlugin.getManager().getProvider(resource.getProject());
if (isDirty(resource) && getConfirmOverwrite()) {
if (confirmOverwrite(Policy.bind("ReplaceWithRemoteAction.localChanges", resource.getName()))) {
targetResources.add(resource);
@@ -53,7 +48,7 @@ public class ReplaceWithRemoteAction extends ReplaceWithAction {
Iterator iterator = keySet.iterator();
while (iterator.hasNext()) {
IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- ITeamProvider provider = (ITeamProvider)iterator.next();
+ CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
List list = (List)table.get(provider);
IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
provider.get(providerResources, IResource.DEPTH_INFINITE, subMonitor);
@@ -69,9 +64,8 @@ public class ReplaceWithRemoteAction extends ReplaceWithAction {
protected boolean isEnabled() throws TeamException {
IResource[] resources = getSelectedResources();
if (resources.length == 0) return false;
- ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
- ITeamProvider provider = manager.getProvider(resources[i].getProject());
+ CVSTeamProvider provider = (CVSTeamProvider)RepositoryProviderType.getProvider(resources[i].getProject());
if (provider == null) return false;
if (!provider.hasRemote(resources[i])) return false;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
index 4d38aa370..cf0591a56 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
@@ -16,8 +16,8 @@ import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.ccvs.core.CVSTag;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.TagSelectionDialog;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
@@ -68,7 +68,7 @@ public class ReplaceWithTagAction extends ReplaceWithAction {
run(new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
try {
- CVSTeamProvider provider = (CVSTeamProvider)TeamPlugin.getManager().getProvider(resource[0].getProject());
+ CVSTeamProvider provider = (CVSTeamProvider)RepositoryProviderType.getProvider(resource[0].getProject());
monitor.beginTask(null, 100);
monitor.setTaskName(Policy.bind("ReplaceWithTagAction.replacing", tag[0].getName()));
provider.get(resource, IResource.DEPTH_INFINITE, tag[0], Policy.subMonitorFor(monitor, 100));
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java
index f78310986..6f189d74f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java
@@ -8,10 +8,11 @@ package org.eclipse.team.internal.ccvs.ui.actions;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.team.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSResource;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.client.Command;
@@ -50,15 +51,13 @@ public class SetKeywordSubstitutionAction extends TeamAction {
protected boolean isEnabled() throws TeamException {
IResource[] resources = getSelectedResources();
if (resources.length == 0) return false;
- ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
// resource must be local
if (! resource.isAccessible()) return false;
// provider must be CVS
- ITeamProvider provider = manager.getProvider(resource.getProject());
- if (provider == null) return false;
- if (! (provider instanceof CVSTeamProvider)) return false;
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resource.getProject());
+ if (provider == null || !provider.isOfType(CVSProviderPlugin.getTypeId())) return false;
// resource must either be a project, or it must be managed
if (resource.getType() != IResource.PROJECT) {
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
index 8d7ac36b2..beb36ca5f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
@@ -7,14 +7,10 @@ package org.eclipse.team.internal.ccvs.ui.actions;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IAction;
-import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSResource;
-import org.eclipse.team.core.ITeamProvider;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
import org.eclipse.team.ui.actions.TeamAction;
import org.eclipse.team.ui.sync.SyncView;
@@ -28,7 +24,6 @@ public class SyncAction extends TeamAction {
* Method declared on IActionDelegate.
*/
public void run(IAction action) {
- String title = Policy.bind("SyncAction.sync");
IResource[] resources = getSelectedResources();
SyncView view = (SyncView)CVSUIPlugin.getActivePage().findView(SyncView.VIEW_ID);
if (view == null) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
index 4aeae64f4..7959bf043 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
@@ -26,10 +26,9 @@ import org.eclipse.team.ccvs.core.CVSStatus;
import org.eclipse.team.ccvs.core.CVSTag;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSResource;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
@@ -114,10 +113,9 @@ public class TagAction extends TeamAction {
protected boolean isEnabled() throws TeamException {
IResource[] resources = getSelectedResources();
if (resources.length == 0) return false;
- ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
- ITeamProvider provider = manager.getProvider(resource.getProject());
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resource.getProject());
if (provider == null) return false;
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
if (resource.getType()!=IResource.PROJECT&&!cvsResource.isManaged()) return false;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java
index 86d52a96b..c4d791a63 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java
@@ -6,7 +6,6 @@ package org.eclipse.team.internal.ccvs.ui.actions;
*/
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
@@ -34,9 +33,8 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSFolder;
-import org.eclipse.team.ccvs.core.ICVSResource;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
@@ -163,7 +161,7 @@ public class UnmanageAction extends TeamAction {
if(deleteContent) {
folder.unmanage();
}
- TeamPlugin.getManager().removeProvider((IProject)resource, Policy.subMonitorFor(subMonitor, 10));
+ TeamPlugin.removeNatureFromProject((IProject)resource, CVSProviderPlugin.getTypeId(), Policy.subMonitorFor(subMonitor, 10));
CVSDecorator.refresh(resource);
}
}
@@ -195,10 +193,9 @@ public class UnmanageAction extends TeamAction {
protected boolean isEnabled() throws TeamException {
IResource[] resources = getSelectedResources();
if (resources.length == 0) return false;
- ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
if(resources[i].getType()!=IResource.PROJECT) return false;
- ITeamProvider provider = manager.getProvider(resources[i].getProject());
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resources[i].getProject());
if (provider == null) return false;
ICVSFolder project = CVSWorkspaceRoot.getCVSFolderFor((IContainer)resources[i]);
if (!project.isCVSFolder()) return false;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java
index ba3af11c5..e858498d9 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java
@@ -18,10 +18,9 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSFolder;
import org.eclipse.team.ccvs.core.ICVSResource;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
@@ -71,10 +70,9 @@ public class UpdateAction extends TeamAction {
protected boolean isEnabled() throws TeamException {
IResource[] resources = getSelectedResources();
if (resources.length == 0) return false;
- ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
- ITeamProvider provider = manager.getProvider(resource.getProject());
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resource.getProject());
if (provider == null) return false;
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
ResourceSyncInfo info = cvsResource.getSyncInfo();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardEndPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardEndPage.java
index 5513b098b..97a9f0c1d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardEndPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardEndPage.java
@@ -19,10 +19,8 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.team.ccvs.core.CVSTag;
-import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSRemoteFolder;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.wizards.CVSWizardPage;
@@ -34,7 +32,6 @@ public class MergeWizardEndPage extends CVSWizardPage {
TreeViewer tree;
CVSTag result;
ICVSRemoteFolder remote;
- CVSTeamProvider provider;
/**
* MergeWizardEndPage constructor.
@@ -97,7 +94,6 @@ public class MergeWizardEndPage extends CVSWizardPage {
public void setProject(IProject project) {
this.project = project;
try {
- this.provider = ((CVSTeamProvider)TeamPlugin.getManager().getProvider(project));
this.remote = (ICVSRemoteFolder) CVSWorkspaceRoot.getRemoteResourceFor(project);
} catch (TeamException e) {
// To do
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/UpdateSyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/UpdateSyncAction.java
index 6e4b86717..996a467e5 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/UpdateSyncAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/UpdateSyncAction.java
@@ -159,7 +159,6 @@ public class UpdateSyncAction extends MergeAction {
}
ITeamNode changedNode = changed[i];
int kind = changedNode.getKind();
- IResource resource = changedNode.getResource();
switch (kind & Differencer.DIRECTION_MASK) {
case ITeamNode.INCOMING:
switch (kind & Differencer.CHANGE_TYPE_MASK) {
@@ -237,6 +236,7 @@ public class UpdateSyncAction extends MergeAction {
while (it.hasNext()) {
ITeamNode node = (ITeamNode)it.next();
CVSRemoteSyncElement element = CVSSyncCompareInput.getSyncElementFrom(node);
+ element.makeIncoming(monitor);
}
// Outgoing additions must be unmanaged (if necessary) and locally deleted.
it = deletions.iterator();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java
index 3da8f6c04..9aa07a9b5 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java
@@ -24,9 +24,9 @@ import org.eclipse.team.ccvs.core.CVSTag;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
import org.eclipse.team.ccvs.core.ICVSRemoteFolder;
import org.eclipse.team.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
@@ -133,7 +133,7 @@ public class BranchWizard extends Wizard {
private Hashtable getProviderMapping(IResource[] resources) {
Hashtable result = new Hashtable();
for (int i = 0; i < resources.length; i++) {
- ITeamProvider provider = TeamPlugin.getManager().getProvider(resources[i].getProject());
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resources[i].getProject());
List list = (List)result.get(provider);
if (list == null) {
list = new ArrayList();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileOperation.java
index b1933da80..27dd8a0fc 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileOperation.java
@@ -15,7 +15,6 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
@@ -24,10 +23,9 @@ import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
/**
@@ -55,11 +53,7 @@ public class GenerateDiffFileOperation implements IRunnableWithProgress {
* @see IRunnableWithProgress#run(IProgressMonitor)
*/
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- MultiStatus result = new MultiStatus(CVSUIPlugin.ID, 1, Policy.bind("GenerateCVSDiff.error"), null);
try {
- if (resources == null)
- return;
-
monitor.beginTask("", resources.length * 500);
monitor.setTaskName(
Policy.bind("GenerateCVSDiff.working"));
@@ -73,7 +67,7 @@ public class GenerateDiffFileOperation implements IRunnableWithProgress {
try {
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
- CVSTeamProvider provider = (CVSTeamProvider)TeamPlugin.getManager().getProvider(resource);
+ CVSTeamProvider provider = (CVSTeamProvider)RepositoryProviderType.getProvider(resource.getProject());
provider.diff(new IResource[] {resource}, options, new PrintStream(os), new SubProgressMonitor(monitor, 500));
}
} finally {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SetKeywordSubstitutionOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SetKeywordSubstitutionOperation.java
index 3a66af8b0..734b52ed4 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SetKeywordSubstitutionOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SetKeywordSubstitutionOperation.java
@@ -22,7 +22,8 @@ import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.ccvs.core.CVSStatus;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
@@ -115,7 +116,7 @@ public class SetKeywordSubstitutionOperation implements IRunnableWithProgress {
protected Hashtable getProviderMapping(IResource[] resources) {
Hashtable result = new Hashtable();
for (int i = 0; i < resources.length; i++) {
- ITeamProvider provider = TeamPlugin.getManager().getProvider(resources[i].getProject());
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resources[i].getProject());
List list = (List)result.get(provider);
if (list == null) {
list = new ArrayList();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java
index c5cbd6eb7..0e2366316 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java
@@ -17,6 +17,7 @@ import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.team.ccvs.core.CVSTeamProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.CVSException;
@@ -62,7 +63,7 @@ public class UpdateWizard extends Wizard {
getContainer().run(false, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
- CVSTeamProvider provider = ((CVSTeamProvider)TeamPlugin.getManager().getProvider(project));
+ CVSTeamProvider provider = ((CVSTeamProvider)RepositoryProviderType.getProvider(project));
provider.update(new IResource[] {project}, updatePage.getLocalOptions(), updatePage.getTag(), null, monitor);
result[0] = true;
} catch (TeamException e) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IgnorePreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IgnorePreferencePage.java
index 7b61a8eb0..dc44fe607 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IgnorePreferencePage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IgnorePreferencePage.java
@@ -1,4 +1,4 @@
package org.eclipse.team.internal.ui; /* * (c) Copyright IBM Corp. 2000, 2002. * All Rights Reserved. */ import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableItem; import org.eclipse.team.core.IIgnoreInfo; import org.eclipse.team.core.TeamPlugin; import org.eclipse.team.ui.TeamUIPlugin; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage;
public class IgnorePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { private Table ignoreTable; private Button addButton; private Button removeButton;
- public void init(IWorkbench workbench) { setDescription(Policy.bind("IgnorePreferencePage.description")); } /** * Creates preference page controls on demand. * * @param parent the parent for the preference page */ protected Control createContents(Composite ancestor) { noDefaultAndApplyButton(); Composite parent = new Composite(ancestor, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 2; parent.setLayout(layout); // set F1 help //WorkbenchHelp.setHelp(parent, new DialogPageContextComputer (this, IVCMHelpContextIds.IGNORE_PREFERENCE_PAGE)); Label l1 = new Label(parent, SWT.NULL); l1.setText(Policy.bind("IgnorePreferencePage.ignorePatterns")); GridData data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); data.horizontalSpan = 2; l1.setLayoutData(data); ignoreTable = new Table(parent, SWT.CHECK | SWT.BORDER); GridData gd = new GridData(GridData.FILL_BOTH); gd.widthHint= convertWidthInCharsToPixels(30); ignoreTable.setLayoutData(gd); ignoreTable.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { handleSelection(); } }); Composite buttons = new Composite(parent, SWT.NULL); buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); buttons.setLayout(new GridLayout()); addButton = new Button(buttons, SWT.PUSH); addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); addButton.setText(Policy.bind("IgnorePreferencePage.add")); addButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { addIgnore(); } }); removeButton = new Button(buttons, SWT.PUSH); removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); removeButton.setText(Policy.bind("IgnorePreferencePage.remove")); removeButton.setEnabled(false); removeButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { removeIgnore(); } }); fillTable(); return parent; } /** * Do anything necessary because the OK button has been pressed. * * @return whether it is okay to close the preference page */ public boolean performOk() { int count = ignoreTable.getItemCount(); String[] patterns = new String[count]; boolean[] enabled = new boolean[count]; TableItem[] items = ignoreTable.getItems(); for (int i = 0; i < count; i++) { patterns[i] = items[i].getText(); enabled[i] = items[i].getChecked(); } TeamPlugin.getManager().setGlobalIgnore(patterns, enabled); TeamUIPlugin.getPlugin().broadcastPropertyChange(new PropertyChangeEvent(TeamUIPlugin.getPlugin(), TeamUIPlugin.GLOBAL_IGNORES_CHANGED, null, null)); return true; } private void fillTable() { IIgnoreInfo[] ignore = TeamPlugin.getManager().getGlobalIgnore(); for (int i = 0; i < ignore.length; i++) { IIgnoreInfo info = ignore[i]; TableItem item = new TableItem(ignoreTable, SWT.NONE); item.setText(info.getPattern()); item.setChecked(info.getEnabled()); } } private void addIgnore() { InputDialog dialog = new InputDialog(getShell(), Policy.bind("IgnorePreferencePage.enterPatternShort"), Policy.bind("IgnorePreferencePage.enterPatternLong"), null, null); dialog.open(); if (dialog.getReturnCode() != InputDialog.OK) return; String pattern = dialog.getValue(); if (pattern.equals("")) return; // Check if the item already exists TableItem[] items = ignoreTable.getItems(); for (int i = 0; i < items.length; i++) { if (items[i].getText().equals(pattern)) { MessageDialog.openWarning(getShell(), Policy.bind("IgnorePreferencePage.patternExistsShort"), Policy.bind("IgnorePreferencePage.patternExistsLong")); return; } } TableItem item = new TableItem(ignoreTable, SWT.NONE); item.setText(pattern); item.setChecked(true); } private void removeIgnore() { int[] selection = ignoreTable.getSelectionIndices(); ignoreTable.remove(selection); } private void handleSelection() { if (ignoreTable.getSelectionCount() > 0) { removeButton.setEnabled(true); } else { removeButton.setEnabled(false); } }
+ public void init(IWorkbench workbench) { setDescription(Policy.bind("IgnorePreferencePage.description")); } /** * Creates preference page controls on demand. * * @param parent the parent for the preference page */ protected Control createContents(Composite ancestor) { noDefaultAndApplyButton(); Composite parent = new Composite(ancestor, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 2; parent.setLayout(layout); // set F1 help //WorkbenchHelp.setHelp(parent, new DialogPageContextComputer (this, IVCMHelpContextIds.IGNORE_PREFERENCE_PAGE)); Label l1 = new Label(parent, SWT.NULL); l1.setText(Policy.bind("IgnorePreferencePage.ignorePatterns")); GridData data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); data.horizontalSpan = 2; l1.setLayoutData(data); ignoreTable = new Table(parent, SWT.CHECK | SWT.BORDER); GridData gd = new GridData(GridData.FILL_BOTH); gd.widthHint= convertWidthInCharsToPixels(30); ignoreTable.setLayoutData(gd); ignoreTable.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { handleSelection(); } }); Composite buttons = new Composite(parent, SWT.NULL); buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); buttons.setLayout(new GridLayout()); addButton = new Button(buttons, SWT.PUSH); addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); addButton.setText(Policy.bind("IgnorePreferencePage.add")); addButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { addIgnore(); } }); removeButton = new Button(buttons, SWT.PUSH); removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); removeButton.setText(Policy.bind("IgnorePreferencePage.remove")); removeButton.setEnabled(false); removeButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { removeIgnore(); } }); fillTable(); return parent; } /** * Do anything necessary because the OK button has been pressed. * * @return whether it is okay to close the preference page */ public boolean performOk() { int count = ignoreTable.getItemCount(); String[] patterns = new String[count]; boolean[] enabled = new boolean[count]; TableItem[] items = ignoreTable.getItems(); for (int i = 0; i < count; i++) { patterns[i] = items[i].getText(); enabled[i] = items[i].getChecked(); } TeamPlugin.getPlugin().setGlobalIgnore(patterns, enabled); TeamUIPlugin.getPlugin().broadcastPropertyChange(new PropertyChangeEvent(TeamUIPlugin.getPlugin(), TeamUIPlugin.GLOBAL_IGNORES_CHANGED, null, null)); return true; } private void fillTable() { IIgnoreInfo[] ignore = TeamPlugin.getPlugin().getGlobalIgnore(); for (int i = 0; i < ignore.length; i++) { IIgnoreInfo info = ignore[i]; TableItem item = new TableItem(ignoreTable, SWT.NONE); item.setText(info.getPattern()); item.setChecked(info.getEnabled()); } } private void addIgnore() { InputDialog dialog = new InputDialog(getShell(), Policy.bind("IgnorePreferencePage.enterPatternShort"), Policy.bind("IgnorePreferencePage.enterPatternLong"), null, null); dialog.open(); if (dialog.getReturnCode() != InputDialog.OK) return; String pattern = dialog.getValue(); if (pattern.equals("")) return; // Check if the item already exists TableItem[] items = ignoreTable.getItems(); for (int i = 0; i < items.length; i++) { if (items[i].getText().equals(pattern)) { MessageDialog.openWarning(getShell(), Policy.bind("IgnorePreferencePage.patternExistsShort"), Policy.bind("IgnorePreferencePage.patternExistsLong")); return; } } TableItem item = new TableItem(ignoreTable, SWT.NONE); item.setText(pattern); item.setChecked(true); } private void removeIgnore() { int[] selection = ignoreTable.getSelectionIndices(); ignoreTable.remove(selection); } private void handleSelection() { if (ignoreTable.getSelectionCount() > 0) { removeButton.setEnabled(true); } else { removeButton.setEnabled(false); } }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/CheckInAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/CheckInAction.java
index 90d834c1a..b12977fd0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/CheckInAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/CheckInAction.java
@@ -15,10 +15,10 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
+import org.eclipse.team.core.StandardOperations;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
@@ -40,10 +40,10 @@ public class CheckInAction extends TeamAction {
Iterator iterator = keySet.iterator();
while (iterator.hasNext()) {
IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- ITeamProvider provider = (ITeamProvider)iterator.next();
+ RepositoryProvider provider = (RepositoryProvider)iterator.next();
List list = (List)table.get(provider);
IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- provider.checkin(providerResources, IResource.DEPTH_INFINITE, subMonitor);
+ provider.getStandardOperations().checkin(providerResources, IResource.DEPTH_INFINITE, subMonitor);
}
} catch (TeamException e) {
throw new InvocationTargetException(e);
@@ -59,12 +59,12 @@ public class CheckInAction extends TeamAction {
protected boolean isEnabled() {
IResource[] resources = getSelectedResources();
if (resources.length == 0) return false;
- ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
- ITeamProvider provider = manager.getProvider(resources[i].getProject());
- if (provider == null) return false;
- if (!provider.isCheckedOut(resource)) return false;
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resource.getProject());
+ StandardOperations stdOps = provider.getStandardOperations();
+ if (provider == null || stdOps == null) return false;
+ if (!stdOps.isCheckedOut(resource)) return false;
}
return true;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/CheckOutAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/CheckOutAction.java
index 06a40f3e7..8085c2f79 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/CheckOutAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/CheckOutAction.java
@@ -15,10 +15,10 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
+import org.eclipse.team.core.StandardOperations;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
@@ -40,10 +40,10 @@ public class CheckOutAction extends TeamAction {
Iterator iterator = keySet.iterator();
while (iterator.hasNext()) {
IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- ITeamProvider provider = (ITeamProvider)iterator.next();
+ RepositoryProvider provider = (RepositoryProvider)iterator.next();
List list = (List)table.get(provider);
IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- provider.checkout(providerResources, IResource.DEPTH_ZERO, subMonitor);
+ provider.getStandardOperations().checkout(providerResources, IResource.DEPTH_ZERO, subMonitor);
}
} catch (TeamException e) {
throw new InvocationTargetException(e);
@@ -59,11 +59,12 @@ public class CheckOutAction extends TeamAction {
protected boolean isEnabled() throws TeamException {
IResource[] resources = getSelectedResources();
if (resources.length == 0) return false;
- ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
- ITeamProvider provider = manager.getProvider(resources[i].getProject());
- if (provider == null) return false;
- if (provider.isCheckedOut(resources[i])) return false;
+ IResource resource = resources[i];
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resource.getProject());
+ StandardOperations stdOps = provider.getStandardOperations();
+ if (provider == null || stdOps == null) return false;
+ if (stdOps.isCheckedOut(resource)) return false;
}
return true;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/ConfigureProjectAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/ConfigureProjectAction.java
index ec79c0a17..314f1e563 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/ConfigureProjectAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/ConfigureProjectAction.java
@@ -12,6 +12,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ui.ConfigureProjectWizard;
import org.eclipse.team.internal.ui.Policy;
@@ -47,7 +48,7 @@ public class ConfigureProjectAction extends TeamAction {
IProject[] selectedProjects = getSelectedProjects();
if (selectedProjects.length != 1) return false;
if (!selectedProjects[0].isAccessible()) return false;
- if (TeamPlugin.getManager().getProvider(selectedProjects[0]) == null) return true;
+ if (RepositoryProviderType.getProvider(selectedProjects[0]) == null) return true;
return false;
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/DeconfigureProjectAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/DeconfigureProjectAction.java
index 66649cc1d..36e8afa6a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/DeconfigureProjectAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/DeconfigureProjectAction.java
@@ -10,7 +10,7 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.TeamPlugin;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
@@ -26,8 +26,8 @@ public class DeconfigureProjectAction extends TeamAction {
run(new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
try {
- IProject project = getSelectedProjects()[0];
- TeamPlugin.getManager().removeProvider(project, monitor);
+ // should we use the id for the provider type and remove from the nature. Or would
+ // this operation be provider specific?
} catch (Exception e) {
throw new InvocationTargetException(e);
}
@@ -40,7 +40,7 @@ public class DeconfigureProjectAction extends TeamAction {
protected boolean isEnabled() {
IProject[] selectedProjects = getSelectedProjects();
if (selectedProjects.length != 1) return false;
- if (TeamPlugin.getManager().getProvider(selectedProjects[0]) == null) return false;
+ if (RepositoryProviderType.getProvider(selectedProjects[0]) != null) return false;
return true;
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/DeleteAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/DeleteAction.java
index fd2707296..699e4bd5f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/DeleteAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/DeleteAction.java
@@ -17,10 +17,10 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
+import org.eclipse.team.core.StandardOperations;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
@@ -50,10 +50,10 @@ public class DeleteAction extends TeamAction {
Iterator iterator = keySet.iterator();
while (iterator.hasNext()) {
IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- ITeamProvider provider = (ITeamProvider)iterator.next();
+ RepositoryProvider provider = (RepositoryProvider)iterator.next();
List list = (List)table.get(provider);
IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- provider.delete(providerResources, subMonitor);
+ provider.getStandardOperations().delete(providerResources, subMonitor);
for (int i = 0; i < providerResources.length; i++) {
providerResources[i].delete(true, monitor);
}
@@ -75,11 +75,12 @@ public class DeleteAction extends TeamAction {
protected boolean isEnabled() throws TeamException {
IResource[] resources = getSelectedResources();
if (resources.length == 0) return false;
- ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
- ITeamProvider provider = manager.getProvider(resources[i].getProject());
- if (provider == null) return false;
- if (!provider.hasRemote(resources[i])) return false;
+ IResource resource = resources[i];
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resource.getProject());
+ StandardOperations stdOps = provider.getStandardOperations();
+ if (provider == null || stdOps == null) return false;
+ if (!stdOps.hasRemote(resource)) return false;
}
return true;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/GetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/GetAction.java
index 94c01d814..6d5c70551 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/GetAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/GetAction.java
@@ -15,10 +15,10 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
+import org.eclipse.team.core.StandardOperations;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
@@ -40,10 +40,10 @@ public class GetAction extends TeamAction {
Iterator iterator = keySet.iterator();
while (iterator.hasNext()) {
IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- ITeamProvider provider = (ITeamProvider)iterator.next();
+ RepositoryProvider provider = (RepositoryProvider)iterator.next();
List list = (List)table.get(provider);
IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- provider.get(providerResources, IResource.DEPTH_INFINITE, subMonitor);
+ provider.getStandardOperations().get(providerResources, IResource.DEPTH_INFINITE, subMonitor);
}
} catch (TeamException e) {
throw new InvocationTargetException(e);
@@ -59,11 +59,12 @@ public class GetAction extends TeamAction {
protected boolean isEnabled() throws TeamException {
IResource[] resources = getSelectedResources();
if (resources.length == 0) return false;
- ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
- ITeamProvider provider = manager.getProvider(resources[i].getProject());
- if (provider == null) return false;
- if (!provider.hasRemote(resources[i])) return false;
+ IResource resource = resources[i];
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resource.getProject());
+ StandardOperations stdOps = provider.getStandardOperations();
+ if (provider == null || stdOps == null) return false;
+ if (!stdOps.hasRemote(resource)) return false;
}
return true;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/TeamAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/TeamAction.java
index 4343e3678..87e912e5d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/TeamAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/TeamAction.java
@@ -27,9 +27,9 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.ui.TeamUIPlugin;
import org.eclipse.ui.IObjectActionDelegate;
@@ -280,7 +280,7 @@ public abstract class TeamAction extends ActionDelegate implements IObjectAction
protected Hashtable getProviderMapping(IResource[] resources) {
Hashtable result = new Hashtable();
for (int i = 0; i < resources.length; i++) {
- ITeamProvider provider = TeamPlugin.getManager().getProvider(resources[i].getProject());
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resources[i].getProject());
List list = (List)result.get(provider);
if (list == null) {
list = new ArrayList();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/UndoCheckOutAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/UndoCheckOutAction.java
index bec3a81a7..437ebf987 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/UndoCheckOutAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/actions/UndoCheckOutAction.java
@@ -15,10 +15,10 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.ITeamManager;
-import org.eclipse.team.core.ITeamProvider;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.RepositoryProviderType;
+import org.eclipse.team.core.StandardOperations;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
@@ -40,10 +40,10 @@ public class UndoCheckOutAction extends TeamAction {
Iterator iterator = keySet.iterator();
while (iterator.hasNext()) {
IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- ITeamProvider provider = (ITeamProvider)iterator.next();
+ RepositoryProvider provider = (RepositoryProvider)iterator.next();
List list = (List)table.get(provider);
IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- provider.uncheckout(providerResources, IResource.DEPTH_ZERO, subMonitor);
+ provider.getStandardOperations().uncheckout(providerResources, IResource.DEPTH_ZERO, subMonitor);
}
} catch (TeamException e) {
throw new InvocationTargetException(e);
@@ -59,12 +59,13 @@ public class UndoCheckOutAction extends TeamAction {
protected boolean isEnabled() throws TeamException {
IResource[] resources = getSelectedResources();
if (resources.length == 0) return false;
- ITeamManager manager = TeamPlugin.getManager();
for (int i = 0; i < resources.length; i++) {
- ITeamProvider provider = manager.getProvider(resources[i].getProject());
- if (provider == null) return false;
- if (!provider.hasRemote(resources[i])) return false;
- if (!provider.isCheckedOut(resources[i])) return false;
+ IResource resource = resources[i];
+ RepositoryProvider provider = RepositoryProviderType.getProvider(resource.getProject());
+ StandardOperations stdOps = provider.getStandardOperations();
+ if (provider == null || stdOps == null) return false;
+ if (!stdOps.hasRemote(resource)) return false;
+ if (!stdOps.isCheckedOut(resource)) return false;
}
return true;
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/Print Averaged Log Summary.launch b/tests/org.eclipse.team.tests.cvs.core/Print Averaged Log Summary.launch
deleted file mode 100644
index b584d48d8..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/Print Averaged Log Summary.launch
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<launchConfiguration type="org.eclipse.jdt.debug.ui.localJavaApplication">
- <stringAttribute key="org.eclipse.debug.ui.target_debug_perspective" value="org.eclipse.debug.ui.DebugPerspective"/>
- <stringAttribute key="org.eclipse.jdt.debug.ui.MAIN_TYPE" value="org.eclipse.team.tests.ccvs.ui.logformatter.PrintAverageMain"/>
- <stringAttribute key="org.eclipse.jdt.debug.ui.VM_INSTALL_TYPE_ID" value="org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType"/>
- <stringAttribute key="org.eclipse.jdt.debug.ui.VM_INSTALL_ID" value="0"/>
- <stringAttribute key="org.eclipse.jdt.debug.ui.PROGRAM_ARGUMENTS" value="D:\Workspaces\teamui.xml"/>
- <booleanAttribute key="org.eclipse.jdt.debug.ui.BUILD_BEFORE_LAUNCH" value="false"/>
- <stringAttribute key="org.eclipse.jdt.debug.ui.PROJECT_ATTR" value="org.eclipse.team.tests.cvs.core"/>
-</launchConfiguration>
diff --git a/tests/org.eclipse.team.tests.cvs.core/Print Log Differences.launch b/tests/org.eclipse.team.tests.cvs.core/Print Log Differences.launch
deleted file mode 100644
index 1c443ffc3..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/Print Log Differences.launch
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<launchConfiguration type="org.eclipse.jdt.debug.ui.localJavaApplication">
- <stringAttribute key="org.eclipse.debug.ui.target_debug_perspective" value="org.eclipse.debug.ui.DebugPerspective"/>
- <stringAttribute key="org.eclipse.jdt.debug.ui.MAIN_TYPE" value="org.eclipse.team.tests.ccvs.ui.logformatter.PrintDiffMain"/>
- <stringAttribute key="org.eclipse.jdt.debug.ui.VM_INSTALL_TYPE_ID" value="org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType"/>
- <stringAttribute key="org.eclipse.jdt.debug.ui.VM_INSTALL_ID" value="0"/>
- <stringAttribute key="org.eclipse.jdt.debug.ui.PROGRAM_ARGUMENTS" value="-t 1 -i D:\Workspaces\teamui.xml D:\Workspaces\vcmui.xml"/>
- <booleanAttribute key="org.eclipse.jdt.debug.ui.BUILD_BEFORE_LAUNCH" value="false"/>
- <stringAttribute key="org.eclipse.jdt.debug.ui.PROJECT_ATTR" value="org.eclipse.team.tests.cvs.core"/>
-</launchConfiguration>
diff --git a/tests/org.eclipse.team.tests.cvs.core/Print Raw Log Summary.launch b/tests/org.eclipse.team.tests.cvs.core/Print Raw Log Summary.launch
deleted file mode 100644
index 88f83ba5a..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/Print Raw Log Summary.launch
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<launchConfiguration type="org.eclipse.jdt.debug.ui.localJavaApplication">
- <stringAttribute key="org.eclipse.debug.ui.target_debug_perspective" value="org.eclipse.debug.ui.DebugPerspective"/>
- <stringAttribute key="org.eclipse.jdt.debug.ui.MAIN_TYPE" value="org.eclipse.team.tests.ccvs.ui.logformatter.PrintRawMain"/>
- <stringAttribute key="org.eclipse.jdt.debug.ui.VM_INSTALL_TYPE_ID" value="org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType"/>
- <stringAttribute key="org.eclipse.jdt.debug.ui.VM_INSTALL_ID" value="0"/>
- <stringAttribute key="org.eclipse.jdt.debug.ui.PROGRAM_ARGUMENTS" value="D:\Workspaces\teamui.xml"/>
- <booleanAttribute key="org.eclipse.jdt.debug.ui.BUILD_BEFORE_LAUNCH" value="false"/>
- <stringAttribute key="org.eclipse.jdt.debug.ui.PROJECT_ATTR" value="org.eclipse.team.tests.cvs.core"/>
-</launchConfiguration>
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java
index 6db103257..84be67f13 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/CVSTestSetup.java
@@ -36,7 +36,7 @@ public class CVSTestSetup extends TestSetup {
}
public static void loadProperties() {
- String propertiesFile = System.getProperty("eclipse.cvs.properties");
+ String propertiesFile = "e:/repository.properties";
if (propertiesFile == null) return;
File file = new File(propertiesFile);
if (file.isDirectory()) file = new File(file, "repository.properties");
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
index 5e1b0f63c..5c4976f02 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
@@ -6,8 +6,6 @@ package org.eclipse.team.tests.ccvs.core;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@@ -36,8 +34,8 @@ import org.eclipse.team.ccvs.core.ICVSFolder;
import org.eclipse.team.ccvs.core.ICVSRemoteFile;
import org.eclipse.team.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.ccvs.core.ICVSResource;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSProvider;
import org.eclipse.team.internal.ccvs.core.client.Command;
@@ -224,9 +222,6 @@ public class EclipseTest extends EclipseWorkspaceTest {
* Checkout a copy of the project into a project with the given postfix
*/
protected IProject checkoutCopy(IProject project, String postfix) throws TeamException {
- // Get the provider and remote module so we can get the proper path for the module
- CVSTeamProvider provider = getProvider(project);
-
// Check the project out under a different name and validate that the results are the same
IProject copy = getWorkspace().getRoot().getProject(project.getName() + postfix);
CVSProviderPlugin.getProvider().checkout(getRepository(), copy, CVSWorkspaceRoot.getCVSFolderFor(project).getFolderSyncInfo().getRepository(), null, DEFAULT_MONITOR);
@@ -234,9 +229,6 @@ public class EclipseTest extends EclipseWorkspaceTest {
}
protected IProject checkoutCopy(IProject project, CVSTag tag) throws TeamException {
- // Get the provider and remote module so we can get the proper path for the module
- CVSTeamProvider provider = getProvider(project);
-
// Check the project out under a different name and validate that the results are the same
IProject copy = getWorkspace().getRoot().getProject(project.getName() + tag.getName());
CVSProviderPlugin.getProvider().checkout(getRepository(), copy,
@@ -258,7 +250,7 @@ public class EclipseTest extends EclipseWorkspaceTest {
*/
protected IProject createProject(String prefix, String[] resources) throws CoreException, TeamException {
IProject project = getUniqueTestProject(prefix);
- IResource[] result = buildResources(project, resources, true);
+ buildResources(project, resources, true);
shareProject(project);
assertValidCheckout(project);
return project;
@@ -438,7 +430,7 @@ public class EclipseTest extends EclipseWorkspaceTest {
protected void assertValidCheckout(IProject project) {
// NOTE: Add code to ensure that the project was checkout out properly
- CVSTeamProvider provider = (CVSTeamProvider)TeamPlugin.getManager().getProvider(project);
+ CVSTeamProvider provider = (CVSTeamProvider)RepositoryProviderType.getProvider(project);
assertNotNull(provider);
}
protected InputStream getContents(ICVSFile file) throws CVSException, IOException {
@@ -465,7 +457,7 @@ public class EclipseTest extends EclipseWorkspaceTest {
return target;
}
protected CVSTeamProvider getProvider(IResource resource) throws TeamException {
- return (CVSTeamProvider)TeamPlugin.getManager().getProvider(resource);
+ return (CVSTeamProvider)RepositoryProviderType.getProvider(resource.getProject());
}
protected static InputStream getRandomContents(int sizeAtLeast) {
StringBuffer randomStuff = new StringBuffer(sizeAtLeast + 100);

Back to the top