本文整理汇总了Java中org.openide.util.NbBundle.setBranding方法的典型用法代码示例。如果您正苦于以下问题:Java NbBundle.setBranding方法的具体用法?Java NbBundle.setBranding怎么用?Java NbBundle.setBranding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.util.NbBundle
的用法示例。
在下文中一共展示了NbBundle.setBranding方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBrandingChecked
import org.openide.util.NbBundle; //导入方法依赖的package包/类
public void testBrandingChecked() throws Exception {
Stamps s = Stamps.getModulesJARs();
ByteBuffer first = s.asByteBuffer("branding.cache");
assertNull("No cache yet", first);
s.scheduleSave(new SaveByte(), "branding.cache", false);
s.waitFor(false);
reset();
s = Stamps.getModulesJARs();
ByteBuffer snd = s.asByteBuffer("branding.cache");
assertNotNull("Cache found", snd);
reset();
NbBundle.setBranding("my_perfect_branding");
s = Stamps.getModulesJARs();
ByteBuffer third = s.asByteBuffer("branding.cache");
assertNull("Branding changed no cache found", third);
}
示例2: testBrandingLayerOverrides
import org.openide.util.NbBundle; //导入方法依赖的package包/类
/** 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();
}
}
示例3: setUp
import org.openide.util.NbBundle; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
clearWorkDir();
File home = new File(getWorkDir(), "home");
final File configModules = new File(new File(home, "config"), "Modules");
configModules.mkdirs();
new File(configModules, "a-b-c.xml").createNewFile();
File moduleDir = new File(home, "modules");
moduleDir.mkdirs();
System.setProperty("netbeans.home", home.getPath());
File ud = new File(getWorkDir(), "ud");
ud.mkdirs();
System.setProperty("netbeans.user", ud.getPath());
Locale.setDefault(Locale.ENGLISH);
NbBundle.setBranding("nb");
Thread.sleep(100);
Stamps.main("clear");
sampleModule = new File(moduleDir, "m1.jar");
mgr = createModuleManager();
mgr.shutDown();
Stamps.getModulesJARs().shutdown();
assertTrue("Cache has been created", Stamps.getModulesJARs().exists("all-manifests.dat"));
Stamps.main("init");
}
示例4: checkNbresLoc
import org.openide.util.NbBundle; //导入方法依赖的package包/类
private static void checkNbresLoc(String base, String ext) throws Exception {
String path = base + ext;
String type = ext.equals(".html") ? "text/html" : null;
URL u = new URL("nbresloc:" + path);
// Should initially be getting an unlocalized version:
NbBundle.setBranding(null);
Locale.setDefault(Locale.US);
assertEquals(path, suck(u));
assertEquals(type, contentType(u));
assertEquals(path.length(), contentLength(u));
// Make sure branding works.
NbBundle.setBranding("foo");
path = base + "_foo" + ext;
assertEquals(path, suck(u));
assertEquals(type, contentType(u));
assertEquals(path.length(), contentLength(u));
// Check unbranded but localized resources.
NbBundle.setBranding(null);
Locale.setDefault(Locale.JAPAN);
path = base + "_ja" + ext;
assertEquals(path, suck(u));
assertEquals(type, contentType(u));
assertEquals(path.length(), contentLength(u));
// Check both together.
NbBundle.setBranding("foo");
path = base + "_foo_ja" + ext;
assertEquals(path, suck(u));
assertEquals(type, contentType(u));
assertEquals(path.length(), contentLength(u));
}
示例5: setUp
import org.openide.util.NbBundle; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
clearWorkDir();
scratch = new File(getWorkDir(), "install");
nbhome = new File(scratch, "nbhome");
touch(file(nbhome, "a/b"));
touch(file(nbhome, "a/c"));
touch(file(nbhome, "d"));
touch(file(nbhome, "e/f/g"));
touch(file(nbhome, "loc/x.html"));
touch(file(nbhome, "loc/x_ja.html"));
touch(file(nbhome, "loc/x_foo.html"));
touch(file(nbhome, "loc/x_foo_ja.html"));
touch(file(nbhome, "loc/y.html"));
touch(file(nbhome, "h_ja"));
nbuser = new File(getWorkDir(), "nbuser");
touch(file(nbuser, "a/b"));
nbdir1 = new File(scratch, "nbdir1");
touch(file(nbdir1, "e/f/g"));
nbdir2 = new File(scratch, "nbdir2");
touch(file(nbdir2, "h"));
touch(file(nbdir2, "loc/y_foo.html"));
File nbdirx = new File(scratch, "nbdirx"); // nonexistent dir
System.setProperty("netbeans.home", nbhome.getAbsolutePath());
System.setProperty("netbeans.user", nbuser.getAbsolutePath());
System.setProperty("netbeans.dirs",
nbdir1.getAbsolutePath() + File.pathSeparatorChar +
nbdir2.getAbsolutePath() + File.pathSeparatorChar +
// Useless trailing separator intentional:
nbdirx.getAbsolutePath() + File.pathSeparatorChar);
NbBundle.setBranding("foo");
Locale.setDefault(Locale.JAPAN);
ifl = new InstalledFileLocatorImpl();
}
示例6: setUp
import org.openide.util.NbBundle; //导入方法依赖的package包/类
protected @Override void setUp() throws Exception {
super.setUp();
clearWorkDir();
scratch = new File(getWorkDir(), "install");
nbhome = new File(scratch, "nbhome");
touch(file(nbhome, "a/b"));
touch(file(nbhome, "a/c"));
touch(file(nbhome, "d"));
touch(file(nbhome, "e/f/g"));
touch(file(nbhome, "loc/x.html"));
touch(file(nbhome, "loc/x_ja.html"));
touch(file(nbhome, "loc/x_foo.html"));
touch(file(nbhome, "loc/x_foo_ja.html"));
touch(file(nbhome, "loc/y.html"));
touch(file(nbhome, "h_ja"));
nbuser = new File(getWorkDir(), "nbuser");
touch(file(nbuser, "a/b"));
nbdir1 = new File(scratch, "nbdir1");
touch(file(nbdir1, "e/f/g"));
nbdir2 = new File(scratch, "nbdir2");
touch(file(nbdir2, "h"));
touch(file(nbdir2, "loc/y_foo.html"));
File nbdirx = new File(scratch, "nbdirx"); // nonexistent dir
System.setProperty("netbeans.home", nbhome.getAbsolutePath());
PlacesTestUtils.setUserDirectory(nbuser);
System.setProperty("netbeans.dirs",
nbdir1.getAbsolutePath() + File.pathSeparatorChar +
nbdir2.getAbsolutePath() + File.pathSeparatorChar +
// Useless trailing separator intentional:
nbdirx.getAbsolutePath() + File.pathSeparatorChar);
NbBundle.setBranding("foo");
ifl = new InstalledFileLocatorImpl();
}
示例7: start
import org.openide.util.NbBundle; //导入方法依赖的package包/类
public @Override void start(final BundleContext context) throws Exception {
if (System.getProperty("netbeans.home") != null) {
throw new IllegalStateException("Should not be run from inside regular NetBeans module system");
}
String storage = context.getProperty(Constants.FRAMEWORK_STORAGE);
if (storage != null) {
System.setProperty("netbeans.user", storage);
}
System.setProperty("TopSecurityManager.disable", "true");
NbBundle.setBranding(System.getProperty("branding.token"));
OSGiMainLookup.initialize(context);
queue = new DependencyQueue<String,Bundle>();
this.context = context;
framework = ((Framework) context.getBundle(0));
if (framework.getState() == Bundle.STARTING) {
LOG.fine("framework still starting");
final AtomicReference<FrameworkListener> frameworkListener = new AtomicReference<FrameworkListener>();
frameworkListener.set(new FrameworkListener() {
public @Override void frameworkEvent(FrameworkEvent event) {
if (event.getType() == FrameworkEvent.STARTED) {
// System.err.println("framework started");
context.removeFrameworkListener(frameworkListener.get());
context.addBundleListener(Activator.this);
processLoadedBundles();
}
}
});
context.addFrameworkListener(frameworkListener.get());
} else {
LOG.fine("framework already started");
context.addBundleListener(this);
processLoadedBundles();
}
}
示例8: setUp
import org.openide.util.NbBundle; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
NbBundle.setBranding("big");
folder = FileUtil.getConfigFile("actions/support/test");
assertNotNull("testing layer is loaded: ", folder);
myIconResourceCounter = 0;
myListenerCalled = 0;
myListenerCounter = 0;
MyAction.last = null;
}
示例9: testLocalizingSuffixes
import org.openide.util.NbBundle; //导入方法依赖的package包/类
public static void testLocalizingSuffixes() throws Exception {
assertEquals("_en_US,_en,", locSuff());
Locale.setDefault(Locale.JAPAN);
assertEquals("_ja_JP,_ja,", locSuff());
NbBundle.setBranding("f4j_ce");
Locale.setDefault(Locale.US);
assertEquals("_f4j_ce_en_US,_f4j_ce_en,_f4j_ce,_f4j_en_US,_f4j_en,_f4j,_en_US,_en,", locSuff());
Locale.setDefault(Locale.JAPAN);
assertEquals("_f4j_ce_ja_JP,_f4j_ce_ja,_f4j_ce,_f4j_ja_JP,_f4j_ja,_f4j,_ja_JP,_ja,", locSuff());
}
示例10: tearDown
import org.openide.util.NbBundle; //导入方法依赖的package包/类
@Override
protected void tearDown() throws Exception {
NbBundle.setBranding(branding);
Locale.setDefault(locale);
}
示例11: setUp
import org.openide.util.NbBundle; //导入方法依赖的package包/类
protected void setUp() throws Exception {
Locale.setDefault(Locale.US);
NbBundle.setBranding(null);
NbBundle.localizedFileCache.clear();
NbBundle.bundleCache.clear();
}