Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 71394 invoked from network); 3 Oct 2007 10:15:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Oct 2007 10:15:07 -0000 Received: (qmail 25520 invoked by uid 500); 3 Oct 2007 10:14:57 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 25486 invoked by uid 500); 3 Oct 2007 10:14:56 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 25475 invoked by uid 99); 3 Oct 2007 10:14:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Oct 2007 03:14:56 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Oct 2007 10:15:06 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 074AB1A9832; Wed, 3 Oct 2007 03:14:46 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r581554 - in /directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor: controller/SchemaViewController.java view/views/SchemaViewContentProvider.java Date: Wed, 03 Oct 2007 10:14:45 -0000 To: commits@directory.apache.org From: pamarcelot@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071003101446.074AB1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: pamarcelot Date: Wed Oct 3 03:14:44 2007 New Revision: 581554 URL: http://svn.apache.org/viewvc?rev=581554&view=rev Log: Cleanup. Prepared move of some code from the controller to the content provider. Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewContentProvider.java Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java?rev=581554&r1=581553&r2=581554&view=diff ============================================================================== --- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java (original) +++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/controller/SchemaViewController.java Wed Oct 3 03:14:44 2007 @@ -117,6 +117,9 @@ IPreferenceStore store = Activator.getDefault().getPreferenceStore(); SchemaViewContentProvider contentProvider = ( SchemaViewContentProvider ) viewer.getContentProvider(); + contentProvider.attributeTypeAdded( at ); + view.refresh(); + int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION ); if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT ) { @@ -174,6 +177,9 @@ IPreferenceStore store = Activator.getDefault().getPreferenceStore(); SchemaViewContentProvider contentProvider = ( SchemaViewContentProvider ) viewer.getContentProvider(); + contentProvider.attributeTypeModified( at ); + view.refresh(); + int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION ); if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT ) { @@ -204,6 +210,9 @@ { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); SchemaViewContentProvider contentProvider = ( SchemaViewContentProvider ) viewer.getContentProvider(); + + contentProvider.attributeTypeRemoved( at ); + view.refresh(); int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION ); if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT ) @@ -236,6 +245,9 @@ { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); SchemaViewContentProvider contentProvider = ( SchemaViewContentProvider ) viewer.getContentProvider(); + + contentProvider.objectClassAdded( oc ); + view.refresh(); int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION ); if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT ) @@ -266,7 +278,7 @@ schemaWrapper.addChild( ocw ); } - viewer.refresh( schemaWrapper ); + view.refresh(); if ( ocw != null ) { viewer.setSelection( new StructuredSelection( ocw ) ); @@ -281,7 +293,7 @@ else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL ) { contentProvider.objectClassAdded( oc ); - view.reloadViewer(); + view.refresh(); } } @@ -293,6 +305,10 @@ { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); SchemaViewContentProvider contentProvider = ( SchemaViewContentProvider ) viewer.getContentProvider(); + + + contentProvider.objectClassModified( oc ); + view.refresh(); int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION ); if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT ) @@ -312,7 +328,7 @@ else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL ) { contentProvider.objectClassModified( oc ); - view.reloadViewer(); + view.refresh(); } } @@ -324,6 +340,10 @@ { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); SchemaViewContentProvider contentProvider = ( SchemaViewContentProvider ) viewer.getContentProvider(); + + + contentProvider.objectClassRemoved( oc ); + view.refresh(); int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION ); if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT ) @@ -344,7 +364,7 @@ else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL ) { contentProvider.objectClassRemoved( oc ); - view.reloadViewer(); + view.refresh(); } } @@ -356,6 +376,12 @@ { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + SchemaViewContentProvider contentProvider = ( SchemaViewContentProvider ) viewer.getContentProvider(); + + + contentProvider.schemaAdded( schema ); + view.refresh(); + int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION ); if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT ) { @@ -407,8 +433,7 @@ } else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL ) { - // TODO Change this - view.reloadViewer(); + view.refresh(); } } @@ -420,6 +445,11 @@ { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + SchemaViewContentProvider contentProvider = ( SchemaViewContentProvider ) viewer.getContentProvider(); + + contentProvider.schemaAdded( schema ); + view.refresh(); + int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION ); if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT ) { @@ -437,8 +467,7 @@ } else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL ) { - // TODO Change this - view.reloadViewer(); + view.refresh(); } } }; @@ -1076,7 +1105,6 @@ public void partVisible( IWorkbenchPartReference partRef ) { } - } ); } } Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewContentProvider.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewContentProvider.java?rev=581554&r1=581553&r2=581554&view=diff ============================================================================== --- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewContentProvider.java (original) +++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/views/SchemaViewContentProvider.java Wed Oct 3 03:14:44 2007 @@ -474,6 +474,40 @@ */ public void attributeTypeAdded( AttributeTypeImpl at ) { + int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION ); + if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT ) + { + attributeTypeAddedFlatPresentation( at ); + } + else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL ) + { + attributeTypeAddedHierarchicalPresentation( at ); + } + } + + + /** + * Updates the TreeNodes when an attribute type is added and the + * presentation is set as 'Flat'. + * + * @param at + * the added attribute type + */ + public void attributeTypeAddedFlatPresentation( AttributeTypeImpl at ) + { + // TODO implement + } + + + /** + * Updates the TreeNodes when an attribute type is added and the + * presentation is set as 'Hierarchical'. + * + * @param at + * the added attribute type + */ + public void attributeTypeAddedHierarchicalPresentation( AttributeTypeImpl at ) + { hierarchyManager.attributeTypeAdded( at ); List createdWrappers = new ArrayList(); @@ -548,6 +582,40 @@ */ public void attributeTypeModified( AttributeTypeImpl at ) { + int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION ); + if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT ) + { + attributeTypeModifiedFlatPresentation( at ); + } + else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL ) + { + attributeTypeModifiedHierarchicalPresentation( at ); + } + } + + + /** + * Updates the TreeNodes when an attribute type is modified and the + * presentation is set as 'Flat'. + * + * @param at + * the modified attribute type + */ + public void attributeTypeModifiedFlatPresentation( AttributeTypeImpl at ) + { + // TODO implement + } + + + /** + * Updates the TreeNodes when an attribute type is modified and the + * presentation is set as 'Hierarchical'. + * + * @param at + * the modified attribute type + */ + public void attributeTypeModifiedHierarchicalPresentation( AttributeTypeImpl at ) + { // Propagating the modification to the hierarchy manager hierarchyManager.attributeTypeModified( at ); @@ -615,11 +683,39 @@ */ public void attributeTypeRemoved( AttributeTypeImpl at ) { - removeAttributeTypeHierarchicalPresentation( at ); + int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION ); + if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT ) + { + attributeTypeRemovedFlatPresentation( at ); + } + else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL ) + { + attributeTypeRemovedHierarchicalPresentation( at ); + } } - private void removeAttributeTypeHierarchicalPresentation( AttributeTypeImpl at ) + /** + * Updates the TreeNodes when an attribute type is removed and the + * presentation is set as 'Flat'. + * + * @param at + * the removed attribute type + */ + private void attributeTypeRemovedFlatPresentation( AttributeTypeImpl at ) + { + // TODO Implement + } + + + /** + * Updates the TreeNodes when an attribute type is removed and the + * presentation is set as 'Hierarchical'. + * + * @param at + * the removed attribute type + */ + private void attributeTypeRemovedHierarchicalPresentation( AttributeTypeImpl at ) { // Creating children nodes of the AT // and attaching them to the root @@ -707,6 +803,40 @@ */ public void objectClassAdded( ObjectClassImpl oc ) { + int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION ); + if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT ) + { + objectClassAddedFlatlPresentation( oc ); + } + else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL ) + { + objectClassAddedHierarchicalPresentation( oc ); + } + } + + + /** + * Updates the TreeNodes when an object class is added and the + * presentation is set as 'Flat'. + * + * @param oc + * the added object class + */ + public void objectClassAddedFlatlPresentation( ObjectClassImpl oc ) + { + // TODO implement + } + + + /** + * Updates the TreeNodes when an object class is added and the + * presentation is set as 'Hierarchical'. + * + * @param oc + * the added object class + */ + public void objectClassAddedHierarchicalPresentation( ObjectClassImpl oc ) + { // Propagating the addition to the hierarchy manager hierarchyManager.objectClassAdded( oc ); @@ -791,6 +921,40 @@ */ public void objectClassModified( ObjectClassImpl oc ) { + int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION ); + if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT ) + { + objectClassModifiedFlatPresentation( oc ); + } + else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL ) + { + objectClassModifiedHierarchicalPresentation( oc ); + } + } + + + /** + * Updates the TreeNodes when an object class is modified and the + * presentation is set as 'Flat'. + * + * @param oc + * the modified object class + */ + public void objectClassModifiedFlatPresentation( ObjectClassImpl oc ) + { + // TODO implement + } + + + /** + * Updates the TreeNodes when an object class is modified and the + * presentation is set as 'Hierarchical'. + * + * @param oc + * the modified object class + */ + public void objectClassModifiedHierarchicalPresentation( ObjectClassImpl oc ) + { // Propagating the modification to the hierarchy manager hierarchyManager.objectClassModified( oc ); @@ -857,6 +1021,40 @@ * the removed object class */ public void objectClassRemoved( ObjectClassImpl oc ) + { + int presentation = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION ); + if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_FLAT ) + { + objectClassRemovedFlatPresentation( oc ); + } + else if ( presentation == PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_PRESENTATION_HIERARCHICAL ) + { + objectClassRemovedHierarchicalPresentation( oc ); + } + } + + + /** + * Updates the TreeNodes when an object class is removed and the + * presentation is set as 'Flat'. + * + * @param oc + * the removed object class + */ + public void objectClassRemovedFlatPresentation( ObjectClassImpl oc ) + { + // TODO Implement + } + + + /** + * Updates the TreeNodes when an object class is removed and the + * presentation is set as 'Hierarchical'. + * + * @param oc + * the removed object class + */ + public void objectClassRemovedHierarchicalPresentation( ObjectClassImpl oc ) { // Creating children nodes of the OC // and attaching them to the root