Skip to content

Commit 0a250f2

Browse files
authored
Merge branch 'master' into showcountinoverlay
2 parents 76c7011 + ad566d1 commit 0a250f2

72 files changed

Lines changed: 2124 additions & 5103 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bundles/org.eclipse.core.databinding/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.core.databinding
5-
Bundle-Version: 1.13.700.qualifier
5+
Bundle-Version: 1.13.800.qualifier
66
Bundle-Vendor: %providerName
77
Bundle-Localization: plugin
88
Export-Package: org.eclipse.core.databinding;version="1.0.0",

bundles/org.eclipse.core.databinding/src/org/eclipse/core/databinding/conversion/text/NumberToStringConverter.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@
2929
* The first type parameter of {@link Converter} is set to {@link Object} to
3030
* preserve backwards compatibility, but the argument is meant to always be a
3131
* {@link Number}.
32-
* <p>
33-
* This class is a variant of the class with the same name in the parent
34-
* package, but it uses {@code java.text} instead of {@code com.ibm.icu}.
35-
* <p>
36-
* Methods on this class that don't take an argument number format use ICU if it
37-
* is available on the classpath, otherwise they use {@code java.text}.
3832
*
3933
* @since 1.9
4034
*/

bundles/org.eclipse.core.databinding/src/org/eclipse/core/databinding/conversion/text/StringToNumberConverter.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@
3333
* The first type parameter of {@link NumberFormatConverter} is set to
3434
* {@link Object} to preserve backwards compatibility, but the argument is meant
3535
* to always be a {@link String}.
36-
* <p>
37-
* This class is a variant of the class with the same name in the parent
38-
* package, but it uses {@code java.text} instead of {@code com.ibm.icu}.
39-
* <p>
40-
* Methods on this class that don't take an argument number format use ICU if it
41-
* is available on the classpath, otherwise they use {@code java.text}.
4236
*
4337
* @param <T> The type to which values are converted.
4438
*

bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/AbstractNumberToStringConverter.java

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
******************************************************************************/
1414
package org.eclipse.core.internal.databinding.conversion;
1515

16-
import java.lang.reflect.Constructor;
17-
import java.lang.reflect.InvocationTargetException;
1816
import java.math.BigDecimal;
1917
import java.math.BigInteger;
2018
import java.text.Format;
@@ -24,8 +22,7 @@
2422

