use of sun.security.action.GetPropertyAction in project jdk8u_jdk by JetBrains.
the class CMSManager method getModule.
public static synchronized PCMM getModule() {
if (cmmImpl != null) {
return cmmImpl;
}
CMMServiceProvider spi = AccessController.doPrivileged(new PrivilegedAction<CMMServiceProvider>() {
public CMMServiceProvider run() {
String cmmClass = System.getProperty("sun.java2d.cmm", "sun.java2d.cmm.lcms.LcmsServiceProvider");
ServiceLoader<CMMServiceProvider> cmmLoader = ServiceLoader.loadInstalled(CMMServiceProvider.class);
CMMServiceProvider spi = null;
for (CMMServiceProvider cmm : cmmLoader) {
spi = cmm;
if (cmm.getClass().getName().equals(cmmClass)) {
break;
}
}
return spi;
}
});
cmmImpl = spi.getColorManagementModule();
if (cmmImpl == null) {
throw new CMMException("Cannot initialize Color Management System." + "No CM module found");
}
GetPropertyAction gpa = new GetPropertyAction("sun.java2d.cmm.trace");
String cmmTrace = (String) AccessController.doPrivileged(gpa);
if (cmmTrace != null) {
cmmImpl = new CMMTracer(cmmImpl);
}
return cmmImpl;
}
use of sun.security.action.GetPropertyAction in project jdk8u_jdk by JetBrains.
the class Charset method defaultCharset.
/**
* Returns the default charset of this Java virtual machine.
*
* <p> The default charset is determined during virtual-machine startup and
* typically depends upon the locale and charset of the underlying
* operating system.
*
* @return A charset object for the default charset
*
* @since 1.5
*/
public static Charset defaultCharset() {
if (defaultCharset == null) {
synchronized (Charset.class) {
String csn = AccessController.doPrivileged(new GetPropertyAction("file.encoding"));
Charset cs = lookup(csn);
if (cs != null)
defaultCharset = cs;
else
defaultCharset = forName("UTF-8");
}
}
return defaultCharset;
}
use of sun.security.action.GetPropertyAction in project jdk8u_jdk by JetBrains.
the class PostEventQueue method needsXEmbed.
/**
* Returns whether default toolkit needs the support of the xembed
* from embedding host(if any).
* @return <code>true</code>, if XEmbed is needed, <code>false</code> otherwise
*/
public static boolean needsXEmbed() {
String noxembed = AccessController.doPrivileged(new GetPropertyAction("sun.awt.noxembed", "false"));
if ("true".equals(noxembed)) {
return false;
}
Toolkit tk = Toolkit.getDefaultToolkit();
if (tk instanceof SunToolkit) {
// concrete behavior
return ((SunToolkit) tk).needsXEmbedImpl();
} else {
// Non-SunToolkit doubtly might support XEmbed
return false;
}
}
use of sun.security.action.GetPropertyAction in project jdk8u_jdk by JetBrains.
the class ProviderFactory method getDefaultFactory.
/**
* Returns an implementation of a {@code ProviderFactory} which
* creates instances of Providers.
*
* The created Provider instances will be linked to all appropriate
* and enabled system-defined tracing mechanisms in the JDK.
*
* @return a {@code ProviderFactory} that is used to create Providers.
*/
public static ProviderFactory getDefaultFactory() {
HashSet<ProviderFactory> factories = new HashSet<ProviderFactory>();
// Try to instantiate a DTraceProviderFactory
String prop = AccessController.doPrivileged(new GetPropertyAction("com.sun.tracing.dtrace"));
if ((prop == null || !prop.equals("disable")) && DTraceProviderFactory.isSupported()) {
factories.add(new DTraceProviderFactory());
}
// Try to instantiate an output stream factory
prop = AccessController.doPrivileged(new GetPropertyAction("sun.tracing.stream"));
if (prop != null) {
for (String spec : prop.split(",")) {
PrintStream ps = getPrintStreamFromSpec(spec);
if (ps != null) {
factories.add(new PrintStreamProviderFactory(ps));
}
}
}
// factory that encapsulates that.
if (factories.size() == 0) {
return new NullProviderFactory();
} else if (factories.size() == 1) {
return factories.toArray(new ProviderFactory[1])[0];
} else {
return new MultiplexProviderFactory(factories);
}
}
use of sun.security.action.GetPropertyAction in project jdk8u_jdk by JetBrains.
the class MetalLookAndFeel method getCurrentTheme.
/**
* Return the theme currently being used by <code>MetalLookAndFeel</code>.
* If the current theme is {@code null}, the default theme is created.
*
* @return the current theme
* @see #setCurrentTheme
* @since 1.5
*/
public static MetalTheme getCurrentTheme() {
MetalTheme currentTheme;
AppContext context = AppContext.getAppContext();
currentTheme = (MetalTheme) context.get("currentMetalTheme");
if (currentTheme == null) {
// Theme here.
if (useHighContrastTheme()) {
currentTheme = new MetalHighContrastTheme();
} else {
// Create the default theme. We prefer Ocean, but will
// use DefaultMetalTheme if told to.
String theme = AccessController.doPrivileged(new GetPropertyAction("swing.metalTheme"));
if ("steel".equals(theme)) {
currentTheme = new DefaultMetalTheme();
} else {
currentTheme = new OceanTheme();
}
}
setCurrentTheme(currentTheme);
}
return currentTheme;
}
Aggregations