Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 209099 Details for
Bug 367980
Support for pre-release versions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed fix
367980.txt (text/plain), 5.72 KB, created by
Thomas Watson
on 2012-01-05 15:09:00 EST
(
hide
)
Description:
proposed fix
Filename:
MIME Type:
Creator:
Thomas Watson
Created:
2012-01-05 15:09:00 EST
Size:
5.72 KB
patch
obsolete
>From ab4a569a44e68db11ccbecc5279bc2a443da97cc Mon Sep 17 00:00:00 2001 >From: Thomas Watson <tjwatson@us.ibm.com> >Date: Thu, 5 Jan 2012 14:05:48 -0600 >Subject: [PATCH] Bug 367980 - Support for pre-release versions > >--- > .../pde/internal/ui/parts/PluginVersionPart.java | 97 +++++++++++++++++--- > 1 files changed, 84 insertions(+), 13 deletions(-) > >diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/parts/PluginVersionPart.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/parts/PluginVersionPart.java >index 2c1942a..6ec89cc 100644 >--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/parts/PluginVersionPart.java >+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/parts/PluginVersionPart.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2008 IBM Corporation and others. >+ * Copyright (c) 2005, 2012 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -192,9 +192,9 @@ public class PluginVersionPart { > } > > public void preloadFields() { >+ fMinVersionText.setText(getMinumum(fVersionRange)); > if (fRangeAllowed) { >- fMinVersionText.setText((fVersionRange != null) ? fVersionRange.getMinimum().toString() : ""); //$NON-NLS-1$ >- fMaxVersionText.setText((fVersionRange != null && fVersionRange.getMaximum().getMajor() != Integer.MAX_VALUE) ? fVersionRange.getMaximum().toString() : ""); //$NON-NLS-1$ >+ fMaxVersionText.setText(getMaximum(fVersionRange)); > > if (fVersionRange != null) > fMinVersionBound.select((fVersionRange.getIncludeMinimum()) ? 0 : 1); >@@ -206,7 +206,76 @@ public class PluginVersionPart { > else > fMaxVersionBound.select(1); > } >- fMinVersionText.setText((fVersionRange != null) ? fVersionRange.getMinimum().toString() : ""); //$NON-NLS-1$ >+ } >+ >+ private String getMinumum(VersionRange range) { >+ if (range == null) >+ return ""; //$NON-NLS-1$ >+ return toString(range.getLeft(), range.getLeftType()); >+ >+ } >+ >+ private String getMaximum(VersionRange range) { >+ if (range == null) >+ return ""; //$NON-NLS-1$ >+ return toString(range.getRight(), range.getRightType()); >+ >+ } >+ >+ private static String toString(VersionRange range) { >+ // Do not use the VersionRange.toString method because it will fully qualify the versions >+ Version left = range.getLeft(); >+ Version right = range.getRight(); >+ String leftVersion = left.toString(); >+ if (right == null) { >+ return toString(left, range.getLeftType()); >+ } >+ String rightVerion = right.toString(); >+ StringBuffer result = new StringBuffer(leftVersion.length() + rightVerion.length() + 5); >+ result.append(range.getLeftType()); >+ result.append(toString(left, range.getLeftType())); >+ result.append(','); >+ result.append(toString(right, range.getRightType())); >+ result.append(range.getRightType()); >+ return result.toString(); >+ } >+ >+ private static String toString(Version version, char endPointType) { >+ // need to avoid fully qualifying the versions if not needed. >+ if (version == null) >+ return ""; //$NON-NLS-1$ >+ int q = version.getQualifier().length(); >+ if (q > 0) { >+ return version.toString(); >+ } >+ StringBuffer buffer = new StringBuffer(version.toString().length() + 1); >+ buffer.append(version.getMajor()); >+ buffer.append('.'); >+ buffer.append(version.getMinor()); >+ buffer.append('.'); >+ buffer.append(version.getMicro()); >+ char separator = version.isReleaseVersion() ? '.' : '-'; >+ switch (endPointType) { >+ case VersionRange.LEFT_CLOSED : >+ if (separator == '.') // left release version [x.y.z. must fully qualify >+ buffer.append(separator); >+ break; >+ case VersionRange.LEFT_OPEN : >+ if (separator == '-') // left pre-release version [x.y.z- must fully qualify >+ buffer.append(separator); >+ break; >+ case VersionRange.RIGHT_CLOSED : >+ if (separator == '-') // right release version x.y.z.) must fully qualify >+ buffer.append(separator); >+ break; >+ case VersionRange.RIGHT_OPEN : >+ if (separator == '.') // right pre-release version x.y.z-] must fully qualify >+ buffer.append(separator); >+ break; >+ default : >+ break; >+ } >+ return buffer.toString(); > } > > private IStatus validateVersion(String text, Text textWidget, boolean shortErrorMessage) { >@@ -316,7 +385,6 @@ public class PluginVersionPart { > } > > public String getVersion() { >- String version; > if (fIsRanged) { > // if versions are equal they must be inclusive for a range to be valid > // blindly set for the user >@@ -326,15 +394,18 @@ public class PluginVersionPart { > boolean maxI = getMaxInclusive(); > if (minV.equals(maxV)) > minI = maxI = true; >- version = new VersionRange(new Version(minV), minI, new Version(maxV), maxI).toString(); >- } else { >- String singleversion = extractSingleVersionFromText(); >- if (singleversion == null || singleversion.length() == 0) >- version = ""; //$NON-NLS-1$ >- else >- version = new Version(singleversion).toString(); >+ StringBuffer buffer = new StringBuffer(minV.length() + maxV.length() + 3); >+ buffer.append(minI ? VersionRange.LEFT_CLOSED : VersionRange.LEFT_OPEN); >+ buffer.append(minV); >+ buffer.append(','); >+ buffer.append(maxV); >+ buffer.append(maxI ? VersionRange.RIGHT_CLOSED : VersionRange.RIGHT_OPEN); >+ return toString(new VersionRange(buffer.toString())); > } >- return version; >+ String singleversion = extractSingleVersionFromText(); >+ if (singleversion == null || singleversion.length() == 0) >+ return ""; //$NON-NLS-1$ >+ return new Version(singleversion).toString(); > } > > public void addListeners(ModifyListener minListener, ModifyListener maxListener) { >-- >1.7.6 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 367980
:
209099
|
209154