]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/property/RestoreDefaultValueHandler.java
Handle componentless parent nodes of UCs in synchronization
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / property / RestoreDefaultValueHandler.java
index a439527ca4b73bc364c10304946236d7d6b1e5d7..179173ede933e5b35b89090fc1e999437c42831c 100644 (file)
@@ -21,6 +21,7 @@ import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.eclipse.ui.part.IPage;
 import org.eclipse.ui.part.PageBookView;
+import org.simantics.Simantics;
 import org.simantics.browsing.ui.common.ErrorLogger;
 import org.simantics.browsing.ui.common.property.IProperty;
 import org.simantics.db.Resource;
@@ -31,9 +32,7 @@ import org.simantics.db.common.utils.NameUtils;
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.layer0.variable.Variable;
 import org.simantics.db.management.ISessionContext;
-import org.simantics.ui.SimanticsUI;
 import org.simantics.ui.workbench.IPropertyPage;
-import org.simantics.utils.datastructures.Callback;
 import org.simantics.utils.ui.ISelectionUtils;
 
 
@@ -55,7 +54,7 @@ public class RestoreDefaultValueHandler extends AbstractHandler {
         // Cannot use this, since the property view does not contribute a selection back to the workbench.
         //HandlerUtil.getCurrentSelection(event);
 
-        ISessionContext sc = SimanticsUI.getSessionContext();
+        ISessionContext sc = Simantics.getSessionContext();
         if (sc == null)
             return null;
 
@@ -113,12 +112,9 @@ public class RestoreDefaultValueHandler extends AbstractHandler {
                 }
                 graph.addMetadata(cm);
             }
-        }, new Callback<DatabaseException>() {
-            @Override
-            public void run(DatabaseException parameter) {
-                if (parameter != null)
-                    ErrorLogger.defaultLogError("Failed to restore default property values, see exception for details.", parameter);
-            }
+        }, e -> {
+            if (e != null)
+                ErrorLogger.defaultLogError("Failed to restore default property values, see exception for details.", e);
         });
     }
 
@@ -142,12 +138,9 @@ public class RestoreDefaultValueHandler extends AbstractHandler {
                         }
                     }
                 }
-            }, new Callback<DatabaseException>() {
-                @Override
-                public void run(DatabaseException parameter) {
-                    if (parameter != null)
-                        ErrorLogger.defaultLogError("Failed to restore default property values, see exception for details.", parameter);
-                }
+            }, e -> {
+                if (e != null)
+                    ErrorLogger.defaultLogError("Failed to restore default property values, see exception for details.", e);
             });
         }
         return changes;