From f2bb1f0d9f5d1772cd8c4188007a2e3f1ed6c4c2 Mon Sep 17 00:00:00 2001 From: Simon Kaegi Date: Fri, 6 Mar 2009 20:07:00 +0000 Subject: Bug 262243 [eclipse] markStarted action should ignore OSGi fragment bundles --- .../eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java | 5 +++++ .../p2/touchpoint/eclipse/actions/MarkStartedAction.java | 11 ++++++++--- .../p2/touchpoint/eclipse/actions/SetStartLevelAction.java | 11 ++++++++--- 3 files changed, 21 insertions(+), 6 deletions(-) (limited to 'bundles/org.eclipse.equinox.p2.touchpoint.eclipse') diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java index 81212bca7..cab713288 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/Util.java @@ -182,6 +182,11 @@ public class Util { if (version == null) return null; bundleInfo.setVersion(version); + + String fragmentHost = (String) headers.get(Constants.FRAGMENT_HOST); + if (fragmentHost != null) + bundleInfo.setFragment(true); + } catch (BundleException e) { // unexpected LogHelper.log(new Status(IStatus.ERROR, Activator.ID, e.getMessage(), e)); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java index 52f8484a1..f963255a3 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/MarkStartedAction.java @@ -50,6 +50,9 @@ public class MarkStartedAction extends ProvisioningAction { if (bundleInfo == null) return Util.createError(NLS.bind(Messages.failed_bundleinfo, iu)); + if (bundleInfo.isFragment()) + return Status.OK_STATUS; + BundleInfo[] bundles = manipulator.getConfigData().getBundles(); for (int i = 0; i < bundles.length; i++) { if (bundles[i].equals(bundleInfo)) { @@ -62,6 +65,10 @@ public class MarkStartedAction extends ProvisioningAction { } public IStatus undo(Map parameters) { + Boolean previousStarted = (Boolean) getMemento().get(ActionConstants.PARM_PREVIOUS_STARTED); + if (previousStarted == null) + return Status.OK_STATUS; + IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE); Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU); @@ -85,9 +92,7 @@ public class MarkStartedAction extends ProvisioningAction { BundleInfo[] bundles = manipulator.getConfigData().getBundles(); for (int i = 0; i < bundles.length; i++) { if (bundles[i].equals(bundleInfo)) { - Boolean previousStarted = (Boolean) getMemento().get(ActionConstants.PARM_PREVIOUS_STARTED); - if (previousStarted != null) - bundles[i].setMarkedAsStarted(previousStarted.booleanValue()); + bundles[i].setMarkedAsStarted(previousStarted.booleanValue()); break; } } diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java index 44cfc03c1..8a877802a 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetStartLevelAction.java @@ -49,6 +49,9 @@ public class SetStartLevelAction extends ProvisioningAction { if (bundleInfo == null) return Util.createError(NLS.bind(Messages.failed_bundleinfo, iu)); + if (bundleInfo.isFragment()) + return Status.OK_STATUS; + BundleInfo[] bundles = manipulator.getConfigData().getBundles(); for (int i = 0; i < bundles.length; i++) { if (bundles[i].equals(bundleInfo)) { @@ -65,6 +68,10 @@ public class SetStartLevelAction extends ProvisioningAction { } public IStatus undo(Map parameters) { + Integer previousStartLevel = (Integer) getMemento().get(ActionConstants.PARM_PREVIOUS_START_LEVEL); + if (previousStartLevel == null) + return Status.OK_STATUS; + IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE); Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU); @@ -88,9 +95,7 @@ public class SetStartLevelAction extends ProvisioningAction { BundleInfo[] bundles = manipulator.getConfigData().getBundles(); for (int i = 0; i < bundles.length; i++) { if (bundles[i].equals(bundleInfo)) { - Integer previousStartLevel = (Integer) getMemento().get(ActionConstants.PARM_PREVIOUS_START_LEVEL); - if (previousStartLevel != null) - bundles[i].setStartLevel(previousStartLevel.intValue()); + bundles[i].setStartLevel(previousStartLevel.intValue()); break; } } -- cgit v1.2.3