directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r571961 - in /directory/studio/trunk: studio-connection-ui/ studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ studio-connection-ui/src/main/resources/ studio-ldapbrowser-common/
Date Sun, 02 Sep 2007 11:55:30 GMT
Author: seelmann
Date: Sun Sep  2 04:55:29 2007
New Revision: 571961

URL: http://svn.apache.org/viewvc?rev=571961&view=rev
Log:
Fixed DIRSTUDIO-180. Added dependency between connection pages.

Modified:
    directory/studio/trunk/studio-connection-ui/plugin.xml
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageManager.java
    directory/studio/trunk/studio-connection-ui/src/main/resources/connectionParameterPages.exsd
    directory/studio/trunk/studio-ldapbrowser-common/plugin.xml

Modified: directory/studio/trunk/studio-connection-ui/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/plugin.xml?rev=571961&r1=571960&r2=571961&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/plugin.xml (original)
+++ directory/studio/trunk/studio-connection-ui/plugin.xml Sun Sep  2 04:55:29 2007
@@ -28,11 +28,15 @@
          point="org.apache.directory.studio.connectionparameterpages">
       <connectionParameterPage
             class="org.apache.directory.studio.connection.ui.widgets.NetworkParameterPage"
+            dependsOnId="org.apache.directory.studio.connection.ui.widgets.NetworkParameterPage"
             description="Please enter connection name and network parameters."
+            id="org.apache.directory.studio.connection.ui.widgets.NetworkParameterPage"
             name="Network Parameter"/>
       <connectionParameterPage
             class="org.apache.directory.studio.connection.ui.widgets.AuthenticationParameterPage"
+            dependsOnId="org.apache.directory.studio.connection.ui.widgets.NetworkParameterPage"
             description="Please select an authentification method and input authentification
