import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.RVI;\r
import org.simantics.db.layer0.variable.Variable;\r
import org.simantics.db.layer0.variable.Variables;\r
import org.simantics.spreadsheet.resource.SpreadsheetResource;\r
final Resource sheet = result;\r
\r
if(graph.isInstanceOf(sheet, SHEET.Spreadsheet)) {\r
+ \r
Variable variable = graph.adapt(sheet, Variable.class);\r
final Resource model = Variables.getModel(graph, variable);\r
- final String RVI = Variables.getRVI(graph, variable);\r
-\r
+ final RVI rvi = variable.getRVI(graph);\r
+ \r
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {\r
\r
private static final String EDITOR_ID = "org.simantics.spreadsheet.ui.editor2";\r
@Override\r
public void run() {\r
try {\r
- WorkbenchUtils.openEditor(EDITOR_ID, new ResourceEditorInput2(EDITOR_ID, sheet, model, RVI));\r
+ WorkbenchUtils.openEditor(EDITOR_ID, new ResourceEditorInput2(EDITOR_ID, sheet, model, rvi));\r
} catch (PartInitException e) {\r
e.printStackTrace();\r
}\r
import org.simantics.db.Session;\r
import org.simantics.db.common.request.ReadRequest;\r
import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.RVI;\r
import org.simantics.db.layer0.variable.Variable;\r
import org.simantics.db.layer0.variable.Variables;\r
import org.simantics.layer0.Layer0;\r
\r
Variable variable = graph.adapt(data, Variable.class);\r
final Resource model = Variables.getModel(graph, variable);\r
- final String RVI = Variables.getRVI(graph, variable);\r
+ final RVI rvi = variable.getRVI(graph);\r
\r
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {\r
\r
@Override\r
public void run() {\r
try {\r
- System.out.println("Activating sheet: model=" + model + " rvi=" + RVI);\r
- WorkbenchUtils.openEditor(EDITOR_ID, new ResourceEditorInput2(EDITOR_ID, data, model, RVI));\r
+ System.out.println("Activating sheet: model=" + model + " rvi=" + rvi);\r
+ WorkbenchUtils.openEditor(EDITOR_ID, new ResourceEditorInput2(EDITOR_ID, data, model, rvi));\r
} catch (PartInitException e) {\r
e.printStackTrace();\r
}\r
import org.eclipse.ui.IEditorPart;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
-import org.simantics.db.common.ResourceArray;\r
import org.simantics.db.common.request.ReadRequest;\r
import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.request.PossibleModel;\r
+import org.simantics.db.layer0.variable.RVI;\r
import org.simantics.db.layer0.variable.Variable;\r
import org.simantics.db.layer0.variable.Variables;\r
import org.simantics.diagram.content.ConnectionUtil;\r
import org.simantics.modeling.ModelingResources;\r
import org.simantics.modeling.actions.NavigateToTarget;\r
import org.simantics.modeling.ui.Activator;\r
-import org.simantics.structural2.StructuralVariables;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.ui.SimanticsUI;\r
import org.simantics.ui.utils.ResourceAdaptionUtils;\r
if (g.isInstanceOf(module, SYSDYN.IndependentVariable) || g.isInstanceOf(module, SYSDYN.Input) || g.isInstanceOf(module, SYSDYN.Module)) {\r
Collection<Runnable> result = new ArrayList<Runnable>(1);\r
\r
+ Variable moduleVariable = Variables.getVariable(g, module);\r
+ RVI rvi = moduleVariable.getRVI(g);\r
+ \r
Resource composite = g.getSingleObject(module, l0.PartOf);\r
+ Resource model = g.syncRequest(new PossibleModel(composite));\r
\r
final Resource diagram = ComponentUtils.getCompositeDiagram(g, composite);\r
- final ResourceArray compositePath = StructuralVariables.getCompositeArray(g, composite);\r
- final ResourceArray variablePath = compositePath.removeFromBeginning(1);\r
-\r
- Resource model = StructuralVariables.getModel(g, compositePath.head());\r
- if (model == null)\r
- return Collections.emptyList();\r
-\r
- String rvi = StructuralVariables.getRVI(g, variablePath);\r
- if (rvi == null)\r
- return Collections.emptyList();\r
+ \r
+// final ResourceArray compositePath = StructuralVariables.getCompositeArray(g, composite);\r
+// final ResourceArray variablePath = compositePath.removeFromBeginning(1);\r
+//\r
+// Resource model = StructuralVariables.getModel(g, compositePath.head());\r
+// if (model == null)\r
+// return Collections.emptyList();\r
+//\r
+// String rvi = StructuralVariables.getRVI(g, variablePath);\r
+// if (rvi == null)\r
+// return Collections.emptyList();\r
\r
if (variable != null) {\r
// Get proper RVI from variable if it exists.\r
// We want the composite's RVI, not the component in it.\r
Variable parent = variable.getParent(g);\r
if (parent != null) {\r
- String contextURI = context.getURI(g);\r
- String parentURI = parent.getURI(g);\r
- rvi = parentURI.replace(contextURI, "");\r
+ rvi = parent.getRVI(g);\r
+// String contextURI = context.getURI(g);\r
+// String parentURI = parent.getURI(g);\r
+// rvi = parentURI.replace(contextURI, "");\r
+ model = Variables.getModel(g, context);\r
}\r
}\r
}\r