directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r568990 [1/3] - in /directory/studio/trunk/studio-connection-ui: ./ META-INF/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/studio/ src/main...
Date Thu, 23 Aug 2007 13:47:13 GMT
Author: seelmann
Date: Thu Aug 23 06:47:09 2007
New Revision: 568990

URL: http://svn.apache.org/viewvc?rev=568990&view=rev
Log:
Added studio-connection-ui plugin

Added:
    directory/studio/trunk/studio-connection-ui/
    directory/studio/trunk/studio-connection-ui/.classpath
    directory/studio/trunk/studio-connection-ui/.project
    directory/studio/trunk/studio-connection-ui/META-INF/
    directory/studio/trunk/studio-connection-ui/META-INF/MANIFEST.MF
    directory/studio/trunk/studio-connection-ui/build.properties
    directory/studio/trunk/studio-connection-ui/build.xml
    directory/studio/trunk/studio-connection-ui/ivy.xml
    directory/studio/trunk/studio-connection-ui/plugin.xml
    directory/studio/trunk/studio-connection-ui/src/
    directory/studio/trunk/studio-connection-ui/src/main/
    directory/studio/trunk/studio-connection-ui/src/main/java/
    directory/studio/trunk/studio-connection-ui/src/main/java/org/
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/
    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/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageModifyListener.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIConstants.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIPlugin.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ExceptionHandler.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UIAuthHandler.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UiThreadEventRunner.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ActionHandlerManager.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CloseConnectionAction.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ConnectionViewActionProxy.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CopyAction.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/DeleteAction.java
    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/actions/OpenConnectionAction.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/PasteAction.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/PropertiesAction.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/RenameAction.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/SelectionUtils.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/StudioAction.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/StudioActionProxy.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dialogs/
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dialogs/CredentialsDialog.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dnd/
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dnd/ConnectionTransfer.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/properties/
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ConnectionPropertyPage.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/BaseWidgetUtils.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionActionGroup.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionConfiguration.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionContentProvider.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionLabelProvider.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionUniversalListener.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionWidget.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/HistoryUtils.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/NetworkParameterPage.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/RunnableContextJobAdapter.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ViewFormWidget.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizard.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizardPage.java
    directory/studio/trunk/studio-connection-ui/src/main/resources/
    directory/studio/trunk/studio-connection-ui/src/main/resources/connectionParameterPages.exsd
    directory/studio/trunk/studio-connection-ui/src/test/
    directory/studio/trunk/studio-connection-ui/src/test/java/

Added: directory/studio/trunk/studio-connection-ui/.classpath
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/.classpath?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/.classpath (added)
+++ directory/studio/trunk/studio-connection-ui/.classpath Thu Aug 23 06:47:09 2007
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry kind="src" path="src/test/java"/>
+	<classpathentry kind="src" path="src/main/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: directory/studio/trunk/studio-connection-ui/.project
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/.project?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/.project (added)
+++ directory/studio/trunk/studio-connection-ui/.project Thu Aug 23 06:47:09 2007
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>studio-connection-ui</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: directory/studio/trunk/studio-connection-ui/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/META-INF/MANIFEST.MF?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/META-INF/MANIFEST.MF (added)
+++ directory/studio/trunk/studio-connection-ui/META-INF/MANIFEST.MF Thu Aug 23 06:47:09 2007
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Directory Studio Connection UI
+Bundle-SymbolicName: org.apache.directory.studio.connection.ui;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.apache.directory.studio.connection.ui.ConnectionUIPlugin
+Bundle-Vendor: Apache Software Foundation
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.apache.directory.studio.connection.core,
+ org.eclipse.ui.workbench.texteditor
+Eclipse-LazyStart: true
+Export-Package: org.apache.directory.studio.connection.ui,
+ org.apache.directory.studio.connection.ui.actions,
+ org.apache.directory.studio.connection.ui.dnd,
+ org.apache.directory.studio.connection.ui.properties,
+ org.apache.directory.studio.connection.ui.widgets,
+ org.apache.directory.studio.connection.ui.wizards

Added: directory/studio/trunk/studio-connection-ui/build.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/build.properties?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/build.properties (added)
+++ directory/studio/trunk/studio-connection-ui/build.properties Thu Aug 23 06:47:09 2007
@@ -0,0 +1,5 @@
+source.. = src/main/java/
+output.. = classes/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml

Added: directory/studio/trunk/studio-connection-ui/build.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/build.xml?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/build.xml (added)
+++ directory/studio/trunk/studio-connection-ui/build.xml Thu Aug 23 06:47:09 2007
@@ -0,0 +1,49 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<project default="plugin">
+	<import file="../studio-build/build.xml"/>
+	
+	
+	<!-- RETRIEVE-STUDIO-JAR-DEPENDENCIES TASK -->
+	<target name="retrieve-studio-jar-dependencies" description="Compiles the dependencies of the project" >
+		<ant dir="../studio-jars" target="retrieve-dependencies" inheritall="false" />
+	</target>
+	
+	<!-- COMPILE-DEPENDENCIES TASK -->
+	<target name="compile-dependencies" description="Compiles the dependencies of the project" >
+		<ant dir="../studio-connection-core" target="compile" inheritall="false" />
+	</target>
+	
+	<!-- BUILD-CLASSPATH TASK -->
+	<target name="build-classpath" depends="retrieve-studio-jar-dependencies" description="Computes the classpath" >
+		<echo>Building classpath for ${project.name} (${project.id}) version ${project.version}</echo>
+		<path id="classpath">
+			<!-- Project dependencies -->
+			<fileset dir="${lib.dir}" />
+			<!-- Eclipse dependencies -->
+			<fileset dir="../dependencies/eclipse/3.2">
+				<include name="**/*.jar"/>
+			</fileset>
+			<!-- Plugin dependencies -->
+			<fileset dir="../studio-jars/lib/" />
+			<pathelement location="../studio-connection-core/target/classes"/>
+		</path>
+	</target>
+	
+</project>

