Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[dtp-dev] Fine-grained refresh control on ICatalogObject


Hi,
        In DSE, when user invokes "Refresh" on a folder, the parent ICatalogObject.refresh() will be called, resulting in all other folders under the same ICatalogObject are refreshed as well. Is there a reason to do so? How about adding a "refresh(int flag)" method to allow fine-grained refresh control? In this way only the desired objects are refreshed.
        Another question is about whether to reserve the old objects while loading in catalog loader. I have seen the following pattern in WTP RDB catalog loaders (please notice the bold part):
        private synchronized void loadSchemas() {
                if(this.schemasLoaded) return;
                EList schemaList = super.getSchemas();
                Object[] oldList = schemaList.toArray();
                boolean deliver = this.eDeliver();
                this.eSetDeliver(false);        
                try {
                        List list = CatalogUtils.getDBSchemas(this.dbName, this.connection);
                        for (int i = 0; i < list.size(); i++) {
                                final String schemaname = (String) list.get(i);
                               
                                Schema schema;

                                EClass metaclass= SQLSchemaPackage.eINSTANCE.getSchema();

                                Object element = CatalogSchema.findElement(oldList,schemaname,metaclass);

                                try {
                                        if (element != null) {
                                                schema = (Schema) element;
//we must put list.add before refresh, otherwise NPE will be thrown
                                                schemaList.add(schema);
                                                ((ICatalogObject)schema).refresh();
                                        } else {
                                                schema = new CatalogSchema();
                                                schema.setName(schemaname);
                                                schemaList.add(schema);
                                        }
                               
                                } catch (ArrayIndexOutOfBoundsException e) {
                                        // do nothing
                                        e.printStackTrace();
                                } catch (NullPointerException e) {
                                        // do nothing
                                        e.printStackTrace();
                                }
                        }
                        this.schemasLoaded = true;
                }
                catch (Exception e) {
                        System.out.println(e.toString());
                }
                this.eSetDeliver(deliver);
        }

That is, the catalog loader tries to reserve the old object references. I suppose this is to make sql model objects referenced by other components (such as schema object editor) valid after refresh, it that true?

Best Regards!

Max ( Hui ) Cao
Sybase, Inc. Shanghai, China

Back to the top