TabItem functions;\r
Table variableTable;\r
Table functionTable;\r
- \r
+\r
public ShortcutTabs(Composite parent, int style) {\r
super(parent, style);\r
\r
item.setText("if then else");\r
item.setData("if then else");\r
functions.setControl(functionTable);\r
- \r
+\r
this.layout();\r
}\r
- \r
+\r
public HashSet<String> updateTables(Resource variable) {\r
HashSet<String> dependencies = getDependencies(variable);\r
variableTable.removeAll();\r
}\r
return dependencies;\r
}\r
- \r
+\r
// Returns the names of the related variables (dependencies)\r
private HashSet<String> getDependencies(final Resource r){\r
HashSet<String> variables = null;\r
- try {\r
- variables = SimanticsUI.getSession().syncRequest(new Read<HashSet<String>>() {\r
-\r
- @Override\r
- public HashSet<String> perform(ReadGraph graph)\r
- throws DatabaseException {\r
- HashSet<String> variables = new HashSet<String>();\r
- SysdynResource sr = SysdynResource.getInstance(graph);\r
- Builtins b = graph.getBuiltins();\r
-\r
- Collection<Resource> dependencies = graph.getObjects(r, sr.IsHeadOf);\r
-\r
- for(Resource d : dependencies) {\r
- if(graph.isInstanceOf(d, sr.Dependency)) {\r
- Resource tail = graph.getPossibleObject(d, sr.HasTail);\r
- if(tail != null) {\r
- Object name = graph.getPossibleRelatedValue(tail, b.HasName);\r
- if(name != null)\r
- variables.add((String)name);\r
+ if(r != null)\r
+ try {\r
+ variables = SimanticsUI.getSession().syncRequest(new Read<HashSet<String>>() {\r
+\r
+ @Override\r
+ public HashSet<String> perform(ReadGraph graph)\r
+ throws DatabaseException {\r
+ HashSet<String> variables = new HashSet<String>();\r
+ SysdynResource sr = SysdynResource.getInstance(graph);\r
+ Builtins b = graph.getBuiltins();\r
+\r
+ Collection<Resource> dependencies = graph.getObjects(r, sr.IsHeadOf);\r
+\r
+ for(Resource d : dependencies) {\r
+ if(graph.isInstanceOf(d, sr.Dependency)) {\r
+ Resource tail = graph.getPossibleObject(d, sr.HasTail);\r
+ if(tail != null) {\r
+ Object name = graph.getPossibleRelatedValue(tail, b.HasName);\r
+ if(name != null)\r
+ variables.add((String)name);\r
+ }\r
}\r
}\r
- }\r
\r
- return variables;\r
+ return variables;\r
\r
- }\r
+ }\r
\r
\r
- });\r
- } catch (DatabaseException ee) {\r
- ExceptionUtils.logAndShowError(ee);\r
- }\r
+ });\r
+ } catch (DatabaseException ee) {\r
+ ExceptionUtils.logAndShowError(ee);\r
+ }\r
\r
- return variables;\r
+ return variables;\r
}\r
- \r
+\r
public Table getVariableTable() {\r
return this.variableTable;\r
}\r