import java.util.Arrays;
import java.util.Collection;
+import java.util.List;
import java.util.function.Consumer;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
+import org.simantics.Simantics;
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
import org.simantics.db.common.request.UnaryRead;
import org.simantics.ui.selection.WorkbenchSelectionUtils;
import org.simantics.utils.threads.ThreadUtils;
import org.simantics.utils.ui.ISelectionUtils;
+import org.simantics.utils.ui.SWTUtils;
/**
* @author Tuukka Lehtonen
openEditorWithSelection(DistrictDiagramEditor.ID, input, selection);
}
+ public static boolean openDNDiagramWithSelection(Display display, List<Resource> dnElements) throws DatabaseException {
+ if (dnElements.isEmpty())
+ return false;
+
+ Input in = Simantics.getSession().syncRequest(
+ new ElementToInput(dnElements.get(0)));
+ if (in == null)
+ return false;
+
+ SWTUtils.asyncExec(display,
+ () -> openDNDiagramEditorWithSelection(in, dnElements.toArray()));
+ return true;
+ }
+
}