Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 231200 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/equinox/internal/provisional/p2/ui/actions/InstallAction.java (-7 / +18 lines)
Lines 51-63 Link Here
51
				// If the iu is a newer version of something already installed, consider this an
51
				// If the iu is a newer version of something already installed, consider this an
52
				// update request
52
				// update request
53
				if (compareTo > 0) {
53
				if (compareTo > 0) {
54
					request.addInstallableUnits(new IInstallableUnit[] {ius[i]});
54
					int lock = getLock(profile, installedIU);
55
					request.removeInstallableUnits(new IInstallableUnit[] {installedIU});
55
					// If it is locked for update, we don't allow it.
56
					// Mark it as a root if it hasn't been already
56
					if ((lock & IInstallableUnit.LOCK_UPDATE) == IInstallableUnit.LOCK_UPDATE) {
57
					if (!Boolean.toString(true).equals(profile.getInstallableUnitProperty(installedIU, IInstallableUnit.PROP_PROFILE_ROOT_IU)))
57
						// Tell the user it's already installed.
58
						request.setInstallableUnitProfileProperty(ius[i], IInstallableUnit.PROP_PROFILE_ROOT_IU, Boolean.toString(true));
58
						// TODO this would seem odd if the user didn't know they had it installed.  If it's not marked
59
					// Add a status informing the user that the update has been inferred
59
						// as a root, they can't see it.  But silently marking it as a root as we do when the versions are the
60
					additionalStatus.merge(PlanStatusHelper.getStatus(IStatusCodes.IMPLIED_UPDATE, ius[i]));
60
						// same would make it look like we installed the wrong version.  And a message saying, "you didn't know
61
						// this, but you already have an older version of this installed" is not so great either.
62
						additionalStatus.merge(PlanStatusHelper.getStatus(IStatusCodes.IGNORED_ALREADY_INSTALLED, ius[i]));
63
					} else {
64
						request.addInstallableUnits(new IInstallableUnit[] {ius[i]});
65
						request.removeInstallableUnits(new IInstallableUnit[] {installedIU});
66
						// Mark it as a root if it hasn't been already
67
						if (!Boolean.toString(true).equals(profile.getInstallableUnitProperty(installedIU, IInstallableUnit.PROP_PROFILE_ROOT_IU)))
68
							request.setInstallableUnitProfileProperty(ius[i], IInstallableUnit.PROP_PROFILE_ROOT_IU, Boolean.toString(true));
69
						// Add a status informing the user that the update has been inferred
70
						additionalStatus.merge(PlanStatusHelper.getStatus(IStatusCodes.IMPLIED_UPDATE, ius[i]));
71
					}
61
				} else if (compareTo < 0) {
72
				} else if (compareTo < 0) {
62
					// An implied downgrade.  We will not put this in the plan, add a status informing the user
73
					// An implied downgrade.  We will not put this in the plan, add a status informing the user
63
					additionalStatus.merge(PlanStatusHelper.getStatus(IStatusCodes.IGNORED_IMPLIED_DOWNGRADE, ius[i]));
74
					additionalStatus.merge(PlanStatusHelper.getStatus(IStatusCodes.IGNORED_IMPLIED_DOWNGRADE, ius[i]));
(-)src/org/eclipse/equinox/internal/provisional/p2/ui/actions/ProfileModificationAction.java (-13 / +13 lines)
Lines 36-41 Link Here
36
	IProfileChooser profileChooser;
36
	IProfileChooser profileChooser;
37
	Policies policies;
37
	Policies policies;
38
38
39
	protected static int getLock(IProfile profile, IInstallableUnit iu) {
40
		if (profile == null)
41
			return IInstallableUnit.LOCK_NONE;
42
		try {
43
			String value = profile.getInstallableUnitProperty(iu, IInstallableUnit.PROP_PROFILE_LOCKED_IU);
44
			if (value != null)
45
				return Integer.parseInt(value);
46
		} catch (NumberFormatException e) {
47
			// ignore and assume no lock
48
		}
49
		return IInstallableUnit.LOCK_NONE;
50
	}
51
39
	protected ProfileModificationAction(String text, ISelectionProvider selectionProvider, String profileId, IProfileChooser profileChooser, Policies policies, Shell shell) {
52
	protected ProfileModificationAction(String text, ISelectionProvider selectionProvider, String profileId, IProfileChooser profileChooser, Policies policies, Shell shell) {
40
		super(text, selectionProvider, shell);
53
		super(text, selectionProvider, shell);
41
		this.profileId = profileId;
54
		this.profileId = profileId;
Lines 154-172 Link Here
154
167
155
	protected abstract boolean isEnabledFor(Object[] selections);
168
	protected abstract boolean isEnabledFor(Object[] selections);
156
169
157
	protected int getLock(IProfile profile, IInstallableUnit iu) {
158
		if (profile == null)
159
			return IInstallableUnit.LOCK_NONE;
160
		try {
161
			String value = profile.getInstallableUnitProperty(iu, IInstallableUnit.PROP_PROFILE_LOCKED_IU);
162
			if (value != null)
163
				return Integer.parseInt(value);
164
		} catch (NumberFormatException e) {
165
			// ignore and assume no lock
166
		}
167
		return IInstallableUnit.LOCK_NONE;
168
	}
169
170
	protected IProfile getProfile(boolean chooseProfile) {
170
	protected IProfile getProfile(boolean chooseProfile) {
171
		try {
171
		try {
172
			String id = getProfileId(chooseProfile);
172
			String id = getProfileId(chooseProfile);

Return to bug 231200