Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-06-13 22:13:59 +0000
committerMichael Valenta2002-06-13 22:13:59 +0000
commit05d6b610835949b0a17819487e60615ffd9b96e7 (patch)
tree453950f8cc929e04d083572919e8188338f051d0
parent15d7d0fe2adcbcae57a3fdd1a00058244e2f745d (diff)
downloadeclipse.platform.team-05d6b610835949b0a17819487e60615ffd9b96e7.tar.gz
eclipse.platform.team-05d6b610835949b0a17819487e60615ffd9b96e7.tar.xz
eclipse.platform.team-05d6b610835949b0a17819487e60615ffd9b96e7.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.core/.project1
-rw-r--r--bundles/org.eclipse.team.core/plugin.properties3
-rw-r--r--bundles/org.eclipse.team.core/plugin.xml1
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/IRepositoryMappingListener.java38
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java41
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/.project1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryMappingListener.java38
10 files changed, 134 insertions, 7 deletions
diff --git a/bundles/org.eclipse.team.core/.project b/bundles/org.eclipse.team.core/.project
index d81dc3af3..39d74e11c 100644
--- a/bundles/org.eclipse.team.core/.project
+++ b/bundles/org.eclipse.team.core/.project
@@ -16,6 +16,5 @@
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.team.cvs.core.cvsnature</nature>
</natures>
</projectDescription>
diff --git a/bundles/org.eclipse.team.core/plugin.properties b/bundles/org.eclipse.team.core/plugin.properties
index 539fdfdde..2b0627e48 100644
--- a/bundles/org.eclipse.team.core/plugin.properties
+++ b/bundles/org.eclipse.team.core/plugin.properties
@@ -4,4 +4,5 @@ FileTypesRegistry=File Types Registry
GlobalIgnoreRegistry=Global Ignore Registry
TeamProjectSets=Team Project Sets
Targets=Target Provider and Location Factories
-Repository=Repository Provider Factories \ No newline at end of file
+Repository=Repository Provider Factories
+RepositoryMapping=Repository Mapping Notification \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/plugin.xml b/bundles/org.eclipse.team.core/plugin.xml
index f8fa8503a..7175a11ae 100644
--- a/bundles/org.eclipse.team.core/plugin.xml
+++ b/bundles/org.eclipse.team.core/plugin.xml
@@ -21,6 +21,7 @@
<extension-point id="ignore" name="%GlobalIgnoreRegistry"/>
<extension-point id="projectSets" name="%TeamProjectSets"/>
<extension-point id="repository" name="%Repository"/>
+<extension-point id="repositoryMappingNotification" name="%RepositoryMapping"/>
<extension-point id="targets" name="%Targets"/>
<!-- Define common known file types -->
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IRepositoryMappingListener.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IRepositoryMappingListener.java
new file mode 100644
index 000000000..08df914b4
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IRepositoryMappingListener.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.team.core;
+
+import org.eclipse.core.resources.IProject;
+
+/**
+ * Instances of this interface can be registered with the repositoryMappingNotification
+ * extension point to receive notification when a repository provider is mapped/unmapped
+ * to/from a project.
+ */
+public interface IRepositoryMappingListener {
+
+ /**
+ * This method is invoked when a RepositoryProvider is mapped to a
+ * project. The repository provider can be obtained using
+ * <code>RepositoryProvider.getProvider(project)</code>.
+ *
+ * @param project the project that was mapped
+ */
+ public void repositoryProviderMapped(IProject project);
+
+ /**
+ * This method is invoked when a RepositoryProvider is unmapped from a
+ * project.
+ *
+ * @param project the project that was unmapped
+ */
+ public void repositoryProviderUnmapped(IProject project);
+}
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
index 0ec6bc2e1..6247f5727 100644
--- 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
@@ -78,6 +78,8 @@ public abstract class RepositoryProvider implements IProjectNature {
private final static List AllProviderTypeIds = initializeAllProviderTypes();
+ private final static IRepositoryMappingListener[] mappingListeners = initializeRepositoryMappingListeners();
+
// the project instance that this nature is assigned to
private IProject project;
@@ -113,8 +115,10 @@ public abstract class RepositoryProvider implements IProjectNature {
project.setPersistentProperty(PROVIDER_PROP_KEY, id);
provider.configure(); //xxx not sure if needed since they control with wiz page and can configure all they want
- //adding the nature would've caused project description delta, so trigger one
- project.setDescription(project.getDescription(), null);
+ //notify interested parties of the mapping
+ for (int i = 0; i < mappingListeners.length; i++) {
+ mappingListeners[i].repositoryProviderMapped(project);
+ }
} catch (CoreException e) {
throw TeamPlugin.wrapException(e);
}
@@ -161,8 +165,10 @@ public abstract class RepositoryProvider implements IProjectNature {
project.setSessionProperty(PROVIDER_PROP_KEY, null);
project.setPersistentProperty(PROVIDER_PROP_KEY, null);
- //removing the nature would've caused project description delta, so trigger one
- project.setDescription(project.getDescription(), null);
+ //notify interested parties of the unmapping
+ for (int i = 0; i < mappingListeners.length; i++) {
+ mappingListeners[i].repositoryProviderUnmapped(project);
+ }
} catch (CoreException e) {
throw TeamPlugin.wrapException(e);
}
@@ -487,4 +493,31 @@ public abstract class RepositoryProvider implements IProjectNature {
Team.removeNatureFromProject(project, providerId, new NullProgressMonitor());
}
}
+
+ private static IRepositoryMappingListener[] initializeRepositoryMappingListeners() {
+ List listeners = new ArrayList();
+
+ TeamPlugin plugin = TeamPlugin.getPlugin();
+ if (plugin != null) {
+ IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint(TeamPlugin.REPOSITORY_MAPPING_NOTIFICATION_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++) {
+ try {
+ listeners.add((IRepositoryMappingListener)configElements[j].createExecutableExtension("class")); //$NON-NLS-1$
+ } catch (CoreException e) {
+ // Log the exception and continue processing other listeners
+ TeamPlugin.log(e.getStatus());
+ } catch (ClassCastException e) {
+ // Log the exception and continue processing other listeners
+ TeamPlugin.log(new Status(IStatus.ERROR, TeamPlugin.ID, 0, "Invalid class registered", e));
+ }
+ }
+ }
+ }
+ }
+ return (IRepositoryMappingListener[]) listeners.toArray(new IRepositoryMappingListener[listeners.size()]);
+ }
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
index fbf342a8e..81fb3691f 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
@@ -46,6 +46,8 @@ final public class TeamPlugin extends Plugin {
public static final String PROJECT_SET_EXTENSION = "projectSets"; //$NON-NLS-1$
// The id of the targets extension point
public static final String REPOSITORY_EXTENSION = "repository"; //$NON-NLS-1$
+ // The id of the repository mapping notification point
+ public static final String REPOSITORY_MAPPING_NOTIFICATION_EXTENSION = "repositoryMappingNotification"; //$NON-NLS-1$
// The id of the targets extension point
public static final String TARGETS_EXTENSION = "targets"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.cvs.ui/.project b/bundles/org.eclipse.team.cvs.ui/.project
index 050d5458f..a0e108d6b 100644
--- a/bundles/org.eclipse.team.cvs.ui/.project
+++ b/bundles/org.eclipse.team.cvs.ui/.project
@@ -24,6 +24,5 @@
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.team.cvs.core.cvsnature</nature>
</natures>
</projectDescription>
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index 79730d416..d1e93f35c 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -700,4 +700,13 @@
</action>
</actionSet>
</extension>
+
+ <!-- *************** Repository Mapping Notification **************** -->
+ <extension
+ point="org.eclipse.team.core.repositoryMappingNotification">
+ <repository
+ class="org.eclipse.team.internal.ccvs.ui.RepositoryMappingListener"
+ id="org.eclipse.team.cvs.ui.repositoryMappingListener">
+ </repository>
+ </extension>
</plugin>
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 9f304a14e..7c49bf357 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
@@ -522,5 +522,12 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
if (deconfiguredProjects.isEmpty()) return false;
return deconfiguredProjects.contains(resource.getProject());
}
+
+ public void refreshDeconfiguredProject(IProject project) {
+ if (deconfiguredProjects.contains(project)) {
+ deconfiguredProjects.remove(project);
+ refresh(project);
+ }
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryMappingListener.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryMappingListener.java
new file mode 100644
index 000000000..bcaf754e9
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryMappingListener.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.team.core.IRepositoryMappingListener;
+
+public class RepositoryMappingListener implements IRepositoryMappingListener {
+
+ /**
+ * Constructor for RepositoryMappingListener.
+ */
+ public RepositoryMappingListener() {
+ super();
+ }
+
+ /**
+ * @see org.eclipse.team.core.IRepositoryMappingListener#repositoryProviderMapped(IProject)
+ */
+ public void repositoryProviderMapped(IProject project) {
+ }
+
+ /**
+ * @see org.eclipse.team.core.IRepositoryMappingListener#repositoryProviderUnmapped(IProject)
+ */
+ public void repositoryProviderUnmapped(IProject project) {
+ CVSDecorator.getActiveCVSDecorator().refreshDeconfiguredProject(project);
+ }
+
+}

Back to the top