directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r520816 - in /directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas: controller/ controller/actions/ model/ view/editors/ view/viewers/
Date Wed, 21 Mar 2007 09:26:36 GMT
Author: pamarcelot
Date: Wed Mar 21 02:26:35 2007
New Revision: 520816

URL: http://svn.apache.org/viewvc?view=rev&rev=520816
Log:
Moved 'for loops' to Java 1.5 style (when it was possible).

Modified:
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorSchemaElementsView.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorSchemasView.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/AttributeType.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/ObjectClass.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/SchemaPool.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/AttributeTypeFormEditorUsedByPage.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorOverviewPage.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorOverviewPage.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorSourceCodePage.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyView.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemaCodeScanner.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasView.java
    directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewContentProvider.java

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java?view=diff&rev=520816&r1=520815&r2=520816
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/SchemasViewController.java
Wed Mar 21 02:26:35 2007
@@ -76,6 +76,7 @@
 import org.eclipse.swt.dnd.DropTargetEvent;
 import org.eclipse.swt.dnd.FileTransfer;
 import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.dnd.TransferData;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.ISelectionListener;
 import org.eclipse.ui.IWorkbenchActionConstants;
@@ -296,7 +297,7 @@
 
         // set the context menu to the table viewer
         viewer.getControl().setMenu( contextMenu.createContextMenu( viewer.getControl() )
);
-        
+
         // register the context menu to enable extension actions
         view.getSite().registerContextMenu( contextMenu, viewer );
     }
@@ -329,11 +330,11 @@
                 }
 
                 //we only want files
-                for ( int i = 0; i < event.dataTypes.length; i++ )
+                for ( TransferData dataType : event.dataTypes )
                 {
-                    if ( fileTransfer.isSupportedType( event.dataTypes[i] ) )
+                    if ( fileTransfer.isSupportedType( dataType ) )
                     {
-                        event.currentDataType = event.dataTypes[i];
+                        event.currentDataType = dataType;
                         break;
                     }
                 }