data."
+            id="org.apache.directory.studio.connection.ui.widgets.AuthenticationParameterPage"
             name="Authentication"/>
    </extension>  
 </plugin>

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java?rev=571961&r1=571960&r2=571961&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java
Sun Sep  2 04:55:29 2007
@@ -33,12 +33,18 @@
 public abstract class AbstractConnectionParameterPage implements ConnectionParameterPage
 {
 
+    /** The page id. */
+    protected String pageId;
+
     /** The page name. */
     protected String pageName;
-
+    
     /** The page description. */
     protected String pageDescription;
 
+    /** The page id this page depends on. */
+    protected String pageDependsOnId;
+    
     /** The runnable context. */
     protected IRunnableContext runnableContext;
 
@@ -94,6 +100,24 @@
 
 
     /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#getPageId()
+     */
+    public String getPageId()
+    {
+        return pageId;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#setPageId(java.lang.String)
+     */
+    public void setPageId( String pageId )
+    {
+        this.pageId = pageId;
+    }
+
+
+    /**
      * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#getPageName()
      */
     public String getPageName()
@@ -126,6 +150,24 @@
     public void setPageDescription( String pageDescription )
     {
         this.pageDescription = pageDescription;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#getPageDependsOnId()
+     */
+    public String getPageDependsOnId()
+    {
+        return pageDependsOnId;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#setPageDependsOnId(java.lang.String)
+     */
+    public void setPageDependsOnId( String pageDependsOnId )
+    {
+        this.pageDependsOnId = pageDependsOnId;
     }
 
 

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java?rev=571961&r1=571960&r2=571961&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java
Sun Sep  2 04:55:29 2007
@@ -110,13 +110,29 @@
 
 
     /**
+     * Sets the page id.
+     * 
+     * @param pageId the page id
+     */
+    public void setPageId( String pageId );
+
+
+    /**
+     * Gets the page id.
+     * 
+     * @return the page id
+     */
+    public String getPageId();
+    
+    
+    /**
      * Sets the page name.
      * 
      * @param pageName the page name
      */
     public void setPageName( String pageName );
-
-
+    
+    
     /**
      * Gets the page name.
      * 
@@ -141,6 +157,22 @@
     public String getPageDescription();
 
 
+    /**
+     * Sets the page id this page depends on.
+     * 
+     * @param pageDependsOnId the page id this page depends on
+     */
+    public void setPageDependsOnId( String pageDependsOnId );
+
+
+    /**
+     * Gets the page id this page depends on.
+     * 
+     * @return the page id this page depends on
+     */
+    public String getPageDependsOnId();
+    
+    
     /**
      * Sets the focus.
      */

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageManager.java?rev=571961&r1=571960&r2=571961&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageManager.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageManager.java
Sun Sep  2 04:55:29 2007
@@ -22,7 +22,11 @@
 
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IExtensionPoint;
@@ -53,18 +57,20 @@
         IExtensionPoint extensionPoint = registry
             .getExtensionPoint( "org.apache.directory.studio.connectionparameterpages" );
         IConfigurationElement[] members = extensionPoint.getConfigurationElements();
-        Collection<ConnectionParameterPage> pageCollection = new ArrayList<ConnectionParameterPage>();
+        final Map<String, ConnectionParameterPage> pageMap = new HashMap<String,
ConnectionParameterPage>();
 
-        // For each extension:
+        // For each extension: instantiate the page
         for ( int m = 0; m < members.length; m++ )
         {
             IConfigurationElement member = members[m];
             try
             {
                 ConnectionParameterPage page = ( ConnectionParameterPage ) member.createExecutableExtension(
"class" );
+                page.setPageId( member.getAttribute( "id" ) );
                 page.setPageName( member.getAttribute( "name" ) );
                 page.setPageDescription( member.getAttribute( "description" ) );
-                pageCollection.add( page );
+                page.setPageDependsOnId( member.getAttribute( "dependsOnId" ) );
+                pageMap.put( page.getPageId(), page );
             }
             catch ( Exception e )
             {
@@ -74,7 +80,82 @@
             }
         }
 
-        ConnectionParameterPage[] pages = pageCollection.toArray( new ConnectionParameterPage[0]
);
+        final ConnectionParameterPage[] pages = pageMap.values().toArray( new ConnectionParameterPage[0]
);
+        Comparator<? super ConnectionParameterPage> pageComparator = new Comparator<ConnectionParameterPage>()
+        {
+            public int compare( ConnectionParameterPage p1, ConnectionParameterPage p2 )
+            {
+                String dependsOnId1 = p1.getPageDependsOnId();
+                String dependsOnId2 = p2.getPageDependsOnId();
+                do
+                {
+                    if(dependsOnId1 == null && dependsOnId2 != null )
+                    {
+                        return -1;
+                    }
+                    else if(dependsOnId2 == null && dependsOnId1 != null )
+                    {
+                        return 1;
+                    }
+                    else if(dependsOnId1 != null && dependsOnId1.equals( p2.getPageId()
))
+                    {
+                        return 1;
+                    }
+                    else if(dependsOnId2 != null && dependsOnId2.equals( p1.getPageId()
))
+                    {
+                        return -1;
+                    }
+                    
+                    ConnectionParameterPage page = pageMap.get( dependsOnId1 );
+                    if(page != null)
+                    {
+                        dependsOnId1 = page.getPageDependsOnId();
+                    }
+                    else
+                    {
+                        dependsOnId1 = null;
+                    }
+                }
+                while(dependsOnId1 != null && !dependsOnId1.equals( p1.getPageId()
));
+                
+                dependsOnId1 = p1.getPageDependsOnId();
+                dependsOnId2 = p2.getPageDependsOnId();
+                do
+                {
+                    if(dependsOnId1 == null && dependsOnId2 != null )
+                    {
+                        return -1;
+                    }
+                    else if(dependsOnId2 == null && dependsOnId1 != null )
+                    {
+                        return 1;
+                    }
+                    else if(dependsOnId1 != null && dependsOnId1.equals( p2.getPageId()
))
+                    {
+                        return 1;
+                    }
+                    else if(dependsOnId2 != null && dependsOnId2.equals( p1.getPageId()
))
+                    {
+                        return -1;
+                    }
+                    
+                    ConnectionParameterPage page = pageMap.get( dependsOnId2 );
+                    if(page != null)
+                    {
+                        dependsOnId2 = page.getPageDependsOnId();
+                    }
+                    else
+                    {
+                        dependsOnId2 = null;
+                    }
+                }
+                while(dependsOnId2 != null && !dependsOnId2.equals( p2.getPageId()
));
+                
+                return 0;
+            }
+        };
+        Arrays.sort( pages, pageComparator );
+        
         return pages;
     }
 }

Modified: directory/studio/trunk/studio-connection-ui/src/main/resources/connectionParameterPages.exsd
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/resources/connectionParameterPages.exsd?rev=571961&r1=571960&r2=571961&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/resources/connectionParameterPages.exsd
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/resources/connectionParameterPages.exsd
Sun Sep  2 04:55:29 2007
@@ -46,6 +46,13 @@
          </appInfo>
       </annotation>
       <complexType>
+         <attribute name="id" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
          <attribute name="name" type="string" use="required">
             <annotation>
                <documentation>
@@ -74,6 +81,13 @@
                <appInfo>
                   <meta.attribute kind="java" basedOn="org.apache.directory.studio.connection.ui.IConnectionParameterPage"/>
                </appInfo>
+            </annotation>
+         </attribute>
+         <attribute name="dependsOnId" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
             </annotation>
          </attribute>
       </complexType>

Modified: directory/studio/trunk/studio-ldapbrowser-common/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/plugin.xml?rev=571961&r1=571960&r2=571961&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/plugin.xml (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/plugin.xml Sun Sep  2 04:55:29 2007
@@ -281,7 +281,9 @@
        point="org.apache.directory.studio.connectionparameterpages">
     <connectionParameterPage
           class="org.apache.directory.studio.ldapbrowser.common.widgets.connection.BrowserParameterPage"
+          dependsOnId="org.apache.directory.studio.connection.ui.widgets.AuthenticationParameterPage"
           description="You can specify additional connection parameters."
+          id="org.apache.directory.studio.ldapbrowser.common.widgets.connection.BrowserParameterPage"
           name="Browser Options"/>
  </extension>
  



Mime
View raw message