directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
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 GMT
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<TreeNode> createdWrappers = new ArrayList<TreeNode>();
@@ -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



Mime
View raw message