Skip to content

Commit 308fa50

Browse files
subyssurendran666merks
authored andcommitted
Add current and new plugin versions while update
This change enhances the update wizard to display both the currently installed version and the available update version for each feature. This allows users to easily compare versions and make more informed decisions when selecting updates. Fix: #935
1 parent 49759ef commit 308fa50

7 files changed

Lines changed: 55 additions & 17 deletions

File tree

bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2007, 2018 IBM Corporation and others.
2+
* Copyright (c) 2007, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -231,6 +231,8 @@ public class ProvUIMessages extends NLS {
231231
public static String ProvUI_IdColumnTitle;
232232
public static String ProvUI_ProviderColumnTitle;
233233
public static String ProvUI_VersionColumnTitle;
234+
public static String ProvUI_VersionColumnTitle_Old;
235+
public static String ProvUI_VersionColumnTitle_New;
234236
public static String ProvUI_WarningTitle;
235237
public static String ProvUIMessages_NotAccepted_EnterFor_0;
236238
public static String ProvUIMessages_SavedNotAccepted_EnterFor_0;

bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2007, 2018 IBM Corporation and others.
2+
* Copyright (c) 2007, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -24,8 +24,7 @@
2424
import org.eclipse.equinox.internal.p2.ui.viewers.*;
2525
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
2626
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
27-
import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
28-
import org.eclipse.equinox.p2.operations.ProvisioningJob;
27+
import org.eclipse.equinox.p2.operations.*;
2928
import org.eclipse.equinox.p2.query.IQueryable;
3029
import org.eclipse.equinox.p2.ui.ProvisioningUI;
3130
import org.eclipse.jface.dialogs.Dialog;
@@ -125,9 +124,31 @@ public String getToolTipText(Object element) {
125124
return super.getToolTipText(element);
126125
}
127126
});
127+
final int DEFAULT_COLUMN_WIDTH = 200;
128+
// check the operation is for update or installation
129+
boolean isUpdate = (resolvedOperation instanceof UpdateOperation);
130+
if (isUpdate) {
131+
TreeViewerColumn versionColumnOld = new TreeViewerColumn(treeViewer, SWT.LEFT);
132+
versionColumnOld.getColumn().setText(ProvUIMessages.ProvUI_VersionColumnTitle_Old);
133+
versionColumnOld.getColumn().setWidth(DEFAULT_COLUMN_WIDTH);
134+
versionColumnOld.setLabelProvider(new ColumnLabelProvider() {
135+
@Override
136+
public String getText(Object element) {
137+
IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class);
138+
if (element instanceof IIUElement iuElement) {
139+
if (iuElement.shouldShowVersion() && element instanceof AvailableUpdateElement elm) {
140+
return elm.getIUToBeUpdated().getVersion().toString();
141+
}
142+
return ""; //$NON-NLS-1$
143+
}
144+
return iu.getVersion().toString();
145+
}
146+
});
147+
}
148+
128149
TreeViewerColumn versionColumn = new TreeViewerColumn(treeViewer, SWT.LEFT);
129-
versionColumn.getColumn().setText(ProvUIMessages.ProvUI_VersionColumnTitle);
130-
versionColumn.getColumn().setWidth(200);
150+
versionColumn.getColumn().setText(isUpdate ? ProvUIMessages.ProvUI_VersionColumnTitle_New : ProvUIMessages.ProvUI_VersionColumnTitle);
151+
versionColumn.getColumn().setWidth(DEFAULT_COLUMN_WIDTH);
131152
versionColumn.setLabelProvider(new ColumnLabelProvider() {
132153
@Override
133154
public String getText(Object element) {
@@ -143,7 +164,7 @@ public String getText(Object element) {
143164
});
144165
TreeViewerColumn idColumn = new TreeViewerColumn(treeViewer, SWT.LEFT);
145166
idColumn.getColumn().setText(ProvUIMessages.ProvUI_IdColumnTitle);
146-
idColumn.getColumn().setWidth(200);
167+
idColumn.getColumn().setWidth(DEFAULT_COLUMN_WIDTH);
147168

148169
idColumn.setLabelProvider(new ColumnLabelProvider() {
149170
@Override

bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionStatusPage.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2009, 2011 IBM Corporation and others.
2+
* Copyright (c) 2009, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -43,7 +43,7 @@ public abstract class ResolutionStatusPage extends ProvisioningWizardPage {
4343
private static final String NAME_COLUMN_WIDTH = "NameColumnWidth"; //$NON-NLS-1$
4444
private static final String VERSION_COLUMN_WIDTH = "VersionColumnWidth"; //$NON-NLS-1$
4545
private static final String ID_COLUMN_WIDTH = "IDColumnWidth"; //$NON-NLS-1$
46-
private IUColumnConfig nameColumn, versionColumn, idColumn;
46+
private IUColumnConfig nameColumn, versionColumnOld, versionColumn, idColumn;
4747

4848
protected ResolutionStatusPage(String pageName, ProvisioningUI ui, ProvisioningOperationWizard wizard) {
4949
super(pageName, ui, wizard);
@@ -318,12 +318,14 @@ protected IUColumnConfig[] getColumnConfig() {
318318
// resolution errors are reported by ID.
319319
nameColumn = new IUColumnConfig(ProvUIMessages.ProvUI_NameColumnTitle, IUColumnConfig.COLUMN_NAME,
320320
ILayoutConstants.DEFAULT_PRIMARY_COLUMN_WIDTH);
321-
versionColumn = new IUColumnConfig(ProvUIMessages.ProvUI_VersionColumnTitle, IUColumnConfig.COLUMN_VERSION,
321+
versionColumnOld = new IUColumnConfig(ProvUIMessages.ProvUI_VersionColumnTitle_Old,
322+
IUColumnConfig.OLD_COLUMN_VERSION, ILayoutConstants.DEFAULT_SMALL_COLUMN_WIDTH);
323+
versionColumn = new IUColumnConfig(ProvUIMessages.ProvUI_VersionColumnTitle_New, IUColumnConfig.COLUMN_VERSION,
322324
ILayoutConstants.DEFAULT_SMALL_COLUMN_WIDTH);
323325
idColumn = new IUColumnConfig(ProvUIMessages.ProvUI_IdColumnTitle, IUColumnConfig.COLUMN_ID,
324326
ILayoutConstants.DEFAULT_COLUMN_WIDTH);
325327
getColumnWidthsFromSettings();
326-
return new IUColumnConfig[] { nameColumn, versionColumn, idColumn };
328+
return new IUColumnConfig[] { nameColumn, versionColumnOld, versionColumn, idColumn };
327329
}
328330

329331
private boolean isLocked(AvailableIUElement elementToBeUpdated) {

bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2008, 2018 IBM Corporation and others.
2+
* Copyright (c) 2008, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -137,7 +137,8 @@ public void createControl(Composite parent) {
137137

138138
contentProvider = new ProvElementContentProvider();
139139
tableViewer.setContentProvider(contentProvider);
140-
labelProvider = new IUDetailsLabelProvider(null, ProvUI.getIUColumnConfig(), getShell());
140+
IUColumnConfig[] columnConf = getColumnConfig();
141+
labelProvider = new IUDetailsLabelProvider(null, columnConf, getShell());
141142
tableViewer.setLabelProvider(labelProvider);
142143
tableViewer.setInput(root);
143144
setInitialCheckState();

bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ ProvUI_InstallDialogError=Unable to open the Installation Information.
183183
ProvUI_NameColumnTitle=Name
184184
ProvUI_IdColumnTitle=Id
185185
ProvUI_VersionColumnTitle=Version
186+
ProvUI_VersionColumnTitle_Old=Installed Version
187+
ProvUI_VersionColumnTitle_New=Available Version
186188
ProvUI_ProviderColumnTitle=Provider
187189
ProvUI_WarningTitle=Warning
188190
ProvUIMessages_NotAccepted_EnterFor_0=Login details were not accepted. Please provide login details for {0}

bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUColumnConfig.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2007, 2016 IBM Corporation and others.
2+
* Copyright (c) 2007, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -56,6 +56,10 @@ public class IUColumnConfig {
5656
*/
5757
public final static int COLUMN_DESCRIPTION = 5;
5858

59+
public final static int OLD_COLUMN_VERSION = 6;
60+
61+
public final static int NEW_COLUMN_VERSION = 7;
62+
5963
private String columnTitle;
6064
private int columnType;
6165
private int columnWidth;

bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2007, 2018 IBM Corporation and others.
2+
* Copyright (c) 2007, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -19,8 +19,7 @@
1919
import org.eclipse.core.runtime.*;
2020
import org.eclipse.core.runtime.jobs.*;
2121
import org.eclipse.equinox.internal.p2.ui.*;
22-
import org.eclipse.equinox.internal.p2.ui.model.IIUElement;
23-
import org.eclipse.equinox.internal.p2.ui.model.ProvElement;
22+
import org.eclipse.equinox.internal.p2.ui.model.*;
2423
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
2524
import org.eclipse.jface.viewers.*;
2625
import org.eclipse.osgi.util.NLS;
@@ -119,6 +118,7 @@ public String getColumnText(Object element, int columnIndex) {
119118
}
120119
return BLANK;
121120
case IUColumnConfig.COLUMN_VERSION :
121+
case IUColumnConfig.NEW_COLUMN_VERSION :
122122
// If it's an element, determine if version should be shown
123123
if (element instanceof IIUElement) {
124124
if (((IIUElement) element).shouldShowVersion()) {
@@ -128,6 +128,12 @@ public String getColumnText(Object element, int columnIndex) {
128128
}
129129
// It's a raw IU, return the version
130130
return iu.getVersion().toString();
131+
case IUColumnConfig.OLD_COLUMN_VERSION :
132+
if (element instanceof AvailableUpdateElement elm
133+
&& elm.shouldShowVersion()) {
134+
return elm.getIUToBeUpdated().getVersion().toString();
135+
}
136+
return BLANK;
131137
case IUColumnConfig.COLUMN_PROVIDER :
132138
return iu.getProperty(IInstallableUnit.PROP_PROVIDER, null);
133139
case IUColumnConfig.COLUMN_SIZE :

0 commit comments

Comments
 (0)