Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
blob: b4dc81a31e566d1c298ad620ed61d9888f086479 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package org.eclipse.wst.ws.internal.explorer.platform.util;

import java.util.Locale;
import org.eclipse.core.runtime.Platform;

public final class DirUtils
{
  public static boolean isRTL()
  {
    return "rtl".equals(getDir());
  }

  public static String getDir()
  {
    String rtl = "rtl";
    String ltr = "ltr";

    // from system property
    String orientation = System.getProperty("eclipse.orientation"); //$NON-NLS-1$
    if (rtl.equals(orientation)) //$NON-NLS-1$
      return rtl;
    else if (ltr.equals(orientation)) //$NON-NLS-1$
      return ltr;

    // 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 rtl;
        }
        return ltr;
      }
    }

    // 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 ltr;

    // 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 rtl;
    }
    return ltr;
  }
}

Back to the top