You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by fe...@apache.org on 2007/11/05 15:46:37 UTC
svn commit: r592022 [1/4] - in
/directory/sandbox/felixk/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/ma...
Author: felixk
Date: Mon Nov 5 06:46:32 2007
New Revision: 592022
URL: http://svn.apache.org/viewvc?rev=592022&view=rev
Log:
Initial studio maven-build
Added:
directory/sandbox/felixk/studio-connection-ui/ (with props)
directory/sandbox/felixk/studio-connection-ui/META-INF/
directory/sandbox/felixk/studio-connection-ui/META-INF/MANIFEST.MF (with props)
directory/sandbox/felixk/studio-connection-ui/plugin.properties (with props)
directory/sandbox/felixk/studio-connection-ui/plugin.xml (with props)
directory/sandbox/felixk/studio-connection-ui/pom.xml (with props)
directory/sandbox/felixk/studio-connection-ui/src/
directory/sandbox/felixk/studio-connection-ui/src/main/
directory/sandbox/felixk/studio-connection-ui/src/main/java/
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageManager.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageModifyListener.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIConstants.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIPlugin.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ExceptionHandler.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UIAuthHandler.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UiThreadEventRunner.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ActionHandlerManager.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CloseConnectionAction.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ConnectionViewActionProxy.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CopyAction.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/DeleteAction.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/NewConnectionAction.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/NewConnectionFolderAction.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/OpenConnectionAction.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/PasteAction.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/PropertiesAction.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/RenameAction.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/SelectionUtils.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/StudioAction.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/StudioActionProxy.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dialogs/
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dialogs/ConnectionFolderDialog.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dialogs/CredentialsDialog.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dnd/
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dnd/ConnectionTransfer.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dnd/DragConnectionListener.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/dnd/DropConnectionListener.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/properties/
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ConnectionPropertyPage.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/BaseWidgetUtils.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionActionGroup.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionConfiguration.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionContentProvider.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionLabelProvider.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionSorter.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionUniversalListener.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionWidget.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/HistoryUtils.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/NetworkParameterPage.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/RunnableContextJobAdapter.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ViewFormWidget.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizard.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizardPage.java (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/resources/
directory/sandbox/felixk/studio-connection-ui/src/main/resources/connectionParameterPages.exsd
directory/sandbox/felixk/studio-connection-ui/src/main/resources/resources/
directory/sandbox/felixk/studio-connection-ui/src/main/resources/resources/icons/
directory/sandbox/felixk/studio-connection-ui/src/main/resources/resources/icons/connection_add.gif (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/resources/resources/icons/connection_connect.gif (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/resources/resources/icons/connection_connected.gif (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/resources/resources/icons/connection_disconnect.gif (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/resources/resources/icons/connection_disconnected.gif (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/resources/resources/icons/connection_folder.gif (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/resources/resources/icons/connection_wizard.gif (with props)
directory/sandbox/felixk/studio-connection-ui/src/main/resources/resources/icons/pulldown.gif (with props)
Propchange: directory/sandbox/felixk/studio-connection-ui/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Nov 5 06:46:32 2007
@@ -0,0 +1,2 @@
+.settings
+target
Added: directory/sandbox/felixk/studio-connection-ui/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/META-INF/MANIFEST.MF?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/META-INF/MANIFEST.MF (added)
+++ directory/sandbox/felixk/studio-connection-ui/META-INF/MANIFEST.MF Mon Nov 5 06:46:32 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
Propchange: directory/sandbox/felixk/studio-connection-ui/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-connection-ui/plugin.properties
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/plugin.properties?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/plugin.properties (added)
+++ directory/sandbox/felixk/studio-connection-ui/plugin.properties Mon Nov 5 06:46:32 2007
@@ -0,0 +1,19 @@
+# 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.name=Apache Directory Studio Connection UI
+project.version=1.0.0
+project.id=org.apache.directory.studio.connection.ui
Propchange: directory/sandbox/felixk/studio-connection-ui/plugin.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-connection-ui/plugin.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/plugin.xml?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/plugin.xml (added)
+++ directory/sandbox/felixk/studio-connection-ui/plugin.xml Mon Nov 5 06:46:32 2007
@@ -0,0 +1,42 @@
+<?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"
+ dependsOnId="org.apache.directory.studio.connection.ui.widgets.NetworkParameterPage"
+ description="Please enter connection name and network parameters."
+ id="org.apache.directory.studio.connection.ui.widgets.NetworkParameterPage"
+ name="Network Parameter"/>
+ <connectionParameterPage
+ class="org.apache.directory.studio.connection.ui.widgets.AuthenticationParameterPage"
+ dependsOnId="org.apache.directory.studio.connection.ui.widgets.NetworkParameterPage"
+ description="Please select an authentification method and input authentification data."
+ id="org.apache.directory.studio.connection.ui.widgets.AuthenticationParameterPage"
+ name="Authentication"/>
+ </extension>
+</plugin>
Propchange: directory/sandbox/felixk/studio-connection-ui/plugin.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-connection-ui/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/pom.xml?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/pom.xml (added)
+++ directory/sandbox/felixk/studio-connection-ui/pom.xml Mon Nov 5 06:46:32 2007
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+-->
+<!--
+ @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ @version $Id: pom.xml 353 2007-10-28 14:59:35Z felix $
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.directory.studio</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0.2-SNAPSHOT</version>
+ </parent>
+ <artifactId>${groupId}.connection.ui</artifactId>
+ <name>Apache Directory Studio Connection UI</name>
+ <packaging>jar</packaging>
+
+ <description></description>
+
+ <!-- Set path for local repository -->
+ <properties>
+ <local-repo>${project.basedir}/../local-repository</local-repo>
+ </properties>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>.</directory>
+ <includes>
+ <include>plugin.properties</include>
+ <include>plugin.xml</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ <addMavenDescriptor>false</addMavenDescriptor>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>${swt.platformrelated.artifactId}</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.ui.workbench</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.core.commands</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.equinox.registry</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.ui.workbench.texteditor</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.jface</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>org.eclipse.ui.editors</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.directory.studio</groupId>
+ <artifactId>${pom.groupId}.connection.core</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Propchange: directory/sandbox/felixk/studio-connection-ui/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java (added)
+++ directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java Mon Nov 5 06:46:32 2007
@@ -0,0 +1,207 @@
+/*
+ * 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 id. */
+ protected String pageId;
+
+ /** The page name. */
+ protected String pageName;
+
+ /** The page description. */
+ protected String pageDescription;
+
+ /** The page id this page depends on. */
+ protected String pageDependsOnId;
+
+ /** The runnable context. */
+ protected IRunnableContext runnableContext;
+
+ /** The connection parameter page modify listener. */
+ protected ConnectionParameterPageModifyListener connectionParameterPageModifyListener;
+
+ /** The message. */
+ protected String message;
+
+ /** The error message. */
+ protected String errorMessage;
+
+ protected String infoMessage;
+
+ /** 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#getPageId()
+ */
+ public String getPageId()
+ {
+ return pageId;
+ }
+
+
+ /**
+ * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#setPageId(java.lang.String)
+ */
+ public void setPageId( String pageId )
+ {
+ this.pageId = pageId;
+ }
+
+
+ /**
+ * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#getPageName()
+ */
+ public String getPageName()
+ {
+ 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#getPageDependsOnId()
+ */
+ public String getPageDependsOnId()
+ {
+ return pageDependsOnId;
+ }
+
+
+ /**
+ * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#setPageDependsOnId(java.lang.String)
+ */
+ public void setPageDependsOnId( String pageDependsOnId )
+ {
+ this.pageDependsOnId = pageDependsOnId;
+ }
+
+
+ /**
+ * @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;
+ }
+
+
+ public String getInfoMessage() {
+ return infoMessage;
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java (added)
+++ directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java Mon Nov 5 06:46:32 2007
@@ -0,0 +1,202 @@
+/*
+ * 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();
+
+
+ public String getInfoMessage();
+
+ /**
+ * 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 id.
+ *
+ * @param pageId the page id
+ */
+ public void setPageId( String pageId );
+
+
+ /**
+ * Gets the page id.
+ *
+ * @return the page id
+ */
+ public String getPageId();
+
+
+ /**
+ * Sets the page name.
+ *
+ * @param pageName the page name
+ */
+ public void setPageName( String pageName );
+
+
+ /**
+ * Gets the page name.
+ *
+ * @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 page id this page depends on.
+ *
+ * @param pageDependsOnId the page id this page depends on
+ */
+ public void setPageDependsOnId( String pageDependsOnId );
+
+
+ /**
+ * Gets the page id this page depends on.
+ *
+ * @return the page id this page depends on
+ */
+ public String getPageDependsOnId();
+
+
+ /**
+ * Sets the focus.
+ */
+ public void setFocus();
+
+
+ /**
+ * The implementing class must return true if important
+ * connection parameters were modified that require a
+ * reconnection to take effect.
+ *
+ * @return true if a reconnection if required
+ */
+ public boolean isReconnectionRequired();
+
+
+ /**
+ * The implementing class must return true if any
+ * parameter was modified.
+ *
+ * @return true, if parameters were modifed
+ */
+ public boolean areParametersModifed();
+
+}
Propchange: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageManager.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageManager.java?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageManager.java (added)
+++ directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageManager.java Mon Nov 5 06:46:32 2007
@@ -0,0 +1,161 @@
+/*
+ * 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.Arrays;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+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();
+ final Map<String, ConnectionParameterPage> pageMap = new HashMap<String, ConnectionParameterPage>();
+
+ // For each extension: instantiate the page
+ for ( int m = 0; m < members.length; m++ )
+ {
+ IConfigurationElement member = members[m];
+ try
+ {
+ ConnectionParameterPage page = ( ConnectionParameterPage ) member.createExecutableExtension( "class" );
+ page.setPageId( member.getAttribute( "id" ) );
+ page.setPageName( member.getAttribute( "name" ) );
+ page.setPageDescription( member.getAttribute( "description" ) );
+ page.setPageDependsOnId( member.getAttribute( "dependsOnId" ) );
+ pageMap.put( page.getPageId(), 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 ) );
+ }
+ }
+
+ final ConnectionParameterPage[] pages = pageMap.values().toArray( new ConnectionParameterPage[0] );
+ Comparator<? super ConnectionParameterPage> pageComparator = new Comparator<ConnectionParameterPage>()
+ {
+ public int compare( ConnectionParameterPage p1, ConnectionParameterPage p2 )
+ {
+ String dependsOnId1 = p1.getPageDependsOnId();
+ String dependsOnId2 = p2.getPageDependsOnId();
+ do
+ {
+ if(dependsOnId1 == null && dependsOnId2 != null )
+ {
+ return -1;
+ }
+ else if(dependsOnId2 == null && dependsOnId1 != null )
+ {
+ return 1;
+ }
+ else if(dependsOnId1 != null && dependsOnId1.equals( p2.getPageId() ))
+ {
+ return 1;
+ }
+ else if(dependsOnId2 != null && dependsOnId2.equals( p1.getPageId() ))
+ {
+ return -1;
+ }
+
+ ConnectionParameterPage page = pageMap.get( dependsOnId1 );
+ if(page != null)
+ {
+ dependsOnId1 = page.getPageDependsOnId();
+ }
+ else
+ {
+ dependsOnId1 = null;
+ }
+ }
+ while(dependsOnId1 != null && !dependsOnId1.equals( p1.getPageId() ));
+
+ dependsOnId1 = p1.getPageDependsOnId();
+ dependsOnId2 = p2.getPageDependsOnId();
+ do
+ {
+ if(dependsOnId1 == null && dependsOnId2 != null )
+ {
+ return -1;
+ }
+ else if(dependsOnId2 == null && dependsOnId1 != null )
+ {
+ return 1;
+ }
+ else if(dependsOnId1 != null && dependsOnId1.equals( p2.getPageId() ))
+ {
+ return 1;
+ }
+ else if(dependsOnId2 != null && dependsOnId2.equals( p1.getPageId() ))
+ {
+ return -1;
+ }
+
+ ConnectionParameterPage page = pageMap.get( dependsOnId2 );
+ if(page != null)
+ {
+ dependsOnId2 = page.getPageDependsOnId();
+ }
+ else
+ {
+ dependsOnId2 = null;
+ }
+ }
+ while(dependsOnId2 != null && !dependsOnId2.equals( p2.getPageId() ));
+
+ return 0;
+ }
+ };
+ Arrays.sort( pages, pageComparator );
+
+ return pages;
+ }
+}
Propchange: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageModifyListener.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageModifyListener.java?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageModifyListener.java (added)
+++ directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageModifyListener.java Mon Nov 5 06:46:32 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();
+}
Propchange: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPageModifyListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIConstants.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIConstants.java?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIConstants.java (added)
+++ directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIConstants.java Mon Nov 5 06:46:32 2007
@@ -0,0 +1,53 @@
+/*
+ * 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 DIALOGSETTING_KEY_REALM_HISTORY = "saslrealmHistory";
+
+
+ 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";
+
+ public static final String IMG_CONNECTION_FOLDER = "resources/icons/connection_folder.gif";
+
+ public static final String IMG_CONNECTION_FOLDER_ADD = "resources/icons/connection_folder.gif";
+
+}
Propchange: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIPlugin.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIPlugin.java?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIPlugin.java (added)
+++ directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIPlugin.java Mon Nov 5 06:46:32 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 instance. */
+ 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;
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIPlugin.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ExceptionHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ExceptionHandler.java?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ExceptionHandler.java (added)
+++ directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ExceptionHandler.java Mon Nov 5 06:46:32 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 );
+ }
+}
Propchange: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ExceptionHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UIAuthHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UIAuthHandler.java?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UIAuthHandler.java (added)
+++ directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UIAuthHandler.java Mon Nov 5 06:46:32 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 );
+ }
+ }
+
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UIAuthHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UiThreadEventRunner.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UiThreadEventRunner.java?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UiThreadEventRunner.java (added)
+++ directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UiThreadEventRunner.java Mon Nov 5 06:46:32 2007
@@ -0,0 +1,48 @@
+/*
+ * 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.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 );
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/UiThreadEventRunner.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ActionHandlerManager.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ActionHandlerManager.java?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ActionHandlerManager.java (added)
+++ directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ActionHandlerManager.java Mon Nov 5 06:46:32 2007
@@ -0,0 +1,42 @@
+/*
+ * 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;
+
+/**
+ * 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();
+
+}
Propchange: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ActionHandlerManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CloseConnectionAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CloseConnectionAction.java?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CloseConnectionAction.java (added)
+++ directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CloseConnectionAction.java Mon Nov 5 06:46:32 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;
+ }
+}
Propchange: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CloseConnectionAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ConnectionViewActionProxy.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ConnectionViewActionProxy.java?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ConnectionViewActionProxy.java (added)
+++ directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ConnectionViewActionProxy.java Mon Nov 5 06:46:32 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 );
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/ConnectionViewActionProxy.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CopyAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CopyAction.java?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CopyAction.java (added)
+++ directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CopyAction.java Mon Nov 5 06:46:32 2007
@@ -0,0 +1,164 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.ConnectionFolder;
+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[] connections = getSelectedConnections();
+ ConnectionFolder[] connectionFolders = getSelectedConnectionFolders();
+ if ( connections.length > 0 && connectionFolders.length == 0 )
+ {
+ return connections.length > 1 ? "Copy Connections" : "Copy Connection";
+ }
+ else if ( connectionFolders.length > 0 && connections.length == 0 )
+ {
+ return connectionFolders.length > 1 ? "Copy Connection Folders" : "Copy Connection Folder";
+ }
+ else
+ {
+ 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 = getSelectedConnections();
+ ConnectionFolder[] connectionFolders = getSelectedConnectionFolders();
+ List<Object> objects = new ArrayList<Object>();
+ objects.addAll( Arrays.asList( connections ) );
+ objects.addAll( Arrays.asList( connectionFolders ) );
+
+ // connection
+ if ( objects != null )
+ {
+ copyToClipboard( new Object[]
+ { objects.toArray() }, 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()
+ {
+ return getSelectedConnections().length + getSelectedConnectionFolders().length > 0;
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/CopyAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/DeleteAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/DeleteAction.java?rev=592022&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/DeleteAction.java (added)
+++ directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/DeleteAction.java Mon Nov 5 06:46:32 2007
@@ -0,0 +1,260 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+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.apache.directory.studio.connection.core.ConnectionFolder;
+import org.apache.directory.studio.connection.core.jobs.CloseConnectionsJob;
+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()
+ {
+ Connection[] connections = getSelectedConnections();
+ ConnectionFolder[] connectionFolders = getSelectedConnectionFolders();
+ if ( connections.length > 0 && connectionFolders.length == 0 )
+ {
+ return connections.length > 1 ? "Delete Connections" : "Delete Connection";
+ }
+ else if ( connectionFolders.length > 0 && connections.length == 0 )
+ {
+ return connectionFolders.length > 1 ? "Delete Connection Folders" : "Delete Connection Folder";
+ }
+ else
+ {
+ 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()
+ {
+ Connection[] connections = getSelectedConnections();
+ ConnectionFolder[] connectionFolders = getSelectedConnectionFolders();
+
+ 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 ( connectionFolders.length > 0 )
+ {
+ if ( connectionFolders.length <= 5 )
+ {
+ message.append( connectionFolders.length == 1 ? "Are your sure to delete the following connection folder including all connections?"
+ : "Are your sure to delete the following connection folders including all connections?" );
+ for ( int i = 0; i < connectionFolders.length; i++ )
+ {
+ message.append( ConnectionCoreConstants.LINE_SEPARATOR );
+ message.append( " - " );
+ message.append( connectionFolders[i].getName() );
+ }
+ }
+ else
+ {
+ message.append( "Are your sure to delete the selected connection folders including all connections?" );
+ }
+ message.append( ConnectionCoreConstants.LINE_SEPARATOR );
+ message.append( ConnectionCoreConstants.LINE_SEPARATOR );
+ }
+
+ if ( message.length() == 0 || MessageDialog.openConfirm( getShell(), getText(), message.toString() ) )
+ {
+ List<Connection> connectionsToDelete = getConnectionsToDelete();
+ List<ConnectionFolder> connectionsFoldersToDelete = getConnectionsFoldersToDelete();
+
+ if ( connections.length > 0 )
+ {
+ deleteConnections( connectionsToDelete );
+ }
+ if ( connectionFolders.length > 0 )
+ {
+ deleteConnectionFolders( connectionsFoldersToDelete );
+ }
+ }
+ }
+
+
+ private List<ConnectionFolder> getConnectionsFoldersToDelete()
+ {
+ List<ConnectionFolder> selectedFolders = new ArrayList<ConnectionFolder>(Arrays.asList( getSelectedConnectionFolders() ));
+ List<ConnectionFolder> foldersToDelete = new ArrayList<ConnectionFolder>();
+ while( !selectedFolders.isEmpty() )
+ {
+ ConnectionFolder folder = selectedFolders.get( 0 );
+
+ List<String> subFolderIds = folder.getSubFolderIds();
+ for ( String subFolderId : subFolderIds )
+ {
+ ConnectionFolder subFolder = ConnectionCorePlugin.getDefault().getConnectionFolderManager().getConnectionFolderById( subFolderId );
+ if ( subFolder != null )
+ {
+ selectedFolders.add( subFolder );
+ }
+ }
+
+ if( !foldersToDelete.contains( folder ) )
+ {
+ foldersToDelete.add( folder );
+ }
+
+ selectedFolders.remove( folder );
+ }
+ return foldersToDelete;
+ }
+
+
+ private List<Connection> getConnectionsToDelete()
+ {
+ List<ConnectionFolder> selectedFolders = new ArrayList<ConnectionFolder>(Arrays.asList( getSelectedConnectionFolders() ));
+ List<Connection> selectedConnections = new ArrayList<Connection>(Arrays.asList( getSelectedConnections() ));
+ List<Connection> connectionsToDelete = new ArrayList<Connection>( selectedConnections );
+ while( !selectedFolders.isEmpty() )
+ {
+ ConnectionFolder folder = selectedFolders.get( 0 );
+
+ List<String> subFolderIds = folder.getSubFolderIds();
+ for ( String subFolderId : subFolderIds )
+ {
+ ConnectionFolder subFolder = ConnectionCorePlugin.getDefault().getConnectionFolderManager().getConnectionFolderById( subFolderId );
+ if ( subFolder != null )
+ {
+ selectedFolders.add( subFolder );
+ }
+ }
+
+ List<String> connectionIds = folder.getConnectionIds();
+ for ( String connectionId : connectionIds )
+ {
+ Connection connection = ConnectionCorePlugin.getDefault().getConnectionManager().getConnectionById( connectionId );
+ if(connection != null && !connectionsToDelete.contains( connection ))
+ {
+ connectionsToDelete.add( connection );
+ }
+ }
+
+ selectedFolders.remove( folder );
+ }
+ return connectionsToDelete;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isEnabled()
+ {
+ return getSelectedConnections().length + getSelectedConnectionFolders().length > 0;
+ }
+
+
+ /**
+ * Deletes Connections
+ *
+ * @param connectionsToDelete
+ * the Connections to delete
+ */
+ private void deleteConnections( List<Connection> connectionsToDelete )
+ {
+ new CloseConnectionsJob( connectionsToDelete.toArray( new Connection[connectionsToDelete.size()] ) ).execute();
+ for ( Connection connection : connectionsToDelete )
+ {
+ ConnectionCorePlugin.getDefault().getConnectionManager().removeConnection( connection);
+ }
+ }
+
+
+ /**
+ * Deletes Connection Folders
+ *
+ * @param connectionsFoldersToDelete
+ * the Connection Folders to delete
+ */
+ private void deleteConnectionFolders( List<ConnectionFolder> connectionsFoldersToDelete )
+ {
+ for ( ConnectionFolder connectionFolder : connectionsFoldersToDelete )
+ {
+ ConnectionCorePlugin.getDefault().getConnectionFolderManager().removeConnectionFolder( connectionFolder );
+ }
+ }
+
+}
Propchange: directory/sandbox/felixk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/actions/DeleteAction.java
------------------------------------------------------------------------------
svn:eol-style = native