2523
/**
2624
* Converts a Number to a String using <code>Format.format(...)</code>. This
27-
* class is thread safe. This class is used to share code between converters
28-
* that are based on ICU and java.text.
25+
* class is thread safe.
2926
*
3027
* @since 1.9
3128
*/
@@ -37,30 +34,6 @@ public class AbstractNumberToStringConverter extends Converter<Object, String> {
3734
private boolean fromTypeIsBigInteger;
3835
private boolean fromTypeIsBigDecimal;
3936

40-
static Class<?> icuBigDecimal = null;
41-
static Constructor<?> icuBigDecimalCtr = null;
42-
static Class<?> icuDecimalFormat = null;
43-
44-
{
45-
/*
46-
* If the full ICU4J library is available, we use the ICU BigDecimal class to
47-
* support proper formatting and parsing of java.math.BigDecimal.
48-
*
49-
* The version of ICU NumberFormat (DecimalFormat) included in eclipse excludes
50-
* support for java.math.BigDecimal, and if used falls back to converting as an
51-
* unknown Number type via doubleValue(), which is undesirable.
52-
*
53-
* See Bug #180392.
54-
*/
55-
try {
56-
icuBigDecimal = Class.forName("com.ibm.icu.math.BigDecimal"); //$NON-NLS-1$
57-
icuBigDecimalCtr = icuBigDecimal.getConstructor(BigInteger.class, int.class);
58-
icuDecimalFormat = Class.forName("com.ibm.icu.text.DecimalFormat"); //$NON-NLS-1$
59-
// System.out.println("DEBUG: Full ICU4J support state: icuBigDecimal="+(icuBigDecimal != null)+", icuBigDecimalCtr="+(icuBigDecimalCtr != null)); //$NON-NLS-1$ //$NON-NLS-2$
60-
} catch (ClassNotFoundException | NoSuchMethodException e) {
61-
}
62-
}
63-
6437
/**
6538
* Constructs a new instance.
6639
* <p>
@@ -123,17 +96,6 @@ public String convert(Object fromObject) {
12396
result = numberFormat.format(number);
12497
}
12598
} else if (fromTypeIsBigDecimal) {
126-
if (icuBigDecimal != null && icuBigDecimalCtr != null && icuDecimalFormat != null
127-
&& icuDecimalFormat.isInstance(numberFormat)) {
128-
// Full ICU4J present. Convert java.math.BigDecimal to ICU BigDecimal to format.
129-
// Bug #180392.
130-
BigDecimal o = (BigDecimal) fromObject;
131-
try {
132-
fromObject = icuBigDecimalCtr.newInstance(o.unscaledValue(), Integer.valueOf(o.scale()));
133-
} catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
134-
}
135-
// Otherwise, replacement plugin present and supports java.math.BigDecimal.
136-
}
13799
synchronized (numberFormat) {
138100
result = numberFormat.format(fromObject);
139101
}

bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/AbstractStringToNumberConverter.java

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
******************************************************************************/
1414
package org.eclipse.core.internal.databinding.conversion;
1515

16-
import java.lang.reflect.InvocationTargetException;
17-
import java.lang.reflect.Method;
1816
import java.math.BigDecimal;
1917
import java.math.BigInteger;
2018
import java.text.Format;
@@ -25,8 +23,7 @@
2523

2624
/**
2725
* Converts a String to a Number using <code>Format.parse(...)</code>. This
28-
* class is thread safe. This class is used to share code between converters
29-
* that are based on ICU and java.text.
26+
* class is thread safe.
3027
*
3128
* @param <T> The type to which values are converted.
3229
*/
@@ -75,32 +72,6 @@ public class AbstractStringToNumberConverter<T extends Number> extends NumberFor
7572
protected static final Byte MIN_BYTE = Byte.valueOf(Byte.MIN_VALUE);
7673
protected static final Byte MAX_BYTE = Byte.valueOf(Byte.MAX_VALUE);
7774

78-
static Class<?> icuBigDecimal = null;
79-
static Method icuBigDecimalScale = null;
80-
static Method icuBigDecimalUnscaledValue = null;
81-
82-
{
83-
/*
84-
* If the full ICU4J library is available, we use the ICU BigDecimal
85-
* class to support proper formatting and parsing of java.math.BigDecimal.
86-
*
87-
* The version of ICU NumberFormat (DecimalFormat) included in eclipse excludes
88-
* support for java.math.BigDecimal, and if used falls back to converting as
89-
* an unknown Number type via doubleValue(), which is undesirable.
90-
*
91-
* See Bug #180392.
92-
*/
93-
try {
94-
icuBigDecimal = Class.forName("com.ibm.icu.math.BigDecimal"); //$NON-NLS-1$
95-
icuBigDecimalScale = icuBigDecimal.getMethod("scale"); //$NON-NLS-1$
96-
icuBigDecimalUnscaledValue = icuBigDecimal.getMethod("unscaledValue"); //$NON-NLS-1$
97-
/* System.out.println("DEBUG: Full ICU4J support state: icuBigDecimal="+ //$NON-NLS-1$
98-
(icuBigDecimal != null)+", icuBigDecimalScale="+(icuBigDecimalScale != null)+ //$NON-NLS-1$
99-
", icuBigDecimalUnscaledValue="+(icuBigDecimalUnscaledValue != null)); //$NON-NLS-1$ */
100-
}
101-
catch(ClassNotFoundException | NoSuchMethodException e) {}
102-
}
103-
10475
/**
10576
* @param numberFormat used to parse the strings numbers.
10677
* @param toType target number type.
@@ -194,27 +165,16 @@ public T convert(Object fromObject) {
194165
return (T) new BigDecimal((BigInteger) n);
195166
} else if(n instanceof BigDecimal) {
196167
return (T) n;
197-
} else if(icuBigDecimal != null && icuBigDecimal.isInstance(n)) {
198-
try {
199-
// Get ICU BigDecimal value and use to construct java.math.BigDecimal
200-
int scale = ((Integer) icuBigDecimalScale.invoke(n)).intValue();
201-
BigInteger unscaledValue = (BigInteger) icuBigDecimalUnscaledValue.invoke(n);
202-
return (T) new java.math.BigDecimal(unscaledValue, scale);
203-
} catch(IllegalAccessException e) {
204-
throw new IllegalArgumentException("Error (IllegalAccessException) converting BigDecimal using ICU"); //$NON-NLS-1$
205-
} catch(InvocationTargetException e) {
206-
throw new IllegalArgumentException("Error (InvocationTargetException) converting BigDecimal using ICU"); //$NON-NLS-1$
207-
}
208168
} else if(n instanceof Double) {
209169
BigDecimal bd = BigDecimal.valueOf(n.doubleValue());
210170
if (bd.scale() == 0) {
211171
return (T) bd;
212172
}
213173
throw new IllegalArgumentException("Non-integral Double value returned from NumberFormat " + //$NON-NLS-1$
214-
"which cannot be accurately stored in a BigDecimal due to lost precision. " + //$NON-NLS-1$
215-
"Consider using ICU4J or Java 5 which can properly format and parse these types."); //$NON-NLS-1$
174+
"which cannot be accurately stored in a BigDecimal due to lost precision."); //$NON-NLS-1$
216175
}
217-
} else if (Short.class.equals(boxedType)) {
176+
}
177+
else if (Short.class.equals(boxedType)) {
218178
if (StringToNumberParser.inShortRange(result.getNumber())) {
219179
return (T) Short.valueOf(result.getNumber().shortValue());
220180
}

bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToNumberParser.java

Lines changed: 5 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@
1414

1515
package org.eclipse.core.internal.databinding.conversion;
1616

17-
import java.lang.reflect.Method;
1817
import java.math.BigDecimal;
1918
import java.math.BigInteger;
2019
import java.text.DecimalFormat;
2120
import java.text.Format;
2221
import java.text.NumberFormat;
2322
import java.text.ParsePosition;
24-
import java.util.function.Supplier;
2523

2624
import org.eclipse.core.internal.databinding.BindingMessages;
2725

@@ -37,12 +35,6 @@ public class StringToNumberParser {
3735
private static final BigDecimal DOUBLE_MAX_BIG_DECIMAL = BigDecimal.valueOf(Double.MAX_VALUE);
3836
private static final BigDecimal DOUBLE_MIN_BIG_DECIMAL = BigDecimal.valueOf(-Double.MAX_VALUE);
3937

40-
private static final Supplier<Format> GET_INSTANCE = findMethod(NumberFormat::getInstance, "getInstance"); //$NON-NLS-1$
41-
private static final Supplier<Format> GET_NUMBER_INSTANCE = findMethod(NumberFormat::getNumberInstance,
42-
"getNumberInstance"); //$NON-NLS-1$
43-
private static final Supplier<Format> GET_INTEGER_INSTANCE = findMethod(NumberFormat::getIntegerInstance,
44-
"getIntegerInstance"); //$NON-NLS-1$
45-
4638
/**
4739
* @return result
4840
*/
@@ -181,12 +173,6 @@ private static boolean checkInteger(Number number, int bitLength) {
181173
} else if (number instanceof BigDecimal) {
182174
bigInteger = ((BigDecimal) number).toBigInteger();
183175
} else {
184-
/*
185-
* The else is necessary as the ICU4J plugin has it's own BigDecimal
186-
* implementation which isn't part of the replacement plugin. So
187-
* that this will work we fall back on the double value of the
188-
* number.
189-
*/
190176
bigInteger = BigDecimal.valueOf(number.doubleValue()).toBigInteger();
191177
}
192178

@@ -241,16 +227,6 @@ private static boolean checkDecimal(Number number, BigDecimal min,
241227
} else if (number instanceof BigDecimal) {
242228
bigDecimal = (BigDecimal) number;
243229
} else {
244-
/*
245-
* The else is necessary as the ICU4J plugin has it's own BigDecimal
246-
* implementation which isn't part of the replacement plugin. So
247-
* that this will work we fall back on the double value of the
248-
* number.
249-
*/
250-
// if this is ever taken out, take care to un-comment the throw
251-
// clause and the if condition below, they were commented because
252-
// the
253-
// compiler complained about dead code..
254230
double doubleValue = number.doubleValue();
255231

256232
if (!Double.isNaN(doubleValue) && !Double.isInfinite(doubleValue)) {
@@ -262,9 +238,6 @@ private static boolean checkDecimal(Number number, BigDecimal min,
262238

263239
/* if (bigDecimal != null) */return max.compareTo(bigDecimal) >= 0
264240
&& min.compareTo(bigDecimal) <= 0;
265-
266-
// throw new IllegalArgumentException(
267-
// "Number of type [" + number.getClass().getName() + "] is not supported."); //$NON-NLS-1$ //$NON-NLS-2$
268241
}
269242

270243
/**
@@ -302,24 +275,20 @@ public static boolean inByteRange(Number number) {
302275

303276
/**
304277
* Returns the default number format.
305-
* {@code com.ibm.icu.text.NumberFormat.getNumberInstance()} if it is available,
306-
* otherwise {@code java.text.NumberFormat.getNumberInstance()}.
307278
*
308279
* @return the number format
309280
*/
310281
public static Format getDefaultFormat() {
311-
return GET_INSTANCE.get();
282+
return NumberFormat.getInstance();
312283
}
313284

314285
/**
315286
* Returns the default number format.
316-
* {@code com.ibm.icu.text.NumberFormat.getNumberInstance()} if it is available,
317-
* otherwise {@code java.text.NumberFormat.getNumberInstance()}.
318287
*
319288
* @return the number format
320289
*/
321290
public static Format getDefaultBigDecimalFormat() {
322-
Format format = GET_NUMBER_INSTANCE.get();
291+
Format format = NumberFormat.getNumberInstance();
323292
if (format instanceof DecimalFormat) {
324293
((DecimalFormat) format).setParseBigDecimal(true);
325294
}
@@ -328,59 +297,32 @@ public static Format getDefaultBigDecimalFormat() {
328297

329298
/**
330299
* Returns the default number format.
331-
* {@code com.ibm.icu.text.NumberFormat.getNumberInstance()} if ICU is
332-
* available, otherwise {@code java.text.NumberFormat.getNumberInstance()}.
333300
*
334301
* @return the number format
335302
*/
336303
public static Format getDefaultNumberFormat() {
337-
return GET_NUMBER_INSTANCE.get();
304+
return NumberFormat.getNumberInstance();
338305
}
339306

340307
/**
341308
* Returns the default integer format.
342-
* {@code com.ibm.icu.text.NumberFormat.getIntegerInstance()} if ICU is
343-
* available, otherwise {@code java.text.NumberFormat.getIntegerInstance()}.
344309
*
345310
* @return the number format
346311
*/
347312
public static Format getDefaultIntegerFormat() {
348-
return GET_INTEGER_INSTANCE.get();
313+
return NumberFormat.getIntegerInstance();
349314
}
350315

351316
/**
352317
* Returns the default integer format.
353-
* {@code com.ibm.icu.text.NumberFormat.getIntegerInstance()} if ICU is
354-
* available, otherwise {@code java.text.NumberFormat.getIntegerInstance()}.
355318
*
356319
* @return the number format
357320
*/
358321
public static Format getDefaultIntegerBigDecimalFormat() {
359-
Format format = GET_INTEGER_INSTANCE.get();
322+
Format format = NumberFormat.getIntegerInstance();
360323
if (format instanceof DecimalFormat) {
361324
((DecimalFormat) format).setParseBigDecimal(true);
362325
}
363326
return format;
364327
}
365-
366-
/**
367-
* Creates a factory for {@link Format}s. The factory uses ICU if it is
368-
* available on the class path, otherwise it uses the given supplier.
369-
*/
370-
private static Supplier<Format> findMethod(Supplier<Format> javaTextMethod, String methodName) {
371-
try {
372-
Method method = Class.forName("com.ibm.icu.text.NumberFormat").getMethod(methodName); //$NON-NLS-1$
373-
return () -> {
374-
try {
375-
return (Format) method.invoke(null);
376-
} catch (ReflectiveOperationException e) {
377-
throw new RuntimeException(e); // Should never happen
378-
}
379-
};
380-
} catch (ClassNotFoundException | SecurityException e) {
381-
return javaTextMethod;
382-
} catch (NoSuchMethodException e) {
383-
throw new RuntimeException(e); // Should never happen
384-
}
385-
}
386328
}

bundles/org.eclipse.e4.ui.css.core/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Bundle-SymbolicName: org.eclipse.e4.ui.css.core;singleton:=true
44
Bundle-Name: %pluginName
55
Bundle-Vendor: %providerName
66
Bundle-Localization: plugin
7-
Bundle-Version: 0.14.700.qualifier
7+
Bundle-Version: 0.14.800.qualifier
88
Export-Package: org.eclipse.e4.ui.css.core;x-internal:=true,
99
org.eclipse.e4.ui.css.core.css2;x-friends:="org.eclipse.e4.ui.css.swt.theme,org.eclipse.e4.ui.css.swt,org.eclipse.e4.ui.css.jface",
1010
org.eclipse.e4.ui.css.core.dom;x-friends:="org.eclipse.e4.ui.css.swt,org.eclipse.ui.views.properties.tabbed,org.eclipse.ui.forms",

bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/dom/properties/ICSSPropertyHandler.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,23 @@ public default String retrieveCSSProperty(Object element, String property, Strin
6363
return null;
6464
}
6565

66+
/**
67+
* Callback method called once after all CSS properties of a single
68+
* declaration have been applied. Handlers that need to perform a final
69+
* step (re-layout, redraw, batched commit, ...) override this method;
70+
* the default is a no-op.
71+
*/
72+
default void onAllCSSPropertiesApplied(Object element, CSSEngine engine) throws Exception {
73+
// do nothing
74+
}
75+
76+
/**
77+
* Variant of {@link #onAllCSSPropertiesApplied(Object, CSSEngine)} that
78+
* also receives the pseudo class. Defaults to delegating to the
79+
* pseudo-less form.
80+
*/
81+
default void onAllCSSPropertiesApplied(Object element, CSSEngine engine, String pseudo) throws Exception {
82+
onAllCSSPropertiesApplied(element, engine);
83+
}
84+
6685
}

0 commit comments

Comments
 (0)