11/*******************************************************************************
2- * Copyright (c) 2005, 2015 IBM Corporation and others.
2+ * Copyright (c) 2005, 2025 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
@@ -70,8 +70,7 @@ protected void selectionChanged(IStructuredSelection selection) {
7070 @ Override
7171 protected void handleDoubleClick (IStructuredSelection selection ) {
7272 if (selection .size () == 1 ) {
73- IPluginModelBase entry = (IPluginModelBase ) selection .getFirstElement ();
74- String version = VersionUtil .computeInitialPluginVersion (entry .getBundleDescription ().getVersion ().toString ());
73+ String version = getVersion (selection .getFirstElement ());
7574 setVersion (version , "" ); //$NON-NLS-1$
7675 }
7776 }
@@ -80,15 +79,7 @@ protected void handleDoubleClick(IStructuredSelection selection) {
8079 protected void buttonSelected (Button button , int index ) {
8180 IStructuredSelection selection = getTableViewer ().getStructuredSelection ();
8281 if (selection .size () == 1 ) {
83- String version ;
84- if (isPlugin ) {
85- IPluginModelBase entry = (IPluginModelBase ) selection .getFirstElement ();
86- version = VersionUtil
87- .computeInitialPluginVersion (entry .getBundleDescription ().getVersion ().toString ());
88- } else {
89- PackageObject po = (PackageObject ) selection .getFirstElement ();
90- version = po .getVersion ();
91- }
82+ String version = getVersion (selection .getFirstElement ());
9283 setVersion (version , "" ); //$NON-NLS-1$
9384 } else {
9485 // plug-ins come back in a sorted order so we assume min/max
@@ -116,6 +107,14 @@ protected void buttonSelected(Button button, int index) {
116107 }
117108 }
118109
110+ private String getVersion (Object firstElement ) {
111+ if (isPlugin ) {
112+ IPluginModelBase entry = (IPluginModelBase ) firstElement ;
113+ return VersionUtil .computeInitialPluginVersion (entry .getBundleDescription ().getVersion ().toString ());
114+ }
115+ PackageObject po = (PackageObject ) firstElement ;
116+ return po .getVersion ();
117+ }
119118 }
120119
121120 private static class PluginVersionContentProvider implements IStructuredContentProvider {
0 commit comments