1 package org.simantics.modeling.ui.actions;
3 import org.simantics.Simantics;
4 import org.simantics.db.Resource;
5 import org.simantics.db.common.request.PossibleIndexRoot;
6 import org.simantics.db.exception.DatabaseException;
7 import org.simantics.db.layer0.adapter.ActionFactory;
8 import org.simantics.modeling.ui.ModelingUIUtils;
9 import org.simantics.utils.ui.ErrorLogger;
12 * @author Antti Villberg
14 public class NewSCLQuery implements ActionFactory {
17 public Runnable create(Object target) {
18 if(!(target instanceof Resource))
20 final Resource parent = (Resource)target;
22 return new Runnable() {
26 Resource indexRoot = Simantics.getSession().syncRequest(new PossibleIndexRoot(parent));
27 if(indexRoot == null) return;
28 Simantics.getSession().markUndoPoint();
29 ModelingUIUtils.newSCLQuery(parent, indexRoot);
30 } catch (DatabaseException e) {
31 ErrorLogger.defaultLogError(e);