Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Furnadjiev2016-09-09 14:08:53 +0000
committerIvan Furnadjiev2016-09-13 08:54:49 +0000
commit4f624cae815fc953dea418ab3be4213055ebb3a2 (patch)
tree629e6d8d3680c0c79e0a8968d0996c6e535d7e24 /bundles
parent27bd3cd2161d8be9a1b27669f9d22a428a85f635 (diff)
downloadorg.eclipse.rap-4f624cae815fc953dea418ab3be4213055ebb3a2.tar.gz
org.eclipse.rap-4f624cae815fc953dea418ab3be4213055ebb3a2.tar.xz
org.eclipse.rap-4f624cae815fc953dea418ab3be4213055ebb3a2.zip
Add support for changing text size storage size by system property
In some complex applications the limit of keeping only 10 000 measured strings is not enough. The application performance decreases dramatically when this limit is reached as TSD requests are sent again and again. Read text size store size from system property "org.eclipse.rap.rwt.textSizeStoreSize" if set or use 10 000 as default. 501159: TextSizeDetermination causes high CPU usage and flickering https://bugs.eclipse.org/bugs/show_bug.cgi?id=501159 Change-Id: I5d2d3d14b8c22f43c9d8c821edb7e26154ae3279
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/RWTProperties.java14
-rw-r--r--bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/textsize/TextSizeStorage.java7
2 files changed, 19 insertions, 2 deletions
diff --git a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/RWTProperties.java b/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/RWTProperties.java
index dd3f423da9..f27c07e884 100644
--- a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/RWTProperties.java
+++ b/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/RWTProperties.java
@@ -16,6 +16,7 @@ public final class RWTProperties {
public static final String SERVICE_HANDLER_BASE_URL = "org.eclipse.rap.rwt.serviceHandlerBaseURL";
public static final String DEVELOPMEMT_MODE = "org.eclipse.rap.rwt.developmentMode";
+ public static final String TEXT_SIZE_STORE_SIZE = "org.eclipse.rap.rwt.textSizeStoreSize";
/*
* Used in conjunction with <code>WidgetUtil#CUSTOM_WIDGET_ID</code>,
@@ -35,9 +36,22 @@ public final class RWTProperties {
return getBooleanProperty( DEVELOPMEMT_MODE, false );
}
+ public static int getTextSizeStoreSize( int defaultValue ) {
+ return getIntProperty( TEXT_SIZE_STORE_SIZE, defaultValue );
+ }
+
public static boolean getBooleanProperty( String name, boolean defaultValue ) {
String value = System.getProperty( name );
return value == null ? defaultValue : value.equalsIgnoreCase( "true" );
}
+ public static int getIntProperty( String name, int defaultValue ) {
+ String value = System.getProperty( name );
+ try {
+ return Integer.parseInt( value );
+ } catch ( @SuppressWarnings( "unused" ) NumberFormatException ex ) {
+ return defaultValue;
+ }
+ }
+
}
diff --git a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/textsize/TextSizeStorage.java b/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/textsize/TextSizeStorage.java
index d42ce04a3b..b0d8fce6a1 100644
--- a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/textsize/TextSizeStorage.java
+++ b/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/internal/textsize/TextSizeStorage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2015 Innoopract Informationssysteme GmbH and others.
+ * Copyright (c) 2007, 2016 Innoopract Informationssysteme GmbH 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
@@ -11,6 +11,8 @@
******************************************************************************/
package org.eclipse.rap.rwt.internal.textsize;
+import static org.eclipse.rap.rwt.internal.RWTProperties.getTextSizeStoreSize;
+
import java.io.Serializable;
import java.math.BigDecimal;
import java.text.MessageFormat;
@@ -26,6 +28,7 @@ import org.eclipse.swt.graphics.Point;
public final class TextSizeStorage {
+
public static final int MIN_STORE_SIZE = 1000;
public static final int DEFAULT_STORE_SIZE = 10000;
@@ -63,7 +66,7 @@ public final class TextSizeStorage {
lock = new Object();
data = new HashMap<>();
fontDatas = new HashSet<>();
- setMaximumStoreSize( DEFAULT_STORE_SIZE );
+ setMaximumStoreSize( getTextSizeStoreSize( DEFAULT_STORE_SIZE ) );
}
FontData[] getFontList() {

Back to the top