Improve CMS View.
[lgpl/argeo-commons.git] / org.argeo.cms.ui / src / org / argeo / cms / ui / CmsView.java
index dcc1f1fd16b8b747723382dc071927e1246cb0ae..e18d4b4330d3098a6c8178fa71f1cda29382497b 100644 (file)
@@ -61,10 +61,22 @@ public interface CmsView {
        default <T> T doAs(PrivilegedAction<T> action) {
                throw new UnsupportedOperationException();
        }
-       
+
+       default Void runAs(Runnable runnable) {
+               return doAs(new PrivilegedAction<Void>() {
+
+                       @Override
+                       public Void run() {
+                               if (runnable != null)
+                                       runnable.run();
+                               return null;
+                       }
+               });
+       }
+
        default void stateChanged(String state, String title) {
        }
-       
+
        default CmsSession getCmsSession() {
                throw new UnsupportedOperationException();
        }