diff options
Diffstat (limited to 'bundles')
3 files changed, 18 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/Profile.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/Profile.java index 8196f72b0..84c4cc6c7 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/Profile.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/Profile.java @@ -11,6 +11,7 @@ package org.eclipse.equinox.p2.engine; import java.util.*; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.equinox.internal.p2.engine.EngineActivator; +import org.eclipse.equinox.p2.core.eventbus.ProvisioningEventBus; import org.eclipse.equinox.p2.core.helpers.ServiceHelper; import org.eclipse.equinox.p2.installregistry.IInstallRegistry; import org.eclipse.equinox.p2.installregistry.IProfileInstallRegistry; @@ -157,6 +158,13 @@ public class Profile implements IQueryable { IProfileInstallRegistry profile = registry.getProfileInstallRegistry(this); if (profile == null) return null; - return profile.setInstallableUnitProfileProperty(iu, key, value); + String previousValue = profile.setInstallableUnitProfileProperty(iu, key, value); + // TODO this is not the ideal place for this. + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=206077 + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=197701 + ProvisioningEventBus bus = (ProvisioningEventBus) ServiceHelper.getService(EngineActivator.getContext(), ProvisioningEventBus.class.getName()); + if (bus != null) + bus.publishEvent(new ProfileEvent(this, ProfileEvent.CHANGED)); + return previousValue; } } diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProfileEvent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProfileEvent.java index 8d9d00291..bffbff0d0 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProfileEvent.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProfileEvent.java @@ -17,6 +17,9 @@ public class ProfileEvent extends EventObject { public static byte ADDED = 0; public static byte REMOVED = 1; + // TODO We need an event when profile properties change. Not fully implemented. + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=197701 + public static byte CHANGED = 2; private byte reason; diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/installregistry/InstallRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/installregistry/InstallRegistry.java index f723721e6..44cff0ae8 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/installregistry/InstallRegistry.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/installregistry/InstallRegistry.java @@ -65,6 +65,9 @@ public class InstallRegistry implements IInstallRegistry { // the assumption is that the second operand will get installed or else // this change will never be committed. The alternative is to remember // a transitory root value that we set when the install is received. + // The ideal solution is that this is handled in a profile delta by + // the engine. + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=206077 if (isRoot && event.getOperand().second() != null) { registry.setInstallableUnitProfileProperty(event.getOperand().second().getOriginal(), IInstallableUnitConstants.PROFILE_ROOT_IU, Boolean.toString(true)); } @@ -80,6 +83,9 @@ public class InstallRegistry implements IInstallRegistry { if (pe.getReason() == ProfileEvent.REMOVED) { profileRegistries.remove(pe.getProfile().getProfileId()); persist(); + } else if (pe.getReason() == ProfileEvent.CHANGED) { + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=197701 + persist(); } } } |