Added: directory/studio/trunk/studio-connection-ui/ivy.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/ivy.xml?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/ivy.xml (added)
+++ directory/studio/trunk/studio-connection-ui/ivy.xml Thu Aug 23 06:47:09 2007
@@ -0,0 +1,21 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<ivy-module version="1.0">
+	<info organisation="org.apache.directory.studio" module="studio-connection-ui"/>
+</ivy-module>
\ No newline at end of file

Added: directory/studio/trunk/studio-connection-ui/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/plugin.xml?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/plugin.xml (added)
+++ directory/studio/trunk/studio-connection-ui/plugin.xml Thu Aug 23 06:47:09 2007
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+    <extension-point id="org.apache.directory.studio.connectionparameterpages" name="Connection Parameter Pages" schema="src/main/resources/connectionParameterPages.exsd"/>
+
+   	<extension
+		point="org.eclipse.ui.propertyPages">
+		<page
+        class="org.apache.directory.studio.connection.ui.properties.ConnectionPropertyPage"
+        id="org.apache.directory.studio.connection.ui.properties.ConnectionPropertyPage"
+        name="Connection"
+        objectClass="org.apache.directory.studio.connection.core.ConnectionPropertyPageProvider"/>            
+
+   </extension>
+
+   <extension
+         point="org.eclipse.ui.newWizards">
+      <wizard
+            category="org.apache.directory.studio.ldapbrowser.newWizards"
+            class="org.apache.directory.studio.connection.ui.wizards.NewConnectionWizard"
+            hasPages="true"
+            icon="resources/icons/connection_add.gif"
+            id="org.apache.directory.studio.connection.ui.wizards.NewConnectionWizard"
+            name="LDAP Connection"
+            project="false"/>
+   </extension>
+   <extension
+         point="org.apache.directory.studio.connectionparameterpages">
+      <connectionParameterPage
+            class="org.apache.directory.studio.connection.ui.widgets.NetworkParameterPage"
+            description="Please enter connection name and network parameters."
+            name="Network Parameter"/>
+      <connectionParameterPage
+            class="org.apache.directory.studio.connection.ui.widgets.AuthenticationParameterPage"
+            description="Please select an authentification method and input authentification data."
+            name="Authentication"/>
+   </extension>  
+</plugin>