@@ -349,15 +350,15 @@
                 {
                     SchemaPool pool = SchemaPool.getInstance();
                     String[] files = ( String[] ) event.data;
-                    for ( int i = 0; i < files.length; i++ )
+                    for ( String file : files )
                     {
                         try
                         {
-                            pool.addAlreadyExistingSchema( files[i], SchemaType.userSchema
);
+                            pool.addAlreadyExistingSchema( file, SchemaType.userSchema );
                         }
                         catch ( SchemaCreationException e )
                         {
-                            logger.debug( "error when initializing new schema after drag&drop:
" + files[i] ); //$NON-NLS-1$
+                            logger.debug( "error when initializing new schema after drag&drop:
" + file ); //$NON-NLS-1$
                         }
                     }
                 }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorSchemaElementsView.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorSchemaElementsView.java?view=diff&rev=520816&r1=520815&r2=520816
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorSchemaElementsView.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorSchemaElementsView.java
Wed Mar 21 02:26:35 2007
@@ -326,12 +326,11 @@
     {
         if ( wrapper != null )
         {
-            IEditorReference[] editorReferences = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+            IEditorReference[] references = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
                 .getEditorReferences();
 
-            for ( int i = 0; i < editorReferences.length; i++ )
+            for ( IEditorReference reference : references )
             {
-                IEditorReference reference = editorReferences[i];
                 IWorkbenchPart workbenchPart = reference.getPart( true );
 
                 if ( ( workbenchPart instanceof ObjectClassFormEditor ) && ( wrapper
instanceof ObjectClassWrapper ) )

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorSchemasView.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorSchemasView.java?view=diff&rev=520816&r1=520815&r2=520816
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorSchemasView.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/controller/actions/LinkWithEditorSchemasView.java
Wed Mar 21 02:26:35 2007
@@ -345,12 +345,11 @@
      */
     private void linkEditorWithView( ITreeNode wrapper )
     {
-        IEditorReference[] editorReferences = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+        IEditorReference[] references = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
             .getEditorReferences();
 
-        for ( int i = 0; i < editorReferences.length; i++ )
+        for ( IEditorReference reference : references )
         {
-            IEditorReference reference = editorReferences[i];
             IWorkbenchPart workbenchPart = reference.getPart( true );
 
             if ( ( ( workbenchPart instanceof ObjectClassFormEditor ) && ( wrapper
instanceof ObjectClassWrapper ) && ( reference

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/AttributeType.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/AttributeType.java?view=diff&rev=520816&r1=520815&r2=520816
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/AttributeType.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/AttributeType.java
Wed Mar 21 02:26:35 2007
@@ -335,9 +335,9 @@
         if ( names.length > 1 )
         {
             sb.append( "( " ); //$NON-NLS-1$
-            for ( int i = 0; i < names.length; i++ )
+            for ( String name : names )
             {
-                sb.append( "'" + names[i] + "' " ); //$NON-NLS-1$ //$NON-NLS-2$
+                sb.append( "'" + name + "' " ); //$NON-NLS-1$ //$NON-NLS-2$
             }
             sb.append( ") \n" ); //$NON-NLS-1$
         }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/ObjectClass.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/ObjectClass.java?view=diff&rev=520816&r1=520815&r2=520816
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/ObjectClass.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/ObjectClass.java
Wed Mar 21 02:26:35 2007
@@ -259,9 +259,9 @@
         if ( names.length > 1 )
         {
             sb.append( "( " ); //$NON-NLS-1$
-            for ( int i = 0; i < names.length; i++ )
+            for ( String name : names )
             {
-                sb.append( "'" + names[i] + "' " ); //$NON-NLS-1$ //$NON-NLS-2$
+                sb.append( "'" + name + "' " ); //$NON-NLS-1$ //$NON-NLS-2$
             }
             sb.append( ") \n" ); //$NON-NLS-1$
         }

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/SchemaPool.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/SchemaPool.java?view=diff&rev=520816&r1=520815&r2=520816
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/SchemaPool.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/model/SchemaPool.java
Wed Mar 21 02:26:35 2007
@@ -184,9 +184,9 @@
         String[] safiles = dir.list();
         if ( safiles != null )
         {
-            for ( int i = 0; i < safiles.length; i++ )
+            for ( String safile : safiles )
             {
-                File curFile = new File( sCurPath + safiles[i] );
+                File curFile = new File( sCurPath + safile );
                 if ( !curFile.isDirectory() )
                 {
                     try
@@ -492,8 +492,10 @@
      */
     public void addSchemas( Schema[] schemaArray )
     {
-        for ( int i = 0; i < schemaArray.length; i++ )
-            addSchema( schemaArray[i] );
+        for ( Schema schema : schemaArray )
+        {
+            addSchema( schema );
+        }
 
         //notify of the changement
         //notifyChanged(LDAPModelEvent.Reason.multipleSchemaAdded,null);
@@ -515,15 +517,15 @@
                 s.addListener( this );
 
                 AttributeType[] ats = s.getAttributeTypesAsArray();
-                for ( int i = 0; i < ats.length; i++ )
+                for ( AttributeType at : ats )
                 {
-                    addAttributeType( ats[i] );
+                    addAttributeType( at );
                 }
 
                 ObjectClass[] ocs = s.getObjectClassesAsArray();
-                for ( int i = 0; i < ocs.length; i++ )
+                for ( ObjectClass oc : ocs )
                 {
-                    addObjectClass( ocs[i] );
+                    addObjectClass( oc );
                 }
 
                 notifyChanged( LDAPModelEvent.Reason.SchemaAdded, s );
@@ -598,14 +600,14 @@
      */
     public void removeSchemas( Schema[] schemaArray )
     {
-        for ( int i = 0; i < schemaArray.length; i++ )
+        if ( ( schemaArray != null ) && ( schemaArray.length > 0 ) )
         {
-            removeSchema( schemaArray[i] );
-            schemaArray[i].removeListener( this );
-        }
+            for ( Schema schema : schemaArray )
+            {
+                removeSchema( schema );
+                schema.removeListener( this );
+            }
 
-        if ( schemaArray.length > 0 )
-        {
             //notify of the changement
             notifyChanged( LDAPModelEvent.Reason.multipleSchemaRemoved, null );
         }
@@ -625,15 +627,15 @@
             s.closeAssociatedEditors();
 
             AttributeType[] ats = s.getAttributeTypesAsArray();
-            for ( int i = 0; i < ats.length; i++ )
+            for ( AttributeType at : ats )
             {
-                removeAttributeType( ats[i] );
+                removeAttributeType( at );
             }
 
             ObjectClass[] ocs = s.getObjectClassesAsArray();
-            for ( int i = 0; i < ocs.length; i++ )
+            for ( ObjectClass oc : ocs )
             {
-                removeObjectClass( ocs[i] );
+                removeObjectClass( oc );
             }
 
             notifyChanged( LDAPModelEvent.Reason.SchemaRemoved, s );

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/AttributeTypeFormEditorUsedByPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/AttributeTypeFormEditorUsedByPage.java?view=diff&rev=520816&r1=520815&r2=520816
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/AttributeTypeFormEditorUsedByPage.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/AttributeTypeFormEditorUsedByPage.java
Wed Mar 21 02:26:35 2007
@@ -256,10 +256,8 @@
         List<String> ocList = new ArrayList<String>();
 
         List<ObjectClass> objectClasses = schemaPool.getObjectClasses();
-        for ( int i = 0; i < objectClasses.size(); i++ )
+        for ( ObjectClass oc : objectClasses )
         {
-            ObjectClass oc = objectClasses.get( i );
-
             String[] musts = oc.getMust();
             for ( int j = 0; j < musts.length; j++ )
             {
@@ -301,10 +299,8 @@
         List<String> ocList = new ArrayList<String>();
 
         List<ObjectClass> objectClasses = schemaPool.getObjectClasses();
-        for ( int i = 0; i < objectClasses.size(); i++ )
+        for ( ObjectClass oc : objectClasses )
         {
-            ObjectClass oc = objectClasses.get( i );
-
             String[] mays = oc.getMay();
             for ( int j = 0; j < mays.length; j++ )
             {

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorOverviewPage.java?view=diff&rev=520816&r1=520815&r2=520816
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorOverviewPage.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/ObjectClassFormEditorOverviewPage.java
Wed Mar 21 02:26:35 2007
@@ -317,9 +317,9 @@
                     // The selected attribute is not in any table, so it can be added
                     ArrayList<String> mustList = new ArrayList<String>();
                     String[] mustATs = modifiedObjectClass.getMust();
-                    for ( int i = 0; i < mustATs.length; i++ )
+                    for ( String mustAT : mustATs )
                     {
-                        mustList.add( mustATs[i] );
+                        mustList.add( mustAT );
                     }
                     mustList.add( selectionDialog.getSelectedAttributeType() );
                     modifiedObjectClass.setMust( mustList.toArray( new String[0] ) );
@@ -340,9 +340,9 @@
 
             ArrayList<String> mustList = new ArrayList<String>();
             String[] mustATs = modifiedObjectClass.getMust();
-            for ( int i = 0; i < mustATs.length; i++ )
+            for ( String mustAT : mustATs )
             {
-                mustList.add( mustATs[i] );
+                mustList.add( mustAT );
             }
             mustList.remove( itemToRemove );
             modifiedObjectClass.setMust( mustList.toArray( new String[0] ) );
@@ -446,9 +446,9 @@
 
             ArrayList<String> mayList = new ArrayList<String>();
             String[] mayATs = modifiedObjectClass.getMay();
-            for ( int i = 0; i < mayATs.length; i++ )
+            for ( String mayAT : mayATs )
             {
-                mayList.add( mayATs[i] );
+                mayList.add( mayAT );
             }
             mayList.remove( itemToRemove );
             modifiedObjectClass.setMay( mayList.toArray( new String[0] ) );

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorOverviewPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorOverviewPage.java?view=diff&rev=520816&r1=520815&r2=520816
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorOverviewPage.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorOverviewPage.java
Wed Mar 21 02:26:35 2007
@@ -233,21 +233,21 @@
     private void fillInUiFields()
     {
         AttributeType[] attributeTypes = schema.getAttributeTypesAsArray();
-        for ( int i = 0; i < attributeTypes.length; i++ )
+        for ( AttributeType at : attributeTypes )
         {
             TableItem item = new TableItem( attributeTypesTable, SWT.NONE );
             item.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
                 PluginConstants.IMG_ATTRIBUTE_TYPE ).createImage() );
-            item.setText( attributeTypes[i].getNames()[0] );
+            item.setText( at.getNames()[0] );
         }
 
         ObjectClass[] objectClasses = schema.getObjectClassesAsArray();
-        for ( int i = 0; i < objectClasses.length; i++ )
+        for ( ObjectClass oc : objectClasses )
         {
             TableItem item = new TableItem( objectClassesTable, SWT.NONE );
             item.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
                 PluginConstants.IMG_OBJECT_CLASS ).createImage() );
-            item.setText( objectClasses[i].getNames()[0] );
+            item.setText( oc.getNames()[0] );
         }
     }
 

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorSourceCodePage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorSourceCodePage.java?view=diff&rev=520816&r1=520815&r2=520816
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorSourceCodePage.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/editors/SchemaFormEditorSourceCodePage.java
Wed Mar 21 02:26:35 2007
@@ -122,28 +122,20 @@
      */
     private void fillInUiFields()
     {
-        AttributeType[] attributeTypes = schema.getAttributeTypesAsArray();
-        ObjectClass[] objectClasses = schema.getObjectClassesAsArray();
-
         StringBuffer sb = new StringBuffer();
 
-        if ( attributeTypes.length != 0 )
+        AttributeType[] attributeTypes = schema.getAttributeTypesAsArray();
+        for ( AttributeType at : attributeTypes )
         {
-            for ( int i = 0; i < attributeTypes.length; i++ )
-            {
-                AttributeType attributeType = attributeTypes[i];
-                sb.append( attributeType.write() );
-                sb.append( "\n" ); //$NON-NLS-1$
-            }
+            sb.append( at.write() );
+            sb.append( "\n" ); //$NON-NLS-1$
         }
-        if ( objectClasses.length != 0 )
+
+        ObjectClass[] objectClasses = schema.getObjectClassesAsArray();
+        for ( ObjectClass oc : objectClasses )
         {
-            for ( int i = 0; i < objectClasses.length; i++ )
-            {
-                ObjectClass objectClass = objectClasses[i];
-                sb.append( objectClass.write() );
-                sb.append( "\n" ); //$NON-NLS-1$
-            }
+            sb.append( oc.write() );
+            sb.append( "\n" ); //$NON-NLS-1$
         }
 
         schemaSourceViewer.getDocument().set( sb.toString() );

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyView.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyView.java?view=diff&rev=520816&r1=520815&r2=520816
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyView.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/HierarchyView.java
Wed Mar 21 02:26:35 2007
@@ -152,11 +152,9 @@
         else
         {
             Object[] children = contentProvider.getChildren( node );
-
-            for ( int i = 0; i < children.length; i++ )
+            for ( Object child : children )
             {
-                ITreeNode item = ( ITreeNode ) children[i];
-                ITreeNode foundElement = findElementInTree( element, item );
+                ITreeNode foundElement = findElementInTree( element, ( ITreeNode ) child
);
                 if ( foundElement != null )
                 {
                     return foundElement;

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemaCodeScanner.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemaCodeScanner.java?view=diff&rev=520816&r1=520815&r2=520816
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemaCodeScanner.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemaCodeScanner.java
Wed Mar 21 02:26:35 2007
@@ -95,9 +95,9 @@
         wr.addWord( objectclass, OCToken );
 
         // Adding Keywords
-        for ( int i = 0; i < keywords.length; ++i )
+        for (String kw : keywords )
         {
-            wr.addWord( keywords[i], keyword );
+            wr.addWord( kw, keyword );
         }
 
         rules.add( wr );

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasView.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasView.java?view=diff&rev=520816&r1=520815&r2=520816
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasView.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasView.java
Wed Mar 21 02:26:35 2007
@@ -179,9 +179,8 @@
     public boolean isDirty()
     {
         Schema[] schemas = SchemaPool.getInstance().getSchemas();
-        for ( int i = 0; i < schemas.length; i++ )
+        for ( Schema schema : schemas )
         {
-            Schema schema = schemas[i];
             if ( schema.type == Schema.SchemaType.userSchema )
             {
                 if ( schema.hasBeenModified() || schema.hasPendingModification() )
@@ -253,11 +252,9 @@
         else
         {
             Object[] children = contentProvider.getChildren( node );
-
-            for ( int i = 0; i < children.length; i++ )
+            for ( Object child : children )
             {
-                ITreeNode item = ( ITreeNode ) children[i];
-                ITreeNode foundElement = findElementInTree( element, item );
+                ITreeNode foundElement = findElementInTree( element, ( ITreeNode ) child
);
                 if ( foundElement != null )
                 {
                     return foundElement;

Modified: directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewContentProvider.java?view=diff&rev=520816&r1=520815&r2=520816
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewContentProvider.java
(original)
+++ directory/ldapstudio/trunk/ldapstudio-schemas-plugin/src/main/java/org/apache/directory/ldapstudio/schemas/view/viewers/SchemasViewContentProvider.java
Wed Mar 21 02:26:35 2007
@@ -121,15 +121,14 @@
 
             if ( root.getChildren().isEmpty() )
             {
-                Schema[] schemas = this.schemaPool.getSchemas();
-                for ( int i = 0; i < schemas.length; i++ )
+                Schema[] schemas = schemaPool.getSchemas();
+                for ( Schema schema : schemas )
                 {
-                    root.addChild( new SchemaWrapper( schemas[i], root ) );
+                    root.addChild( new SchemaWrapper( schema, root ) );
                 }
             }
 
             children = root.getChildren();
-
             Collections.sort( children, schemaSorter );
         }
         if ( parentElement instanceof IntermediateNode )
@@ -142,20 +141,20 @@
                 {
                     Schema schema = ( ( SchemaWrapper ) intermediate.getParent() ).getMySchema();
 
-                    AttributeType[] attributeTypeList = schema.getAttributeTypesAsArray();
-                    for ( int i = 0; i < attributeTypeList.length; i++ )
+                    AttributeType[] ats = schema.getAttributeTypesAsArray();
+                    for ( AttributeType at : ats )
                     {
-                        intermediate.addChild( new AttributeTypeWrapper( attributeTypeList[i],
intermediate ) );
+                        intermediate.addChild( new AttributeTypeWrapper( at, intermediate
) );
                     }
                 }
                 else if ( intermediate.getType().equals( IntermediateNodeType.OBJECT_CLASS_FOLDER
) )
                 {
                     Schema schema = ( ( SchemaWrapper ) intermediate.getParent() ).getMySchema();
 
-                    ObjectClass[] objectClassList = schema.getObjectClassesAsArray();
-                    for ( int i = 0; i < objectClassList.length; i++ )
+                    ObjectClass[] ocs = schema.getObjectClassesAsArray();
+                    for ( ObjectClass oc : ocs )
                     {
-                        intermediate.addChild( new ObjectClassWrapper( objectClassList[i],
intermediate ) );
+                        intermediate.addChild( new ObjectClassWrapper( oc, intermediate )
);
                     }
                 }
             }
@@ -202,16 +201,16 @@
                 {
                     Schema schema = schemaWrapper.getMySchema();
 
-                    AttributeType[] attributeTypeList = schema.getAttributeTypesAsArray();
-                    for ( int i = 0; i < attributeTypeList.length; i++ )
+                    AttributeType[] ats = schema.getAttributeTypesAsArray();
+                    for ( AttributeType at : ats )
                     {
-                        schemaWrapper.addChild( new AttributeTypeWrapper( attributeTypeList[i],
schemaWrapper ) );
+                        schemaWrapper.addChild( new AttributeTypeWrapper( at, schemaWrapper
) );
                     }
 
-                    ObjectClass[] objectClassList = schema.getObjectClassesAsArray();
-                    for ( int i = 0; i < objectClassList.length; i++ )
+                    ObjectClass[] ocs = schema.getObjectClassesAsArray();
+                    for ( ObjectClass oc : ocs )
                     {
-                        schemaWrapper.addChild( new ObjectClassWrapper( objectClassList[i],
schemaWrapper ) );
+                        schemaWrapper.addChild( new ObjectClassWrapper( oc, schemaWrapper
) );
                     }
                 }
 
@@ -432,11 +431,11 @@
 
         ITreeNode realNode = null;
         Object[] children = getChildren( parentNode );
-        for ( int i = 0; i < children.length; i++ )
+        for ( Object child : children )
         {
-            if ( children[i].equals( fakeNode ) )
+            if ( child.equals( fakeNode ) )
             {
-                realNode = ( ITreeNode ) children[i];
+                realNode = ( ITreeNode ) child;
                 break;
             }
         }
@@ -480,11 +479,11 @@
 
         ITreeNode realNode = null;
         Object[] children = getChildren( parentNode );
-        for ( int i = 0; i < children.length; i++ )
+        for ( Object child : children )
         {
-            if ( children[i].equals( fakeNode ) )
+            if ( child.equals( fakeNode ) )
             {
-                realNode = ( ITreeNode ) children[i];
+                realNode = ( ITreeNode ) child;
                 break;
             }
         }
@@ -508,12 +507,11 @@
     private ITreeNode findSchemaWrapperInTree( SchemaWrapper schemaWrapper )
     {
         Object[] schemaWrappers = getChildren( ( ITreeNode ) viewer.getInput() );
-        for ( int i = 0; i < schemaWrappers.length; i++ )
+        for ( Object sw : schemaWrappers )
         {
-            SchemaWrapper sw = ( SchemaWrapper ) schemaWrappers[i];
             if ( sw.equals( schemaWrapper ) )
             {
-                return sw;
+                return ( ITreeNode ) sw;
             }
         }
 
@@ -546,9 +544,9 @@
         if ( group == PluginConstants.PREFS_SCHEMAS_VIEW_GROUPING_FOLDERS )
         {
             Object[] children = getChildren( realSchemaWrapper );
-            for ( int i = 0; i < children.length; i++ )
+            for ( Object child : children )
             {
-                IntermediateNode intermediateNode = ( IntermediateNode ) children[i];
+                IntermediateNode intermediateNode = ( IntermediateNode ) child;
 
                 if ( element instanceof AttributeType )
                 {



Mime
View raw message