Java Code Examples for org.openide.util.NbBundle#getBranding()

The following examples show how to use org.openide.util.NbBundle#getBranding() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocaleVariants.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Similar to {@link NbBundle#getLocalizingSuffixes} but optimized.
 * @since JST-PENDING: Called from InstalledFileLocatorImpl
 */
static synchronized String[] getLocalizingSuffixesFast() {
    if (suffixes == null ||
            Locale.getDefault() != lastLocale ||
            !BaseUtilities.compareObjects(NbBundle.getBranding(), lastBranding)) {
        List<String> _suffixes = new ArrayList<String>();
        Iterator<String> it = NbBundle.getLocalizingSuffixes();
        while (it.hasNext()) {
            _suffixes.add(it.next());
        }
        suffixes = _suffixes.toArray(new String[_suffixes.size()]);
        lastLocale = Locale.getDefault();
        lastBranding = NbBundle.getBranding();
    }
    return suffixes;
}
 
Example 2
Source File: NbInstallerTest3.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Test #21173/#23595: overriding layers by branding. */
public void testBrandingLayerOverrides() throws Exception {
    Main.getModuleSystem ();
    final MockEvents ev = new MockEvents();
    NbInstaller installer = new NbInstaller(ev);
    ModuleManager mgr = new ModuleManager(installer, ev);
    installer.registerManager(mgr);
    mgr.mutexPrivileged().enterWriteAccess();
    try {
        String orig = NbBundle.getBranding();
        NbBundle.setBranding("foo");
        try {
            Module m1 = mgr.create(new File(jars, "base-layer-mod.jar"), null, false, false, false);
            assertEquals(Collections.EMPTY_SET, m1.getProblems());
            mgr.enable(m1);
            assertEquals("special contents", slurp("foo/file1.txt"));
            assertEquals(null, slurp("foo/file2.txt"));
            mgr.disable(m1);
            mgr.delete(m1);
        } finally {
            NbBundle.setBranding(orig);
        }
    } finally {
        mgr.mutexPrivileged().exitWriteAccess();
    }
}
 
Example 3
Source File: StampsTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
    branding = NbBundle.getBranding();
    locale = Locale.getDefault();
    
    clearWorkDir();
    
    install = new File(getWorkDir(), "install");
    platform = new File(install, "platform");
    ide = createIdeCluster(install);
    userdir = new File(getWorkDir(), "tmp");
    
    System.setProperty("netbeans.home", platform.getPath());
    System.setProperty("netbeans.dirs", ide.getPath());
    System.setProperty("netbeans.user", userdir.getPath());
    
    createModule("org.openide.awt", platform, 50000L);
    createModule("org.openide.nodes", platform, 60000L);
    createModule("org.netbeans.api.languages", ide, 90000L);
    createModule("org.netbeans.modules.logmanagement", userdir, 10000L);
    
    reset();
    
    Thread.sleep(100);

    Logger l = Logger.getLogger("org");
    l.setLevel(Level.OFF);
    l.setUseParentHandlers(false);
}
 
Example 4
Source File: StampsNoFallbackTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
    branding = NbBundle.getBranding();
    locale = Locale.getDefault();
    
    clearWorkDir();
    
    install = new File(getWorkDir(), "install");
    platform = new File(install, "platform");
    ide = new File(install, "ide");
    userdir = new File(getWorkDir(), "tmp");
    
    System.setProperty("netbeans.home", platform.getPath());
    System.setProperty("netbeans.dirs", ide.getPath());
    System.setProperty("netbeans.user", userdir.getPath());
    
    createModule("org.openide.awt", platform, 50000L);
    createModule("org.openide.nodes", platform, 60000L);
    createModule("org.netbeans.api.languages", ide, 90000L);
    createModule("org.netbeans.modules.logmanagement", userdir, 10000L);
    
    Thread.sleep(100);
    
    createPopulateZip();

    Logger l = Logger.getLogger("org");
    l.setLevel(Level.OFF);
    l.setUseParentHandlers(false);
}
 
Example 5
Source File: StampsDifferentPopulateTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
    branding = NbBundle.getBranding();
    locale = Locale.getDefault();
    
    clearWorkDir();
    
    install = new File(getWorkDir(), "install");
    platform = new File(install, "platform");
    ide = new File(install, "ide");
    userdir = new File(getWorkDir(), "tmp");
    cache = new File(install, "cache");
    
    System.setProperty("netbeans.home", platform.getPath());
    System.setProperty("netbeans.dirs", ide.getPath());
    System.setProperty("netbeans.user", userdir.getPath());
    
    createModule("org.openide.awt", platform, 50000L);
    createModule("org.openide.nodes", platform, 60000L);
    createModule("org.netbeans.api.languages", ide, 90000L);
    createModule("org.netbeans.modules.logmanagement", userdir, 10000L);
    
    Thread.sleep(100);
    
    createPopulateZip();

    Logger l = Logger.getLogger("org");
    l.setLevel(Level.OFF);
    l.setUseParentHandlers(false);
}
 
Example 6
Source File: StampsPopulateTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
    branding = NbBundle.getBranding();
    locale = Locale.getDefault();
    
    clearWorkDir();
    
    install = new File(getWorkDir(), "install");
    platform = new File(install, "platform");
    ide = new File(install, "ide");
    userdir = new File(getWorkDir(), "tmp");
    
    System.setProperty("netbeans.home", platform.getPath());
    System.setProperty("netbeans.dirs", ide.getPath());
    System.setProperty("netbeans.user", userdir.getPath());
    
    createModule("org.openide.awt", platform, 50000L);
    createModule("org.openide.nodes", platform, 60000L);
    createModule("org.netbeans.api.languages", ide, 90000L);
    createModule("org.netbeans.modules.logmanagement", userdir, 10000L);
    
    Thread.sleep(100);
    
    createPopulateZip();

    Logger l = Logger.getLogger("org");
    l.setLevel(Level.OFF);
    l.setUseParentHandlers(false);
}
 
Example 7
Source File: DictionaryProviderImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Creates new LocaleIterator for given locale.
         * @param locale given Locale
         */
        public LocaleIterator(Locale locale) {
            this.locale = this.initLocale = locale;
//            if (locale.equals(Locale.getDefault())) {
//                defaultInProgress = true;
//            }
            current = '_' + locale.toString();
            if (NbBundle.getBranding() == null)
                branding = null;
            else
                branding = "_" + NbBundle.getBranding(); // NOI18N
            //System.err.println("Constructed: " + this);
        }
 
Example 8
Source File: ModuleManager.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private String nonNullBranding() {
    String s = NbBundle.getBranding();
    return s == null ? "" : s;
}
 
Example 9
Source File: ProductInformationPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public static String getSystemLocaleValue () {
    String branding;
    return Locale.getDefault().toString() + ((branding = NbBundle.getBranding()) == null ? "" : (" (" + branding + ")")); // NOI18N
}
 
Example 10
Source File: BrandingAssignedTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void testBrandingIsAssigned() throws Exception {
    String branding = NbBundle.getBranding();
    assertEquals("Default branding in NetBeans is nb", "nb", branding);
}
 
Example 11
Source File: AboutAction.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
private static String getEnvironment() {
    String branding = NbBundle.getBranding();
    String encoding = System.getProperty("file.encoding", "unknown");   // NOI18N
    String locale = Locale.getDefault().toString() + (branding == null ? "" : (" (" + branding + ")")); // NOI18N
    return encoding + "; " + locale;
}