Added: 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=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,158 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.connection.ui;
+
+
+import org.apache.directory.studio.connection.core.ConnectionParameter;
+import org.eclipse.jface.operation.IRunnableContext;
+
+
+/**
+ * Base implementation of ConnectionParameterPage.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class AbstractConnectionParameterPage implements ConnectionParameterPage
+{
+
+    /** The page name. */
+    protected String pageName;
+
+    /** The page description. */
+    protected String pageDescription;
+
+    /** The runnable context. */
+    protected IRunnableContext runnableContext;
+
+    /** The connection parameter page modify listener. */
+    protected ConnectionParameterPageModifyListener connectionParameterPageModifyListener;
+
+    /** The message. */
+    protected String message;
+
+    /** The error message. */
+    protected String errorMessage;
+
+    /** The connection parameter. */
+    protected ConnectionParameter connectionParameter;
+
+
+    /**
+     * Creates a new instance of AbstractConnectionParameterPage.
+     */
+    protected AbstractConnectionParameterPage()
+    {
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#setConnectionParameterPageModifyListener(org.apache.directory.studio.connection.ui.ConnectionParameterPageModifyListener)
+     */
+    public void setConnectionParameterPageModifyListener( ConnectionParameterPageModifyListener listener )
+    {
+        this.connectionParameterPageModifyListener = listener;
+
+    }
+
+
+    /**
+     * Fires a connection page modified event when then page was modified.
+     */
+    protected void fireConnectionPageModified()
+    {
+        connectionParameterPageModifyListener.connectionParameterPageModified();
+    }
+
+
+    /**
+     * Sets the runnable context.
+     * 
+     * @param runnableContext the runnable context
+     */
+    public void setRunnableContext( IRunnableContext runnableContext )
+    {
+        this.runnableContext = runnableContext;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#getPageName()
+     */
+    public String getPageName()
+    {
+        return pageName;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#setPageName(java.lang.String)
+     */
+    public void setPageName( String pageName )
+    {
+        this.pageName = pageName;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#getPageDescription()
+     */
+    public String getPageDescription()
+    {
+        return pageDescription;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#setPageDescription(java.lang.String)
+     */
+    public void setPageDescription( String pageDescription )
+    {
+        this.pageDescription = pageDescription;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#getErrorMessage()
+     */
+    public String getErrorMessage()
+    {
+        return errorMessage;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#getMessage()
+     */
+    public String getMessage()
+    {
+        return message;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#isValid()
+     */
+    public boolean isValid()
+    {
+        return message == null && errorMessage == null;
+    }
+
+}

Added: 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=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,149 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.connection.ui;
+
+
+import org.apache.directory.studio.connection.core.ConnectionParameter;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * An IConnectionParameterPage is used to add connection parameter pages
+ * to the connection wizard and the connection property page.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ConnectionParameterPage
+{
+
+    /**
+     * Initializes the fields with the given parameters.
+     * 
+     * @param parameter the parameter
+     */
+    public void loadParameters( ConnectionParameter parameter );
+
+
+    /**
+     * Save the fields to the parameters.
+     * 
+     * @param parameter the parameter
+     */
+    public void saveParameters( ConnectionParameter parameter );
+
+
+    /**
+     * Checks if is valid.
+     * 
+     * @return true, if is valid
+     */
+    public boolean isValid();
+
+
+    /**
+     * Gets an error message that should be displayed
+     * to the user. Null means no error message so an 
+     * existing error message should be cleared.
+     * 
+     * @return the error message
+     */
+    public String getErrorMessage();
+
+
+    /**
+     * Gets a non-error message that should be displayed
+     * to the user. Null means no message so an existing
+     * message should be cleared.
+     * 
+     * @return the message
+     */
+    public String getMessage();
+
+
+    /**
+     * Creates the composite.
+     * 
+     * @param parent the parent
+     */
+    public void createComposite( Composite parent );
+
+
+    /**
+     * Saves the dialog settings.
+     */
+    public void saveDialogSettings();
+
+
+    /**
+     * Sets the connection parameter page modify listener.
+     * 
+     * @param listener the connection parameter page modify listener
+     */
+    public void setConnectionParameterPageModifyListener( ConnectionParameterPageModifyListener listener );
+
+
+    /**
+     * Sets the runnable context.
+     * 
+     * @param runnableContext the runnable context
+     */
+    public void setRunnableContext( IRunnableContext runnableContext );
+
+
+    /**
+     * Sets the page name.
+     * 
+     * @param pageName the page name
+     */
+    public void setPageName( String pageName );
+
+
+    /**
+     * Gets the page name.
+     * 
+     * @return the page name
+     */
+    public String getPageName();
+    
+    
+    /**
+     * Sets the page description.
+     * 
+     * @param pageDescription the page description
+     */
+    public void setPageDescription( String pageDescription );
+    
+    
+    /**
+     * Gets the page description.
+     * 
+     * @return the page description
+     */
+    public String getPageDescription();
+
+
+    /**
+     * Sets the focus.
+     */
+    public void setFocus();
+
+}

Added: 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=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageManager.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageManager.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,80 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.connection.ui;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+
+
+/**
+ * The ConnectionParameterPageManager manages the {@link ConnectionParameterPage}s.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ConnectionParameterPageManager
+{
+    
+    /**
+     * Gets the connection parameter pages by searching for connection parameter page
+     * extensions.
+     * 
+     * @return the connection parameter pages
+     */
+    public static ConnectionParameterPage[] getConnectionParameterPages()
+    {
+        IExtensionRegistry registry = Platform.getExtensionRegistry();
+        IExtensionPoint extensionPoint = registry
+            .getExtensionPoint( "org.apache.directory.studio.connectionparameterpages" );
+        IConfigurationElement[] members = extensionPoint.getConfigurationElements();
+        Collection<ConnectionParameterPage> pageCollection = new ArrayList<ConnectionParameterPage>();
+
+        // For each extension:
+        for ( int m = 0; m < members.length; m++ )
+        {
+            IConfigurationElement member = members[m];
+            try
+            {
+                ConnectionParameterPage page = ( ConnectionParameterPage ) member.createExecutableExtension( "class" );
+                page.setPageName( member.getAttribute( "name" ) );
+                page.setPageDescription( member.getAttribute( "description" ) );
+                pageCollection.add( page );
+            }
+            catch ( Exception e )
+            {
+                ConnectionUIPlugin.getDefault().getLog().log(
+                    new Status( IStatus.ERROR, ConnectionUIPlugin.PLUGIN_ID, 1,
+                        "Unable to create connection parameter page " + member.getAttribute( "class" ), e ) );
+            }
+        }
+
+        ConnectionParameterPage[] pages = pageCollection.toArray( new ConnectionParameterPage[0] );
+        return pages;
+    }
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageModifyListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageModifyListener.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageModifyListener.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageModifyListener.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.connection.ui;
+
+
+import org.apache.directory.studio.connection.core.ConnectionParameter;
+
+
+/**
+ * A ConnectionPageModifyListener listens for modifications of the 
+ * ConnectionPageWrapper.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ConnectionParameterPageModifyListener
+{
+
+    /**
+     * Indicates that the connection parameter page was modified.
+     */
+    public void connectionParameterPageModified();
+
+
+    /**
+     * Gets the test connection parameters.
+     * 
+     * @return the test connection parameters
+     */
+    public ConnectionParameter getTestConnectionParameters();
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIConstants.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIConstants.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIConstants.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.connection.ui;
+
+public interface ConnectionUIConstants
+{
+
+    public static final String DIALOGSETTING_KEY_HOST_HISTORY = "hostHistory";
+
+    public static final String DIALOGSETTING_KEY_PORT_HISTORY = "portHistory";
+    
+    public static final String DIALOGSETTING_KEY_PRINCIPAL_HISTORY = "principalHistory";
+
+    
+    public static final String IMG_CONNECTION_ADD = "resources/icons/connection_add.gif";
+
+    public static final String IMG_CONNECTION_CONNECTED = "resources/icons/connection_connected.gif";
+
+    public static final String IMG_CONNECTION_DISCONNECTED = "resources/icons/connection_disconnected.gif";
+
+    public static final String IMG_CONNECTION_CONNECT = "resources/icons/connection_connect.gif";
+
+    public static final String IMG_CONNECTION_DISCONNECT = "resources/icons/connection_disconnect.gif";
+    
+    public static final String IMG_CONNECTION_WIZARD = "resources/icons/connection_wizard.gif";
+    
+    public static final String IMG_PULLDOWN = "resources/icons/pulldown.gif";
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIPlugin.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIPlugin.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIPlugin.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIPlugin.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,190 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.connection.ui;
+
+
+import java.net.URL;
+
+import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
+import org.apache.directory.studio.connection.core.event.EventRunner;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class ConnectionUIPlugin extends AbstractUIPlugin
+{
+
+    /** The Constant PLUGIN_ID. */
+    public static final String PLUGIN_ID = "org.apache.directory.studio.connection.ui";
+
+    /** The shared plugin instande. */
+    private static ConnectionUIPlugin plugin;
+
+    /** The event dispatcher */
+    private ExceptionHandler exceptionHandler;
+
+    /** The event runner. */
+    private EventRunner eventRunner;
+
+
+    /**
+     * The constructor
+     */
+    public ConnectionUIPlugin()
+    {
+        plugin = this;
+    }
+
+
+    /**
+     * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+     */
+    public void start( BundleContext context ) throws Exception
+    {
+        super.start( context );
+
+        if ( exceptionHandler == null )
+        {
+            exceptionHandler = new ExceptionHandler();
+        }
+
+        if ( eventRunner == null )
+        {
+            eventRunner = new UiThreadEventRunner();
+        }
+
+        ConnectionCorePlugin.getDefault().setAuthHandler( new UIAuthHandler() );
+    }
+
+
+    /**
+     * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+     */
+    public void stop( BundleContext context ) throws Exception
+    {
+        plugin = null;
+        super.stop( context );
+
+        if ( exceptionHandler != null )
+        {
+            exceptionHandler = null;
+        }
+
+        if ( eventRunner != null )
+        {
+            eventRunner = null;
+        }
+    }
+
+
+    /**
+     * Returns the shared instance
+     *
+     * @return the shared instance
+     */
+    public static ConnectionUIPlugin getDefault()
+    {
+        return plugin;
+    }
+
+
+    /**
+     * Gets the exception handler.
+     * 
+     * @return the exception handler
+     */
+    public ExceptionHandler getExceptionHandler()
+    {
+        return exceptionHandler;
+    }
+
+
+    /**
+     * Use this method to get SWT images. Use the IMG_ constants from
+     * BrowserWidgetsConstants for the key.
+     *
+     * @param key
+     *                The key (relative path to the image im filesystem)
+     * @return The image discriptor or null
+     */
+    public ImageDescriptor getImageDescriptor( String key )
+    {
+        if ( key != null )
+        {
+            URL url = FileLocator.find( getBundle(), new Path( key ), null );
+            if ( url != null )
+                return ImageDescriptor.createFromURL( url );
+            else
+                return null;
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    /**
+     * Use this method to get SWT images. Use the IMG_ constants from
+     * BrowserWidgetsConstants for the key. A ImageRegistry is used to manage the
+     * the key->Image mapping.
+     * <p>
+     * Note: Don't dispose the returned SWT Image. It is disposed
+     * automatically when the plugin is stopped.
+     *
+     * @param key
+     *                The key (relative path to the image im filesystem)
+     * @return The SWT Image or null
+     */
+    public Image getImage( String key )
+    {
+        Image image = getImageRegistry().get( key );
+        if ( image == null )
+        {
+            ImageDescriptor id = getImageDescriptor( key );
+            if ( id != null )
+            {
+                image = id.createImage();
+                getImageRegistry().put( key, image );
+            }
+        }
+        return image;
+    }
+
+
+    /**
+     * Gets the event runner.
+     *
+     * @return the event runner
+     */
+    public EventRunner getEventRunner()
+    {
+        return eventRunner;
+    }
+
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ExceptionHandler.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ExceptionHandler.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ExceptionHandler.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ExceptionHandler.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,70 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.connection.ui;
+
+
+import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.swt.widgets.Display;
+
+
+/**
+ * This class is used to handle exceptions thrown at runtime.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExceptionHandler
+{
+    /**
+     * Opens an error dialog to display the given error.
+     *
+     * @param status
+     *      the error to show to the user
+     */
+    public void handleException( IStatus status )
+    {
+        display( null, status );
+    }
+
+
+    /**
+     * Opens an error dialog to display the given error.
+     *
+     * @param message
+     *      the message to show in this dialog, or null to indicate that the error's message should be shown as the primary message
+     * @param status
+     *      the error to show to the user
+     */
+    private void display( final String message, final IStatus status )
+    {
+        Runnable runnable = new Runnable()
+        {
+            public void run()
+            {
+                ErrorDialog.openError( Display.getDefault().getActiveShell(), "Error", message, status );
+            }
+        };
+        Display.getDefault().asyncExec( runnable );
+        ConnectionCorePlugin.getDefault().getLog().log( status );
+    }
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UIAuthHandler.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UIAuthHandler.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UIAuthHandler.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UIAuthHandler.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,80 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.connection.ui;
+
+
+import org.apache.directory.studio.connection.core.ConnectionParameter;
+import org.apache.directory.studio.connection.core.Credentials;
+import org.apache.directory.studio.connection.core.IAuthHandler;
+import org.apache.directory.studio.connection.core.ICredentials;
+import org.apache.directory.studio.connection.ui.dialogs.CredentialsDialog;
+import org.eclipse.ui.PlatformUI;
+
+
+public class UIAuthHandler implements IAuthHandler
+{
+
+    public ICredentials getCredentials( final ConnectionParameter connectionParameter )
+    {
+
+        if ( connectionParameter.getBindPrincipal() == null || "".equals( connectionParameter.getBindPrincipal() ) )
+        {
+            return new Credentials( "", "", connectionParameter );
+        }
+        else if ( connectionParameter.getBindPassword() != null && !"".equals( connectionParameter.getBindPassword() ) )
+        {
+            return new Credentials( connectionParameter.getBindPrincipal(), connectionParameter.getBindPassword(),
+                connectionParameter );
+        }
+        else
+        {
+            final String[] pw = new String[1];
+            PlatformUI.getWorkbench().getDisplay().syncExec( new Runnable()
+            {
+                public void run()
+                {
+                    CredentialsDialog dialog = new CredentialsDialog( PlatformUI.getWorkbench().getDisplay()
+                        .getActiveShell(), "Enter Password for '" + connectionParameter.getName() + "'",
+                        "Please enter password of user " + connectionParameter.getBindPrincipal() + ":", "", null );
+                    if ( dialog.open() == CredentialsDialog.OK )
+                    {
+                        pw[0] = dialog.getValue();
+                    }
+                    else
+                    {
+                        pw[0] = null;
+                    }
+                }
+            } );
+
+            if ( pw[0] == null )
+            {
+                return null;
+            }
+            else
+            {
+                return new Credentials( connectionParameter.getBindPrincipal(), pw[0], connectionParameter );
+            }
+        }
+
+    }
+
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UiThreadEventRunner.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UiThreadEventRunner.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UiThreadEventRunner.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UiThreadEventRunner.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,30 @@
+
+package org.apache.directory.studio.connection.ui;
+
+import org.apache.directory.studio.connection.core.event.EventRunnable;
+import org.apache.directory.studio.connection.core.event.EventRunner;
+import org.eclipse.swt.widgets.Display;
+
+
+/**
+ * Implementation of {@link EventRunner} that executes an {@link EventRunnable}
+ * withing the SWT UI thread.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class UiThreadEventRunner implements EventRunner
+{
+
+    /**
+     * {@inheritDoc}
+     *
+     * This implementation executes the given {@link EventRunnable} within
+     * the SWT UI thread.
+     */
+    public void execute( EventRunnable runnable )
+    {
+        Display.getDefault().asyncExec( runnable );
+    }
+
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ActionHandlerManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ActionHandlerManager.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ActionHandlerManager.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ActionHandlerManager.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,24 @@
+
+package org.apache.directory.studio.connection.ui.actions;
+
+/**
+ * A ActionHandlerManager activates and deactives the action handlers.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ActionHandlerManager
+{
+
+    /**
+     * Deactivates global action handlers.
+     */
+    public void deactivateGlobalActionHandlers();
+
+    
+    /**
+     * Activates global action handlers.
+     */
+    public void activateGlobalActionHandlers();
+
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CloseConnectionAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CloseConnectionAction.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CloseConnectionAction.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CloseConnectionAction.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,101 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.connection.ui.actions;
+
+
+import org.apache.directory.studio.connection.core.jobs.CloseConnectionsJob;
+import org.apache.directory.studio.connection.ui.ConnectionUIConstants;
+import org.apache.directory.studio.connection.ui.ConnectionUIPlugin;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+
+/**
+ * This action closes the selected Connection(s).
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CloseConnectionAction extends StudioAction
+{
+
+    /**
+     * Creates a new instance of CloseConnectionAction.
+     */
+    public CloseConnectionAction()
+    {
+        super();
+    }
+    
+    
+    /**
+     * @see org.apache.directory.studio.connection.ui.actions.StudioAction#run()
+     */
+    public void run()
+    {
+        CloseConnectionsJob ccj = new CloseConnectionsJob( getSelectedConnections() );
+        ccj.execute();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.actions.StudioAction#getText()
+     */
+    public String getText()
+    {
+        return getSelectedConnections().length > 1 ? "Close Connections" : "Close Connection";
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.actions.StudioAction#getImageDescriptor()
+     */
+    public ImageDescriptor getImageDescriptor()
+    {
+        return ConnectionUIPlugin.getDefault().getImageDescriptor( ConnectionUIConstants.IMG_CONNECTION_DISCONNECT );
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.actions.StudioAction#getCommandId()
+     */
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.actions.StudioAction#isEnabled()
+     */
+    public boolean isEnabled()
+    {
+        boolean canClose = false;
+        for ( int i = 0; i < getSelectedConnections().length; i++ )
+        {
+            if ( getSelectedConnections()[i].getJNDIConnectionWrapper().isConnected() )
+            {
+                canClose = true;
+                break;
+            }
+        }
+        return getSelectedConnections().length > 0 && canClose;
+    }
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ConnectionViewActionProxy.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ConnectionViewActionProxy.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ConnectionViewActionProxy.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ConnectionViewActionProxy.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.connection.ui.actions;
+
+
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * The ConnectionViewActionProxy is a proxy for a real action.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ConnectionViewActionProxy extends StudioActionProxy
+{
+
+    /**
+     * Creates a new instance of ConnectionViewActionProxy.
+     * 
+     * @param viewer the viewer
+     * @param actionHandlerManager the action handler manager, 
+     *        used to deactivate and activate the action handlers and key bindings
+     * @param action the real action
+     */
+    public ConnectionViewActionProxy( Viewer viewer, ActionHandlerManager actionHandlerManager, StudioAction action )
+    {
+        super( viewer, actionHandlerManager, action );
+    }
+
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CopyAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CopyAction.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CopyAction.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CopyAction.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,180 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.connection.ui.actions;
+
+
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.ui.dnd.ConnectionTransfer;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
+
+
+/**
+ * This class implements the Copy Action
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CopyAction extends StudioAction
+{
+    private StudioActionProxy pasteActionProxy;
+
+
+    /**
+     * Creates a new instance of CopyAction.
+     *
+     * @param pasteActionProxy
+     *      the associated Paste Action
+     */
+    public CopyAction( StudioActionProxy pasteActionProxy )
+    {
+        super();
+        this.pasteActionProxy = pasteActionProxy;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getText()
+    {
+
+        // connection
+        Connection[] connections = getConnections();
+        if ( connections != null )
+        {
+            return connections.length > 1 ? "Copy Connections" : "Copy Connection";
+        }
+
+        return "Copy";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ImageDescriptor getImageDescriptor()
+    {
+        return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor( ISharedImages.IMG_TOOL_COPY );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getCommandId()
+    {
+        return IWorkbenchActionDefinitionIds.COPY;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        Connection[] connections = getConnections();
+
+        // connection
+        if ( connections != null )
+        {
+            copyToClipboard( new Object[]
+                { connections }, new Transfer[]
+                { ConnectionTransfer.getInstance() } );
+        }
+
+        // update paste action
+        if ( pasteActionProxy != null )
+        {
+            pasteActionProxy.updateAction();
+        }
+    }
+
+
+    /**
+     * Copies data to Clipboard
+     *
+     * @param data
+     *      the data to be set in the clipboard
+     * @param dataTypes
+     *      the transfer agents that will convert the data to its platform specific format; 
+     *      each entry in the data array must have a corresponding dataType
+     */
+    public static void copyToClipboard( Object[] data, Transfer[] dataTypes )
+    {
+        Clipboard clipboard = null;
+        try
+        {
+            clipboard = new Clipboard( Display.getCurrent() );
+            clipboard.setContents( data, dataTypes );
+        }
+        finally
+        {
+            if ( clipboard != null )
+                clipboard.dispose();
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEnabled()
+    {
+
+        // connection
+        if ( getConnections() != null )
+        {
+            return true;
+        }
+
+        else
+        {
+            return false;
+        }
+    }
+
+
+    /**
+     * Get the Connections
+     *
+     * @return
+     *      the Connections
+     */
+    private Connection[] getConnections()
+    {
+
+        if ( getSelectedConnections().length > 0 )
+        {
+            return getSelectedConnections();
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/DeleteAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/DeleteAction.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/DeleteAction.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/DeleteAction.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,182 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.connection.ui.actions;
+
+
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.ConnectionCoreConstants;
+import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
+
+
+/**
+ * This Action implements the Delete Action. It deletes Connections, Entries, Searches, Bookmarks, Attributes or Values.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DeleteAction extends StudioAction
+{
+    /**
+     * {@inheritDoc}
+     */
+    public String getText()
+    {
+        try
+        {
+            Connection[] connections = getConnections();
+
+            if ( connections.length > 0 )
+            {
+                return connections.length > 1 ? "Delete Connections" : "Delete Connection";
+            }
+        }
+        catch ( Exception e )
+        {
+        }
+
+        return "Delete";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ImageDescriptor getImageDescriptor()
+    {
+        return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor( ISharedImages.IMG_TOOL_DELETE );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getCommandId()
+    {
+        return IWorkbenchActionDefinitionIds.DELETE;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        try
+        {
+            Connection[] connections = getConnections();
+
+            StringBuffer message = new StringBuffer();
+
+            if ( connections.length > 0 )
+            {
+                if ( connections.length <= 5 )
+                {
+                    message.append( connections.length == 1 ? "Are your sure to delete the following connection?"
+                        : "Are your sure to delete the following connections?" );
+                    for ( int i = 0; i < connections.length; i++ )
+                    {
+                        message.append( ConnectionCoreConstants.LINE_SEPARATOR );
+                        message.append( "  - " );
+                        message.append( connections[i].getName() );
+                    }
+                }
+                else
+                {
+                    message.append( "Are your sure to delete the selected connections?" );
+                }
+                message.append( ConnectionCoreConstants.LINE_SEPARATOR );
+                message.append( ConnectionCoreConstants.LINE_SEPARATOR );
+            }
+
+            if ( message.length() == 0 || MessageDialog.openConfirm( getShell(), getText(), message.toString() ) )
+            {
+
+                if ( connections.length > 0 )
+                {
+                    deleteConnections( connections );
+                }
+            }
+        }
+        catch ( Exception e )
+        {
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEnabled()
+    {
+        try
+        {
+            Connection[] connections = getConnections();
+            return connections.length > 0;
+        }
+        catch ( Exception e )
+        {
+            // e.printStackTrace();
+            return false;
+        }
+    }
+
+
+    /**
+     * Gets the Connections 
+     *
+     * @return
+     *      the Connections
+     * @throws Exception
+     *      when a is opened
+     */
+    protected Connection[] getConnections() throws Exception
+    {
+        for ( int i = 0; i < getSelectedConnections().length; i++ )
+        {
+            if ( getSelectedConnections()[i].getJNDIConnectionWrapper().isConnected() )
+            {
+                throw new Exception();
+            }
+        }
+
+        return getSelectedConnections();
+    }
+
+
+    /**
+     * Deletes Connections
+     *
+     * @param connections
+     *      the Connections to delete
+     */
+    protected void deleteConnections( Connection[] connections )
+    {
+        for ( int i = 0; i < connections.length; i++ )
+        {
+            ConnectionCorePlugin.getDefault().getConnectionManager().removeConnection( connections[i] );
+        }
+    }
+}

Added: 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=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/NewConnectionAction.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/NewConnectionAction.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,95 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.connection.ui.actions;
+
+
+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.wizard.WizardDialog;
+
+
+/**
+ * This Action launches the New Connection Wizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NewConnectionAction extends StudioAction
+{
+    /**
+     * Creates a new instance of NewConnectionAction.
+     */
+    public NewConnectionAction()
+    {
+        super();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        NewConnectionWizard wizard = new NewConnectionWizard();
+        WizardDialog dialog = new WizardDialog( getShell(), wizard );
+        dialog.setBlockOnOpen( true );
+        dialog.create();
+        dialog.open();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getText()
+    {
+        return "New Connection...";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ImageDescriptor getImageDescriptor()
+    {
+        return ConnectionUIPlugin.getDefault().getImageDescriptor( ConnectionUIConstants.IMG_CONNECTION_ADD );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEnabled()
+    {
+        return true;
+    }
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/OpenConnectionAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/OpenConnectionAction.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/OpenConnectionAction.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/OpenConnectionAction.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,100 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.connection.ui.actions;
+
+
+import org.apache.directory.studio.connection.core.jobs.OpenConnectionsJob;
+import org.apache.directory.studio.connection.ui.ConnectionUIConstants;
+import org.apache.directory.studio.connection.ui.ConnectionUIPlugin;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+
+/**
+ * This Action opens a Connection.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class OpenConnectionAction extends StudioAction
+{
+    /**
+     * Creates a new instance of OpenConnectionAction.
+     */
+    public OpenConnectionAction()
+    {
+        super();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        OpenConnectionsJob ocj = new OpenConnectionsJob( getSelectedConnections() );
+        ocj.execute();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getText()
+    {
+        return getSelectedConnections().length > 1 ? "Open Connections" : "Open Connection";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ImageDescriptor getImageDescriptor()
+    {
+        return ConnectionUIPlugin.getDefault().getImageDescriptor( ConnectionUIConstants.IMG_CONNECTION_CONNECT );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEnabled()
+    {
+        boolean canOpen = false;
+        for ( int i = 0; i < getSelectedConnections().length; i++ )
+        {
+            if ( !getSelectedConnections()[i].getJNDIConnectionWrapper().isConnected() )
+            {
+                canOpen = true;
+                break;
+            }
+        }
+        return getSelectedConnections().length > 0 && canOpen;
+    }
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/PasteAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/PasteAction.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/PasteAction.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/PasteAction.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,166 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.connection.ui.actions;
+
+
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
+import org.apache.directory.studio.connection.ui.dnd.ConnectionTransfer;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
+
+
+/**
+ * This class implements the Paste Action.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class PasteAction extends StudioAction
+{
+    /**
+     * Creates a new instance of PasteAction.
+     */
+    public PasteAction()
+    {
+        super();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getText()
+    {
+        // connection
+        Connection[] connections = getConnectionsToPaste();
+        if ( connections != null )
+        {
+            return connections.length > 1 ? "Paste Connections" : "Paste Connection";
+        }
+
+        return "Paste";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ImageDescriptor getImageDescriptor()
+    {
+        return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor( ISharedImages.IMG_TOOL_PASTE );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getCommandId()
+    {
+        return IWorkbenchActionDefinitionIds.PASTE;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEnabled()
+    {
+        // connection
+        if ( getConnectionsToPaste() != null )
+        {
+            return true;
+        }
+
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        // connection
+        Connection[] connections = getConnectionsToPaste();
+        if ( connections != null )
+        {
+            for ( int i = 0; i < connections.length; i++ )
+            {
+                Connection newConnection = ( Connection ) connections[i].clone();
+                ConnectionCorePlugin.getDefault().getConnectionManager().addConnection( newConnection );
+            }
+            return;
+        }
+    }
+
+
+    /**
+     * Conditions: - a connection is selected - there are connections in
+     * clipboard
+     * 
+     * @return the connections to paste
+     */
+    private Connection[] getConnectionsToPaste()
+    {
+        if ( getSelectedConnections().length > 0 )
+        {
+
+            Object content = this.getFromClipboard( ConnectionTransfer.getInstance() );
+            if ( content != null && content instanceof Connection[] )
+            {
+                Connection[] connections = ( Connection[] ) content;
+                return connections;
+            }
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Retrieve the data of the specified type currently available on the system clipboard.
+     *
+     * @param dataType
+     *      the transfer agent for the type of data being requested
+     * @return
+     *      the data obtained from the clipboard or null if no data of this type is available
+     */
+    protected Object getFromClipboard( Transfer dataType )
+    {
+        Clipboard clipboard = null;
+        try
+        {
+            clipboard = new Clipboard( Display.getCurrent() );
+            return clipboard.getContents( dataType );
+        }
+        finally
+        {
+            if ( clipboard != null )
+                clipboard.dispose();
+        }
+    }
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/PropertiesAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/PropertiesAction.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/PropertiesAction.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/PropertiesAction.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,114 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.connection.ui.actions;
+
+
+import org.apache.directory.studio.connection.core.Utils;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
+
+
+/**
+ * This Action opens the Property Dialog for a given object.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class PropertiesAction extends StudioAction
+{
+    /**
+     * Creates a new instance of PropertiesAction.
+     */
+    public PropertiesAction()
+    {
+        super();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getText()
+    {
+        return "Properties";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ImageDescriptor getImageDescriptor()
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getCommandId()
+    {
+        return IWorkbenchActionDefinitionIds.PROPERTIES;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEnabled()
+    {
+
+        return getSelectedConnections().length == 1;
+
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        IAdaptable element = null;
+        String pageId = null;
+        String title = null;
+
+        if ( getSelectedConnections().length == 1 )
+        {
+            element = ( IAdaptable ) getSelectedConnections()[0];
+            pageId = "org.apache.directory.studio.connection.ui.properties.ConnectionPropertyPage";
+            title = getSelectedConnections()[0].getName();
+        }
+
+        if ( element != null )
+        {
+            PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn( getShell(), element, pageId, null, null );
+            if ( dialog != null )
+                title = Utils.shorten( title, 30 );
+            dialog.getShell().setText( "Properties for '" + title + "'" );
+            dialog.open();
+
+        }
+    }
+    
+}

Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/RenameAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/RenameAction.java?rev=568990&view=auto
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/RenameAction.java (added)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/RenameAction.java Thu Aug 23 06:47:09 2007
@@ -0,0 +1,168 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.connection.ui.actions;
+
+
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
+
+
+/**
+ * This Action renames Connections, Entries, Searches, or Bookmarks.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class RenameAction extends StudioAction
+{
+    /**
+     * Creates a new instance of RenameAction.
+     *
+     */
+    public RenameAction()
+    {
+        super();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getText()
+    {
+
+        Connection[] connections = getConnections();
+
+        if ( connections.length == 1 )
+        {
+            return "Rename Connection...";
+        }
+        else
+        {
+            return "Rename";
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ImageDescriptor getImageDescriptor()
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getCommandId()
+    {
+        return IWorkbenchActionDefinitionIds.RENAME;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        Connection[] connections = getConnections();
+
+        if ( connections.length == 1 )
+        {
+            renameConnection( connections[0] );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEnabled()
+    {
+        try
+        {
+            Connection[] connections = getConnections();
+            return connections.length == 1;
+        }
+        catch ( Exception e )
+        {
+            return false;
+        }
+    }
+
+
+    /**
+     * Gets the Connections
+     * 
+     * @return
+     *      the Connections
+     */
+    protected Connection[] getConnections()
+    {
+        if ( getSelectedConnections().length == 1 )
+        {
+            return getSelectedConnections();
+        }
+        else
+        {
+            return new Connection[0];
+        }
+    }
+
+
+    /**
+     * Renames a Connection.
+     *
+     * @param connection
+     *      the Connection to rename
+     */
+    protected void renameConnection( final Connection connection )
+    {
+        IInputValidator validator = new IInputValidator()
+        {
+            public String isValid( String newName )
+            {
+                if ( connection.getName().equals( newName ) )
+                    return null;
+                else if ( ConnectionCorePlugin.getDefault().getConnectionManager().getConnection( newName ) != null )
+                    return "A connection with this name already exists.";
+                else
+                    return null;
+            }
+        };
+
+        InputDialog dialog = new InputDialog( getShell(), "Rename Connection", "New name:", connection.getName(),
+            validator );
+
+        dialog.open();
+        String newName = dialog.getValue();
+        if ( newName != null )
+        {
+            connection.setName( newName );
+        }
+    }
+}



Mime
View raw message