Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2008-11-21 17:33:11 +0000
committerChris Goldthorpe2008-11-21 17:33:11 +0000
commit311dcdd1fd7441c4642d588bd9968a65b01f1990 (patch)
treec0c50d656971d71e6bf765dfef5ad0dd79f28fc5 /org.eclipse.help
parent3107fec8439f317added6d91002eed275e879a39 (diff)
downloadeclipse.platform.ua-311dcdd1fd7441c4642d588bd9968a65b01f1990.tar.gz
eclipse.platform.ua-311dcdd1fd7441c4642d588bd9968a65b01f1990.tar.xz
eclipse.platform.ua-311dcdd1fd7441c4642d588bd9968a65b01f1990.zip
Move isRTL() function to org.eclipse.help
Diffstat (limited to 'org.eclipse.help')
-rw-r--r--org.eclipse.help/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/util/ProductPreferences.java51
2 files changed, 52 insertions, 2 deletions
diff --git a/org.eclipse.help/META-INF/MANIFEST.MF b/org.eclipse.help/META-INF/MANIFEST.MF
index 63f82829b..f48d28b9c 100644
--- a/org.eclipse.help/META-INF/MANIFEST.MF
+++ b/org.eclipse.help/META-INF/MANIFEST.MF
@@ -47,7 +47,8 @@ Export-Package: org.eclipse.help,
org.eclipse.help.ui,
org.eclipse.help.webapp,
org.eclipse.ua.tests,
- org.eclipse.ui.intro.universal"
+ org.eclipse.ui.intro.universal,
+ org.eclipse.ui.intro"
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.1.0,4.0.0)",
org.eclipse.core.expressions;bundle-version="[3.3.0,4.0.0)";visibility:=reexport
Eclipse-LazyStart: true
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/util/ProductPreferences.java b/org.eclipse.help/src/org/eclipse/help/internal/util/ProductPreferences.java
index de6cf3905..dd467492a 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/util/ProductPreferences.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/util/ProductPreferences.java
@@ -22,6 +22,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
@@ -53,7 +54,9 @@ public class ProductPreferences {
private static Map preferencesToProductIdMap;
private static List primaryTocOrdering;
private static List[] secondaryTocOrderings;
- private static final String PLUGINS_ROOT_SLASH = "PLUGINS_ROOT/"; //$NON-NLS-1$
+ private static final String PLUGINS_ROOT_SLASH = "PLUGINS_ROOT/"; //$NON-NLS-1$
+ private static boolean rtl;
+ private static boolean directionInitialized = false;
/*
* Returns the recommended order to display the given toc entries in. Each
@@ -399,4 +402,50 @@ public class ProductPreferences {
public static void resetPrimaryTocOrdering() {
primaryTocOrdering = null;
}
+
+ public static boolean isRTL() {
+ if (!directionInitialized) {
+ directionInitialized = true;
+ rtl = initializeRTL();
+ }
+ return rtl;
+ }
+
+ private static boolean initializeRTL() {
+ // from property
+ String orientation = System.getProperty("eclipse.orientation"); //$NON-NLS-1$
+ if ("rtl".equals(orientation)) { //$NON-NLS-1$
+ return true;
+ } else if ("ltr".equals(orientation)) { //$NON-NLS-1$
+ return false;
+ }
+ // from command line
+ String[] args = Platform.getCommandLineArgs();
+ for (int i = 0; i < args.length; i++) {
+ if ("-dir".equalsIgnoreCase(args[i])) { //$NON-NLS-1$
+ if ((i + 1) < args.length
+ && "rtl".equalsIgnoreCase(args[i + 1])) { //$NON-NLS-1$
+ return true;
+ }
+ return false;
+ }
+ }
+
+ // Check if the user property is set. If not do not
+ // rely on the vm.
+ if (System.getProperty("osgi.nl.user") == null) //$NON-NLS-1$
+ return false;
+
+ // guess from default locale
+ String locale = Platform.getNL();
+ if (locale == null) {
+ locale = Locale.getDefault().toString();
+ }
+ if (locale.startsWith("ar") || locale.startsWith("fa") //$NON-NLS-1$//$NON-NLS-2$
+ || locale.startsWith("he") || locale.startsWith("iw") //$NON-NLS-1$//$NON-NLS-2$
+ || locale.startsWith("ur")) { //$NON-NLS-1$
+ return true;
+ }
+ return false;
+ }
}

Back to the top