directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r581684 - in /directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui: actions/NewConnectionAction.java wizards/NewConnectionWizard.java
Date Wed, 03 Oct 2007 18:50:18 GMT
Author: seelmann
Date: Wed Oct  3 11:50:17 2007
New Revision: 581684

URL: http://svn.apache.org/viewvc?rev=581684&view=rev
Log:
DIRSTUDIO-187: modified new connection wizard to work with connection folders

Modified:
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/NewConnectionAction.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizard.java

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/NewConnectionAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/NewConnectionAction.java?rev=581684&r1=581683&r2=581684&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/NewConnectionAction.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/NewConnectionAction.java
Wed Oct  3 11:50:17 2007
@@ -21,11 +21,17 @@
 package org.apache.directory.studio.connection.ui.actions;
 
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
 import org.apache.directory.studio.connection.ui.ConnectionUIConstants;
 import org.apache.directory.studio.connection.ui.ConnectionUIPlugin;
 import org.apache.directory.studio.connection.ui.wizards.NewConnectionWizard;
 import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.PlatformUI;
 
 
 /**
@@ -50,7 +56,12 @@
      */
     public void run()
     {
+        List<Object> selectedObjects = new ArrayList<Object>();
+        selectedObjects.addAll( Arrays.asList( getSelectedConnectionFolders() ) );
+        selectedObjects.addAll( Arrays.asList( getSelectedConnections() ) );
+
         NewConnectionWizard wizard = new NewConnectionWizard();
+        wizard.init( PlatformUI.getWorkbench(), new StructuredSelection( selectedObjects
) );
         WizardDialog dialog = new WizardDialog( getShell(), wizard );
         dialog.setBlockOnOpen( true );
         dialog.create();

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizard.java?rev=581684&r1=581683&r2=581684&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizard.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizard.java
Wed Oct  3 11:50:17 2007
@@ -23,6 +23,7 @@
 
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
+import org.apache.directory.studio.connection.core.ConnectionFolder;
 import org.apache.directory.studio.connection.core.ConnectionParameter;
 import org.apache.directory.studio.connection.core.jobs.OpenConnectionsJob;
 import org.apache.directory.studio.connection.ui.ConnectionParameterPage;
@@ -49,6 +50,8 @@
     /** The connection parameter pages. */
     private ConnectionParameterPage[] pages;
 
+    /** The selected connection folder. */
+    private ConnectionFolder selectedConnectionFolder;
 
     /**
      * Creates a new instance of NewConnectionWizard.
@@ -76,6 +79,23 @@
      */
     public void init( IWorkbench workbench, IStructuredSelection selection )
     {
+        Object firstElement = selection.getFirstElement();
+        if ( firstElement instanceof ConnectionFolder )
+        {
+            selectedConnectionFolder = ( ConnectionFolder ) firstElement;
+        }
+        else if ( firstElement instanceof Connection )
+        {
+            Connection connection = ( Connection ) firstElement;
+            selectedConnectionFolder = ConnectionCorePlugin.getDefault().getConnectionFolderManager()
+                .getParentConnectionFolder( connection );
+        }
+
+        if ( selectedConnectionFolder == null )
+        {
+            selectedConnectionFolder = ConnectionCorePlugin.getDefault().getConnectionFolderManager()
+                .getRootConnectionFolder();
+        }
     }
 
 
@@ -132,7 +152,7 @@
      */
     public boolean performFinish()
     {
-        // get connection paramters from pages and save dialog settings 
+        // get connection parameters from pages and save dialog settings 
         ConnectionParameter connectionParameter = new ConnectionParameter();
         for ( int i = 0; i < pages.length; i++ )
         {
@@ -143,6 +163,9 @@
         // create persistent connection
         final Connection conn = new Connection( connectionParameter );
         ConnectionCorePlugin.getDefault().getConnectionManager().addConnection( conn );
+        
+        // add connection to folder
+        selectedConnectionFolder.addConnectionId( conn.getId() );
 
         // open connection
         new OpenConnectionsJob( conn ).execute();



Mime
View raw message