1
1
/*******************************************************************************
2
- * Copyright (c) 2005, 2015 IBM Corporation and others.
2
+ * Copyright (c) 2005, 2025 IBM Corporation and others.
3
3
*
4
4
* This program and the accompanying materials
5
5
* are made available under the terms of the Eclipse Public License 2.0
@@ -70,8 +70,7 @@ protected void selectionChanged(IStructuredSelection selection) {
70
70
@ Override
71
71
protected void handleDoubleClick (IStructuredSelection selection ) {
72
72
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 ());
75
74
setVersion (version , "" ); //$NON-NLS-1$
76
75
}
77
76
}
@@ -80,15 +79,7 @@ protected void handleDoubleClick(IStructuredSelection selection) {
80
79
protected void buttonSelected (Button button , int index ) {
81
80
IStructuredSelection selection = getTableViewer ().getStructuredSelection ();
82
81
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 ());
92
83
setVersion (version , "" ); //$NON-NLS-1$
93
84
} else {
94
85
// plug-ins come back in a sorted order so we assume min/max
@@ -116,6 +107,14 @@ protected void buttonSelected(Button button, int index) {
116
107
}
117
108
}
118
109
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
+ }
119
118
}
120
119
121
120
private static class PluginVersionContentProvider implements IStructuredContentProvider {
0 commit comments