|
Lines 24-33
Link Here
|
| 24 |
import org.eclipse.datatools.modelbase.sql.schema.Catalog; |
24 |
import org.eclipse.datatools.modelbase.sql.schema.Catalog; |
| 25 |
import org.eclipse.datatools.modelbase.sql.schema.Database; |
25 |
import org.eclipse.datatools.modelbase.sql.schema.Database; |
| 26 |
import org.eclipse.datatools.modelbase.sql.schema.SQLObject; |
26 |
import org.eclipse.datatools.modelbase.sql.schema.SQLObject; |
|
|
27 |
import org.eclipse.datatools.modelbase.sql.schema.SQLSchemaPackage; |
| 27 |
import org.eclipse.datatools.modelbase.sql.schema.Schema; |
28 |
import org.eclipse.datatools.modelbase.sql.schema.Schema; |
| 28 |
import org.eclipse.datatools.modelbase.sql.tables.BaseTable; |
29 |
import org.eclipse.datatools.modelbase.sql.tables.BaseTable; |
| 29 |
import org.eclipse.datatools.modelbase.sql.tables.Table; |
30 |
import org.eclipse.datatools.modelbase.sql.tables.Table; |
| 30 |
import org.eclipse.emf.ecore.EObject; |
31 |
import org.eclipse.emf.ecore.EObject; |
|
|
32 |
import org.eclipse.emf.ecore.EStructuralFeature; |
| 31 |
|
33 |
|
| 32 |
|
34 |
|
| 33 |
/** |
35 |
/** |
|
Lines 173-186
Link Here
|
| 173 |
*/ |
175 |
*/ |
| 174 |
protected Object[] displayTableNodeChildren (Object parent) |
176 |
protected Object[] displayTableNodeChildren (Object parent) |
| 175 |
{ |
177 |
{ |
| 176 |
Schema schema = (Schema) ((IVirtualNode)parent).getParent(); |
178 |
EStructuralFeature feature = SQLSchemaPackage.eINSTANCE.getSchema_Tables(); |
| 177 |
return getArrays (parent, getChildren(((IVirtualNode)parent).getGroupID(), schema.getTables())); |
179 |
return getSchemaChildren(parent, feature); |
| 178 |
} |
180 |
} |
| 179 |
|
181 |
|
| 180 |
protected Object[] displayUDFNodeChildren(Object parent) |
182 |
protected Object[] displayUDFNodeChildren(Object parent) |
| 181 |
{ |
183 |
{ |
| 182 |
Schema schema = (Schema) ((IVirtualNode)parent).getParent(); |
184 |
EStructuralFeature feature = SQLSchemaPackage.eINSTANCE.getSchema_Routines(); |
| 183 |
return getArrays (parent, getChildren(((IVirtualNode)parent).getGroupID(), schema.getUDFs())); |
185 |
return getSchemaChildren(parent, feature); |
| 184 |
} |
186 |
} |
| 185 |
|
187 |
|
| 186 |
/** |
188 |
/** |
|
Lines 188-195
Link Here
|
| 188 |
*/ |
190 |
*/ |
| 189 |
protected Object[] displayStoredProcedureNodeChildren(Object parent) |
191 |
protected Object[] displayStoredProcedureNodeChildren(Object parent) |
| 190 |
{ |
192 |
{ |
| 191 |
Schema schema = (Schema) ((IVirtualNode)parent).getParent(); |
193 |
EStructuralFeature feature = SQLSchemaPackage.eINSTANCE.getSchema_Routines(); |
| 192 |
return getArrays (parent, getChildren(((IVirtualNode)parent).getGroupID(), schema.getProcedures())); |
194 |
return getSchemaChildren(parent, feature); |
| 193 |
} |
195 |
} |
| 194 |
|
196 |
|
| 195 |
/** |
197 |
/** |
|
Lines 199-206
Link Here
|
| 199 |
*/ |
201 |
*/ |
| 200 |
protected Object [] displaySequenceNodeChildren (Object parent) |
202 |
protected Object [] displaySequenceNodeChildren (Object parent) |
| 201 |
{ |
203 |
{ |
| 202 |
Schema schema = (Schema) ((IVirtualNode)parent).getParent(); |
204 |
EStructuralFeature feature = SQLSchemaPackage.eINSTANCE.getSchema_Sequences(); |
| 203 |
return getArrays (parent, getChildren(((IVirtualNode)parent).getGroupID(), schema.getSequences())); |
205 |
return getSchemaChildren(parent, feature); |
| 204 |
} |
206 |
} |
| 205 |
|
207 |
|
| 206 |
/** |
208 |
/** |
|
Lines 210-217
Link Here
|
| 210 |
*/ |
212 |
*/ |
| 211 |
protected Object [] displayUDTNodeChildren (Object parent) |
213 |
protected Object [] displayUDTNodeChildren (Object parent) |
| 212 |
{ |
214 |
{ |
| 213 |
Schema schema = (Schema) ((IVirtualNode)parent).getParent(); |
215 |
EStructuralFeature feature = SQLSchemaPackage.eINSTANCE.getSchema_UserDefinedTypes(); |
| 214 |
return getArrays (parent, getChildren(((IVirtualNode)parent).getGroupID(), schema.getUserDefinedTypes())); |
216 |
return getSchemaChildren(parent, feature); |
|
|
217 |
} |
| 218 |
|
| 219 |
/** |
| 220 |
* Will display all the Views available under each View Node |
| 221 |
* @param parent |
| 222 |
* @return |
| 223 |
*/ |
| 224 |
protected Object [] displayViewsNodeChildren (Object parent) |
| 225 |
{ |
| 226 |
EStructuralFeature feature = SQLSchemaPackage.eINSTANCE.getSchema_Tables(); |
| 227 |
return getSchemaChildren(parent, feature); |
| 228 |
} |
| 229 |
|
| 230 |
/** |
| 231 |
* Return all children of feature specified type under each virtual node |
| 232 |
* @param parent |
| 233 |
* @param feature |
| 234 |
* @return |
| 235 |
*/ |
| 236 |
protected Object[] getSchemaChildren(Object parent, EStructuralFeature feature) |
| 237 |
{ |
| 238 |
Object ancestor = ((IVirtualNode)parent).getParent(); |
| 239 |
if(ancestor instanceof Schema) |
| 240 |
{ |
| 241 |
Schema schema = (Schema) ancestor; |
| 242 |
return getArrays (parent, getChildren(((IVirtualNode)parent).getGroupID(), (List)schema.eGet(feature))); |
| 243 |
} |
| 244 |
else if(ancestor instanceof Database) |
| 245 |
{ |
| 246 |
List schemas = ((Database)ancestor).getSchemas(); |
| 247 |
return getSchemasChildren(parent, schemas, feature); |
| 248 |
} |
| 249 |
else if(ancestor instanceof Catalog) |
| 250 |
{ |
| 251 |
List schemas = ((Catalog)ancestor).getSchemas(); |
| 252 |
return getSchemasChildren(parent, schemas, feature); |
| 253 |
} |
| 254 |
else |
| 255 |
{ |
| 256 |
return EMPTY_ELEMENT_ARRAY; |
| 257 |
} |
| 258 |
} |
| 259 |
|
| 260 |
private Object[] getSchemasChildren(Object parent, List schemas, EStructuralFeature feature) |
| 261 |
{ |
| 262 |
List result = new ArrayList(); |
| 263 |
for (Iterator iterator = schemas.iterator(); iterator.hasNext();) |
| 264 |
{ |
| 265 |
Schema schema = (Schema) iterator.next(); |
| 266 |
List objs = (List)schema.eGet(feature); |
| 267 |
result.addAll(objs); |
| 268 |
} |
| 269 |
return getArrays (parent, getChildren(((IVirtualNode)parent).getGroupID(), result)); |
| 215 |
} |
270 |
} |
| 216 |
|
271 |
|
| 217 |
/** |
272 |
/** |
|
Lines 250-267
Link Here
|
| 250 |
return getArrays (parent, getChildren(((IVirtualNode)parent).getGroupID(), table.getColumns())); |
305 |
return getArrays (parent, getChildren(((IVirtualNode)parent).getGroupID(), table.getColumns())); |
| 251 |
} |
306 |
} |
| 252 |
|
307 |
|
| 253 |
|
|
|
| 254 |
/** |
| 255 |
* Will display all the Views available under each View Node |
| 256 |
* @param parent |
| 257 |
* @return |
| 258 |
*/ |
| 259 |
protected Object [] displayViewsNodeChildren (Object parent) |
| 260 |
{ |
| 261 |
Schema schema = (Schema) ((IVirtualNode)parent).getParent(); |
| 262 |
return getArrays (parent, getChildren(((IVirtualNode)parent).getGroupID(), schema.getTables())); |
| 263 |
} |
| 264 |
|
| 265 |
/** |
308 |
/** |
| 266 |
* Will display all the Nodes availables under each Table |
309 |
* Will display all the Nodes availables under each Table |
| 267 |
* @param parent |
310 |
* @param parent |