diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.touchpoint.eclipse')
3 files changed, 14 insertions, 16 deletions
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java index 2a05a1c2c..b86ff5dd2 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 IBM Corporation and others. + * Copyright (c) 2008, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,7 +35,7 @@ public class AddRepositoryAction extends RepositoryAction { addRepositoryToProfile(agentLocation, profile, event.getRepositoryLocation(), event.getRepositoryNickname(), event.getRepositoryType(), event.isRepositoryEnabled()); //if provisioning into the current profile, broadcast an event to add this repository directly to the current repository managers. if (isSelfProfile(registry, profile)) - addToSelf(agentLocation, event); + addToSelf(agent, agentLocation, event); return Status.OK_STATUS; } catch (CoreException e) { return e.getStatus(); @@ -57,7 +57,7 @@ public class AddRepositoryAction extends RepositoryAction { removeRepositoryFromProfile(agentLocation, profile, event.getRepositoryLocation(), event.getRepositoryType()); //if provisioning into the current profile, broadcast an event to add this repository directly to the current repository managers. if (isSelfProfile(registry, profile)) - removeFromSelf(agentLocation, event); + removeFromSelf(agent, agentLocation, event); return Status.OK_STATUS; } catch (CoreException e) { return e.getStatus(); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java index b1d388932..e15474e47 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 IBM Corporation and others. + * Copyright (c) 2008, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,7 +35,7 @@ public class RemoveRepositoryAction extends RepositoryAction { removeRepositoryFromProfile(agentLocation, profile, event.getRepositoryLocation(), event.getRepositoryType()); //if we are provisioning into the self profile, update the current set of repositories in this configuration if (isSelfProfile(registry, profile)) - removeFromSelf(agentLocation, event); + removeFromSelf(agent, agentLocation, event); } catch (CoreException e) { return e.getStatus(); } @@ -53,7 +53,7 @@ public class RemoveRepositoryAction extends RepositoryAction { addRepositoryToProfile(agentLocation, profile, event.getRepositoryLocation(), event.getRepositoryNickname(), event.getRepositoryType(), event.isRepositoryEnabled()); //if we are provisioning into the self profile, update the current set of repositories in this configuration if (isSelfProfile(registry, profile)) - addToSelf(agentLocation, event); + addToSelf(agent, agentLocation, event); return Status.OK_STATUS; } catch (CoreException e) { return e.getStatus(); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java index 38defc24c..35379ca37 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 IBM Corporation and others. + * Copyright (c) 2008, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,9 +14,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.Map; import org.eclipse.core.runtime.CoreException; -import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; import org.eclipse.equinox.internal.p2.engine.Profile; -import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Activator; import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util; import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent; import org.eclipse.equinox.p2.core.IAgentLocation; @@ -53,11 +51,11 @@ abstract class RepositoryAction extends ProvisioningAction { * Returns the repository manager of the given type, or <code>null</code> * if not available. */ - private static IRepositoryManager<?> getRepositoryManager(int type) { + private static IRepositoryManager<?> getRepositoryManager(IProvisioningAgent agent, int type) { if (type == IRepository.TYPE_METADATA) { - return (IRepositoryManager<?>) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.SERVICE_NAME); + return (IRepositoryManager<?>) agent.getService(IMetadataRepositoryManager.SERVICE_NAME); } else if (type == IRepository.TYPE_ARTIFACT) { - return (IRepositoryManager<?>) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.SERVICE_NAME); + return (IRepositoryManager<?>) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); } return null; } @@ -92,8 +90,8 @@ abstract class RepositoryAction extends ProvisioningAction { /** * Adds the repository corresponding to the given event to the currently running instance. */ - protected void addToSelf(IAgentLocation agentLocation, RepositoryEvent event) { - IRepositoryManager<?> manager = getRepositoryManager(event.getRepositoryType()); + protected void addToSelf(IProvisioningAgent agent, IAgentLocation agentLocation, RepositoryEvent event) { + IRepositoryManager<?> manager = getRepositoryManager(agent, event.getRepositoryType()); final URI location = event.getRepositoryLocation(); Preferences node = getRepositoryPreferenceNode(agentLocation, null, location, event.getRepositoryType()); @@ -168,8 +166,8 @@ abstract class RepositoryAction extends ProvisioningAction { /** * Removes the repository corresponding to the given event from the currently running instance. */ - protected void removeFromSelf(IAgentLocation agentLocation, RepositoryEvent event) { - IRepositoryManager<?> manager = getRepositoryManager(event.getRepositoryType()); + protected void removeFromSelf(IProvisioningAgent agent, IAgentLocation agentLocation, RepositoryEvent event) { + IRepositoryManager<?> manager = getRepositoryManager(agent, event.getRepositoryType()); Preferences node = getRepositoryPreferenceNode(agentLocation, null, event.getRepositoryLocation(), event.getRepositoryType()); int count = getRepositoryCount(node); if (--count < 1 && manager != null) |