예제 #1
0
 /**
  * Used to indicate whether of not we are running in an environment where GUI interaction is
  * available.
  *
  * <p>Note that this method is security checked and is not available to (for example) untrusted
  * applets. More specifically, if there is a security manager, its <code>checkPropertiesAccess
  * </code> method is called. This could result in a SecurityException.
  *
  * @param isGuiAvailable True if GUI interaction is available.
  * @exception SecurityException if a security manager exists and its <code>checkPropertiesAccess
  *     </code> method doesn't allow setting of system properties.
  * @see SecurityManager#checkPropertiesAccess
  */
 public static void setGuiAvailable(boolean isGuiAvailable) throws SecurityException {
   SecurityManager sm = System.getSecurityManager();
   if (sm != null) {
     sm.checkPropertiesAccess();
   }
   guiAvailable = isGuiAvailable;
 }
예제 #2
0
 /**
  * Used to indicate whether of not we are running in an application builder environment.
  *
  * <p>Note that this method is security checked and is not available to (for example) untrusted
  * applets. More specifically, if there is a security manager, its <code>checkPropertiesAccess
  * </code> method is called. This could result in a SecurityException.
  *
  * @param isDesignTime True if we're in an application builder tool.
  * @exception SecurityException if a security manager exists and its <code>checkPropertiesAccess
  *     </code> method doesn't allow setting of system properties.
  * @see SecurityManager#checkPropertiesAccess
  */
 public static void setDesignTime(boolean isDesignTime) throws SecurityException {
   SecurityManager sm = System.getSecurityManager();
   if (sm != null) {
     sm.checkPropertiesAccess();
   }
   designTime = isDesignTime;
 }
 private static Border getNoFocusBorder() {
   if (System.getSecurityManager() != null) {
     return SAFE_NO_FOCUS_BORDER;
   } else {
     return noFocusBorder;
   }
 }
예제 #4
0
 public Insets getBorderInsets(Component c) {
   if (System.getSecurityManager() != null) {
     return SAFE_EDITOR_BORDER_INSETS;
   } else {
     return editorBorderInsets;
   }
 }
예제 #5
0
 /**
  * Checks that there are enough security permissions to make popup "always on top", which allows
  * to show it above the task bar.
  */
 static boolean canPopupOverlapTaskBar() {
   boolean result = true;
   try {
     SecurityManager sm = System.getSecurityManager();
     if (sm != null) {
       sm.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION);
     }
   } catch (SecurityException se) {
     // There is no permission to show popups over the task bar
     result = false;
   }
   return result;
 }
예제 #6
0
 public static boolean checkSecurity() {
   SecurityManager security = System.getSecurityManager();
   if (security != null) {
     try {
       security.checkPropertyAccess("user.dir");
       security.checkPropertyAccess("file.separator");
     } catch (SecurityException e) {
       System.out.println("SecurityManager restricts session recording.");
       return false;
     }
   }
   return true;
 }
예제 #7
0
 public void append(String text) {
   WordCheckPermission p = new WordCheckPermission(text, "insert");
   SecurityManager manager = System.getSecurityManager();
   if (manager != null) manager.checkPermission(p);
   super.append(text);
 }