directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r995368 [1/6] - in /directory/studio/trunk/plugins/apacheds.configuration/src/main: java/org/apache/directory/studio/apacheds/configuration/ java/org/apache/directory/studio/apacheds/configuration/editor/ java/org/apache/directory/studio/ap...
Date Thu, 09 Sep 2010 10:11:44 GMT
Author: pamarcelot
Date: Thu Sep  9 10:11:43 2010
New Revision: 995368

URL: http://svn.apache.org/viewvc?rev=995368&view=rev
Log:
Fix for DIRSTUDIO-697 (Add support for ApacheDS 1.5.7 'server.xml' configuration file).

Added:
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/AuthenticationPage.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/ExtendedOperationDetailsPage.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/ExtendedOperationsMasterDetailsBlock.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/ExtendedOperationsPage.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/GeneralPage.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/InterceptorDetailsPage.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/InterceptorsMasterDetailsBlock.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/InterceptorsPage.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/Messages.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/PartitionDetailsPage.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/PartitionsMasterDetailsBlock.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/PartitionsPage.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/dialogs/
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/dialogs/AttributeValueDialog.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/dialogs/AttributeValueObject.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/dialogs/ExtendedOperationDialog.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/dialogs/IndexedAttributeDialog.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/dialogs/InterceptorDialog.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/dialogs/Messages.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/dialogs/NtlmProviderDialog.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/dialogs/SaslRealmDialog.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/dialogs/messages.properties
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/dialogs/messages_de.properties
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/dialogs/messages_fr.properties
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/messages.properties
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/messages_de.properties
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/messages_fr.properties
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v157/
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v157/ExtendedOperationEnum.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v157/IndexedAttribute.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v157/InterceptorConfiguration.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v157/InterceptorEnum.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v157/Messages.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v157/Partition.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v157/ReplicationInterceptorConfiguration.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v157/SaslQualityOfProtectionEnum.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v157/ServerConfigurationV157.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v157/ServerXmlIOV157.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v157/SupportedMechanismEnum.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v157/messages.properties
    directory/studio/trunk/plugins/apacheds.configuration/src/main/resources/org/apache/directory/studio/apacheds/configuration/default-server-1.5.7.xml
Modified:
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/ApacheDSConfigurationPlugin.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/NonExistingServerConfigurationInput.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/messages.properties
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/messages_de.properties
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/messages_fr.properties
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v155/dialogs/Messages.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v156/dialogs/Messages.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/ServerConfigurationVersionEnum.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/wizards/NewApacheDSConfigurationFileWizard.java
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/wizards/NewApacheDSConfigurationFileWizardPage.java

Modified: directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/ApacheDSConfigurationPlugin.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/ApacheDSConfigurationPlugin.java?rev=995368&r1=995367&r2=995368&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/ApacheDSConfigurationPlugin.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/ApacheDSConfigurationPlugin.java Thu Sep  9 10:11:43 2010
@@ -46,6 +46,7 @@ import org.apache.directory.studio.apach
 import org.apache.directory.studio.apacheds.configuration.model.v154.ServerXmlIOV154;
 import org.apache.directory.studio.apacheds.configuration.model.v155.ServerXmlIOV155;
 import org.apache.directory.studio.apacheds.configuration.model.v156.ServerXmlIOV156;
+import org.apache.directory.studio.apacheds.configuration.model.v157.ServerXmlIOV157;
 
 
 /**
@@ -62,7 +63,7 @@ public class ApacheDSConfigurationPlugin
     private PropertyResourceBundle properties;
 
     private ServerXmlIO[] serverXmlIOs = new ServerXmlIO[]
-        { new ServerXmlIOV156(), new ServerXmlIOV155(), new ServerXmlIOV154(), new ServerXmlIOV153(),
+        {  new ServerXmlIOV157(), new ServerXmlIOV156(), new ServerXmlIOV155(), new ServerXmlIOV154(), new ServerXmlIOV153(),
             new ServerXmlIOV152(), new ServerXmlIOV151(), new ServerXmlIOV150(), };
 
 

Modified: directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/NonExistingServerConfigurationInput.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/NonExistingServerConfigurationInput.java?rev=995368&r1=995367&r2=995368&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/NonExistingServerConfigurationInput.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/NonExistingServerConfigurationInput.java Thu Sep  9 10:11:43 2010
@@ -89,6 +89,8 @@ public class NonExistingServerConfigurat
     {
         switch ( serverConfiguration.getVersion() )
         {
+            case VERSION_1_5_7:
+                return Messages.getString( "NonExistingServerConfigurationInput.NewApacheDS157Configuration" );
             case VERSION_1_5_6:
                 return Messages.getString( "NonExistingServerConfigurationInput.NewApacheDS156Configuration" ); //$NON-NLS-1$
             case VERSION_1_5_5:

Modified: directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java?rev=995368&r1=995367&r2=995368&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java Thu Sep  9 10:11:43 2010
@@ -43,6 +43,7 @@ import org.apache.directory.studio.apach
 import org.apache.directory.studio.apacheds.configuration.model.v154.ServerXmlIOV154;
 import org.apache.directory.studio.apacheds.configuration.model.v155.ServerXmlIOV155;
 import org.apache.directory.studio.apacheds.configuration.model.v156.ServerXmlIOV156;
+import org.apache.directory.studio.apacheds.configuration.model.v157.ServerXmlIOV157;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
@@ -145,6 +146,9 @@ public class ServerConfigurationEditor e
             // Setting the ServerXmlIO class
             switch ( serverConfiguration.getVersion() )
             {
+                case VERSION_1_5_7:
+                    serverXmlIO = new ServerXmlIOV157();
+                    break;
                 case VERSION_1_5_6:
                     serverXmlIO = new ServerXmlIOV156();
                     break;
@@ -239,6 +243,27 @@ public class ServerConfigurationEditor e
             {
                 switch ( serverConfiguration.getVersion() )
                 {
+                    case VERSION_1_5_7:
+                        generalPage = new org.apache.directory.studio.apacheds.configuration.editor.v157.GeneralPage(
+                            this );
+                        addPage( generalPage );
+
+                        authenticationPage = new org.apache.directory.studio.apacheds.configuration.editor.v157.AuthenticationPage(
+                            this );
+                        addPage( authenticationPage );
+
+                        partitionsPage = new org.apache.directory.studio.apacheds.configuration.editor.v157.PartitionsPage(
+                            this );
+                        addPage( partitionsPage );
+
+                        interceptorsPage = new org.apache.directory.studio.apacheds.configuration.editor.v157.InterceptorsPage(
+                            this );
+                        addPage( interceptorsPage );
+
+                        extendedOperationsPage = new org.apache.directory.studio.apacheds.configuration.editor.v157.ExtendedOperationsPage(
+                            this );
+                        addPage( extendedOperationsPage );
+                        break;
                     case VERSION_1_5_6:
                         generalPage = new org.apache.directory.studio.apacheds.configuration.editor.v156.GeneralPage(
                             this );
@@ -470,6 +495,13 @@ public class ServerConfigurationEditor e
         {
             switch ( serverConfiguration.getVersion() )
             {
+                case VERSION_1_5_7:
+                    generalPage.save();
+                    authenticationPage.save();
+                    partitionsPage.save();
+                    interceptorsPage.save();
+                    extendedOperationsPage.save();
+                    break;
                 case VERSION_1_5_6:
                     generalPage.save();
                     authenticationPage.save();

Modified: directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/messages.properties?rev=995368&r1=995367&r2=995368&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/messages.properties (original)
+++ directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/messages.properties Thu Sep  9 10:11:43 2010
@@ -25,6 +25,7 @@ NonExistingServerConfigurationInput.NewA
 NonExistingServerConfigurationInput.NewApacheDS154Configuration=New Apache DS 1.5.4 Configuration File
 NonExistingServerConfigurationInput.NewApacheDS155Configuration=New Apache DS 1.5.5 Configuration File
 NonExistingServerConfigurationInput.NewApacheDS156Configuration=New Apache DS 1.5.6 Configuration File
+NonExistingServerConfigurationInput.NewApacheDS156Configuration=New Apache DS 1.5.7 Configuration File
 NonExistingServerConfigurationInput.NewApacheDSConfiguration=New Apache DS Configuration File
 ServerConfigurationEditor.AnErrorOccurredWhenWritingTheFileToDisk=An error occurred when writing the file to disk.
 ServerConfigurationEditor.Error=Error\!

Modified: directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/messages_de.properties?rev=995368&r1=995367&r2=995368&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/messages_de.properties (original)
+++ directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/messages_de.properties Thu Sep  9 10:11:43 2010
@@ -25,6 +25,7 @@ NonExistingServerConfigurationInput.NewA
 NonExistingServerConfigurationInput.NewApacheDS154Configuration=Neue Konfigurationsdatei f\u00FCr Apache DS 1.5.4
 NonExistingServerConfigurationInput.NewApacheDS155Configuration=Neue Konfigurationsdatei f\u00FCr Apache DS 1.5.5
 NonExistingServerConfigurationInput.NewApacheDS156Configuration=Neue Konfigurationsdatei f\u00FCr Apache DS 1.5.6
+NonExistingServerConfigurationInput.NewApacheDS157Configuration=Neue Konfigurationsdatei f\u00FCr Apache DS 1.5.7
 NonExistingServerConfigurationInput.NewApacheDSConfiguration=Neue Konfigurationsdatei f\u00FCr Apache DS
 ServerConfigurationEditor.AnErrorOccurredWhenWritingTheFileToDisk=Ein Fehler ist beim Schreiben aufgetreten.
 ServerConfigurationEditor.Error=Fehler\!

Modified: directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/messages_fr.properties?rev=995368&r1=995367&r2=995368&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/messages_fr.properties (original)
+++ directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/messages_fr.properties Thu Sep  9 10:11:43 2010
@@ -25,6 +25,7 @@ NonExistingServerConfigurationInput.NewA
 NonExistingServerConfigurationInput.NewApacheDS154Configuration=Nouveau fichier de configuration ApacheDS 1.5.4
 NonExistingServerConfigurationInput.NewApacheDS155Configuration=Nouveau fichier de configuration ApacheDS 1.5.5
 NonExistingServerConfigurationInput.NewApacheDS156Configuration=Nouveau fichier de configuration ApacheDS 1.5.6
+NonExistingServerConfigurationInput.NewApacheDS157Configuration=Nouveau fichier de configuration ApacheDS 1.5.7
 NonExistingServerConfigurationInput.NewApacheDSConfiguration=Nouveau fichier de configuration ApacheDS
 ServerConfigurationEditor.AnErrorOccurredWhenWritingTheFileToDisk=Une erreur est survenue lors de l'\u00E9criture du fichier sur le disque.
 ServerConfigurationEditor.Error=Erreur \!

Modified: directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v155/dialogs/Messages.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v155/dialogs/Messages.java?rev=995368&r1=995367&r2=995368&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v155/dialogs/Messages.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v155/dialogs/Messages.java Thu Sep  9 10:11:43 2010
@@ -26,7 +26,7 @@ import java.util.ResourceBundle;
 
 public class Messages
 {
-    private static final String BUNDLE_NAME = "org.apache.directory.studio.apacheds.configuration.editor.v154.dialogs.messages"; //$NON-NLS-1$
+    private static final String BUNDLE_NAME = "org.apache.directory.studio.apacheds.configuration.editor.v155.dialogs.messages"; //$NON-NLS-1$
 
     private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
 

Modified: directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v156/dialogs/Messages.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v156/dialogs/Messages.java?rev=995368&r1=995367&r2=995368&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v156/dialogs/Messages.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v156/dialogs/Messages.java Thu Sep  9 10:11:43 2010
@@ -26,7 +26,7 @@ import java.util.ResourceBundle;
 
 public class Messages
 {
-    private static final String BUNDLE_NAME = "org.apache.directory.studio.apacheds.configuration.editor.v154.dialogs.messages"; //$NON-NLS-1$
+    private static final String BUNDLE_NAME = "org.apache.directory.studio.apacheds.configuration.editor.v156.dialogs.messages"; //$NON-NLS-1$
 
     private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
 

Added: directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/AuthenticationPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/AuthenticationPage.java?rev=995368&view=auto
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/AuthenticationPage.java (added)
+++ directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/AuthenticationPage.java Thu Sep  9 10:11:43 2010
@@ -0,0 +1,544 @@
+/*
+ *  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.apacheds.configuration.editor.v157;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.studio.apacheds.configuration.ApacheDSConfigurationPluginConstants;
+import org.apache.directory.studio.apacheds.configuration.editor.SaveableFormPage;
+import org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditor;
+import org.apache.directory.studio.apacheds.configuration.editor.v157.dialogs.NtlmProviderDialog;
+import org.apache.directory.studio.apacheds.configuration.editor.v157.dialogs.SaslRealmDialog;
+import org.apache.directory.studio.apacheds.configuration.model.v157.ServerConfigurationV157;
+import org.apache.directory.studio.apacheds.configuration.model.v157.SupportedMechanismEnum;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+
+/**
+ * This class represents the Authentication Page of the Server Configuration Editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AuthenticationPage extends FormPage implements SaveableFormPage
+{
+    /** The Page ID */
+    public static final String ID = ServerConfigurationEditor.ID + ".V157.AuthenticationPage"; //$NON-NLS-1$
+
+    /** The Page Title */
+    private static final String TITLE = Messages.getString( "AuthenticationPage.Authentication" ); //$NON-NLS-1$
+
+    private List<String> saslRealms;
+
+    // UI Fields
+    private CheckboxTableViewer supportedMechanismsTableViewer;
+    private Button selectAllSupportedMechanismsButton;
+    private Button deselectAllSupportedMechanismsButton;
+    private Button editSupportedMechanismButton;
+    private Text saslHostText;
+    private Text saslPrincipalText;
+    private Text searchBaseDnText;
+    private CheckboxTableViewer saslRealmsTableViewer;
+    private Button addSaslRealmButton;
+    private Button editSaslRealmsButton;
+    private Button deleteSaslRealmButton;
+
+
+    /**
+     * Creates a new instance of AuthenticationPage.
+     *
+     * @param editor
+     *      the associated editor
+     */
+    public AuthenticationPage( FormEditor editor )
+    {
+        super( editor, ID, TITLE );
+        saslRealms = new ArrayList<String>();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
+     */
+    protected void createFormContent( IManagedForm managedForm )
+    {
+        PlatformUI.getWorkbench().getHelpSystem().setHelp( getPartControl(),
+            ApacheDSConfigurationPluginConstants.PLUGIN_ID + "." + "configuration_editor_157" ); //$NON-NLS-1$ //$NON-NLS-2$
+
+        ScrolledForm form = managedForm.getForm();
+        form.setText( Messages.getString( "AuthenticationPage.Authentication" ) ); //$NON-NLS-1$
+
+        Composite parent = form.getBody();
+        parent.setLayout( new TableWrapLayout() );
+        FormToolkit toolkit = managedForm.getToolkit();
+
+        Composite composite = toolkit.createComposite( parent );
+        composite.setLayout( new GridLayout() );
+        TableWrapData compositeTableWrapData = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
+        compositeTableWrapData.grabHorizontal = true;
+        composite.setLayoutData( compositeTableWrapData );
+
+        createSupportedAuthenticationMechanismsSection( composite, toolkit );
+        createSaslSettingsSection( composite, toolkit );
+        createSaslRealmsSection( composite, toolkit );
+
+        initFromInput();
+        addListeners();
+    }
+
+
+    /**
+     * Creates the Supported Authentication Mechanisms Section
+     *
+     * @param parent
+     *      the parent composite
+     * @param toolkit
+     *      the toolkit to use
+     */
+    private void createSupportedAuthenticationMechanismsSection( Composite parent, FormToolkit toolkit )
+    {
+        // Creation of the section
+        Section section = toolkit.createSection( parent, Section.TITLE_BAR );
+        section.setText( Messages.getString( "AuthenticationPage.SupportedAuthenticationMechanisms" ) ); //$NON-NLS-1$
+        section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        Composite client = toolkit.createComposite( section );
+        toolkit.paintBordersFor( client );
+        GridLayout glayout = new GridLayout( 2, false );
+        client.setLayout( glayout );
+        section.setClient( client );
+
+        // Supported Authentication Mechanisms Table
+        Table supportedMechanismsTable = toolkit.createTable( client, SWT.CHECK );
+        GridData gd = new GridData( SWT.FILL, SWT.NONE, true, false, 1, 3 );
+        gd.heightHint = 110;
+        supportedMechanismsTable.setLayoutData( gd );
+        supportedMechanismsTableViewer = new CheckboxTableViewer( supportedMechanismsTable );
+        supportedMechanismsTableViewer.setContentProvider( new ArrayContentProvider() );
+        supportedMechanismsTableViewer.setInput( new SupportedMechanismEnum[]
+            { SupportedMechanismEnum.SIMPLE, SupportedMechanismEnum.CRAM_MD5, SupportedMechanismEnum.DIGEST_MD5,
+                SupportedMechanismEnum.GSSAPI, SupportedMechanismEnum.NTLM, SupportedMechanismEnum.GSS_SPNEGO } );
+
+        // Edit Button
+        editSupportedMechanismButton = toolkit.createButton( client,
+            Messages.getString( "AuthenticationPage.Edit" ), SWT.PUSH ); //$NON-NLS-1$
+        editSupportedMechanismButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+        editSupportedMechanismButton.setEnabled( false );
+
+        // Select All Button
+        selectAllSupportedMechanismsButton = toolkit.createButton( client, Messages
+            .getString( "AuthenticationPage.SelectAll" ), SWT.PUSH ); //$NON-NLS-1$
+        selectAllSupportedMechanismsButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+
+        // Deselect All Button
+        deselectAllSupportedMechanismsButton = toolkit.createButton( client, Messages
+            .getString( "AuthenticationPage.DeselectAll" ), SWT.PUSH ); //$NON-NLS-1$
+        deselectAllSupportedMechanismsButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+    }
+
+
+    /**
+     * Creates the SASL Settings Section
+     *
+     * @param parent
+     *      the parent composite
+     * @param toolkit
+     *      the toolkit to use
+     */
+    private void createSaslSettingsSection( Composite parent, FormToolkit toolkit )
+    {
+        // Creation of the section
+        Section section = toolkit.createSection( parent, Section.TITLE_BAR );
+        section.setText( Messages.getString( "AuthenticationPage.SaslSettings" ) ); //$NON-NLS-1$
+        section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        Composite client = toolkit.createComposite( section );
+        toolkit.paintBordersFor( client );
+        GridLayout glayout = new GridLayout( 2, false );
+        client.setLayout( glayout );
+        section.setClient( client );
+
+        // SASL Host
+        toolkit.createLabel( client, Messages.getString( "AuthenticationPage.SaslHost" ) ); //$NON-NLS-1$
+        saslHostText = toolkit.createText( client, "" ); //$NON-NLS-1$
+        saslHostText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // SASL Principal
+        toolkit.createLabel( client, Messages.getString( "AuthenticationPage.SaslPrincipal" ) ); //$NON-NLS-1$
+        saslPrincipalText = toolkit.createText( client, "" ); //$NON-NLS-1$
+        saslPrincipalText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Search Base DN
+        toolkit.createLabel( client, Messages.getString( "AuthenticationPage.SearchBaseDN" ) ); //$NON-NLS-1$
+        searchBaseDnText = toolkit.createText( client, "" ); //$NON-NLS-1$
+        searchBaseDnText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+    }
+
+
+    /**
+     * Creates the SASL Realms Section
+     *
+     * @param parent
+     *      the parent composite
+     * @param toolkit
+     *      the toolkit to use
+     */
+    private void createSaslRealmsSection( Composite parent, FormToolkit toolkit )
+    {
+        // Creation of the section
+        Section section = toolkit.createSection( parent, Section.TITLE_BAR );
+        section.setText( Messages.getString( "AuthenticationPage.SaslRealms" ) ); //$NON-NLS-1$
+        section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+        Composite client = toolkit.createComposite( section );
+        toolkit.paintBordersFor( client );
+        GridLayout glayout = new GridLayout( 2, false );
+        client.setLayout( glayout );
+        section.setClient( client );
+
+        // SASL Realms Table
+        Table saslRealmsTable = toolkit.createTable( client, SWT.NONE );
+        GridData gd = new GridData( SWT.FILL, SWT.NONE, true, false, 1, 3 );
+        gd.heightHint = 82;
+        saslRealmsTable.setLayoutData( gd );
+        saslRealmsTableViewer = new CheckboxTableViewer( saslRealmsTable );
+        saslRealmsTableViewer.setContentProvider( new ArrayContentProvider() );
+
+        // Add Button
+        addSaslRealmButton = toolkit.createButton( client, Messages.getString( "AuthenticationPage.Add" ), SWT.PUSH ); //$NON-NLS-1$
+        addSaslRealmButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+
+        // Edit Button
+        editSaslRealmsButton = toolkit.createButton( client, Messages.getString( "AuthenticationPage.Edit" ), SWT.PUSH ); //$NON-NLS-1$
+        editSaslRealmsButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+        editSaslRealmsButton.setEnabled( false );
+
+        // Delete Button
+        deleteSaslRealmButton = toolkit.createButton( client,
+            Messages.getString( "AuthenticationPage.Delete" ), SWT.PUSH ); //$NON-NLS-1$
+        deleteSaslRealmButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+        deleteSaslRealmButton.setEnabled( false );
+    }
+
+
+    /**
+     * Initializes the page with the Editor input.
+     */
+    private void initFromInput()
+    {
+        ServerConfigurationV157 configuration = ( ServerConfigurationV157 ) ( ( ServerConfigurationEditor ) getEditor() )
+            .getServerConfiguration();
+
+        // Supported Authentication Mechanisms
+        supportedMechanismsTableViewer.setCheckedElements( configuration.getSupportedMechanisms().toArray() );
+
+        // SASL Host
+        saslHostText.setText( configuration.getSaslHost() );
+
+        // SASL Principal
+        saslPrincipalText.setText( configuration.getSaslPrincipal() );
+
+        // Search Base DN
+        searchBaseDnText.setText( configuration.getSearchBaseDn() );
+
+        // SASL Realms
+        saslRealms.addAll( configuration.getSaslRealms() );
+        saslRealmsTableViewer.setInput( saslRealms );
+    }
+
+
+    /**
+     * Add listeners to UI fields.
+     */
+    private void addListeners()
+    {
+        //  The Modify Listener
+        ModifyListener modifyListener = new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                setEditorDirty();
+            }
+        };
+
+        // Supported Authentication Mechanisms
+        supportedMechanismsTableViewer.addSelectionChangedListener( new ISelectionChangedListener()
+        {
+            public void selectionChanged( SelectionChangedEvent event )
+            {
+                StructuredSelection selection = ( StructuredSelection ) supportedMechanismsTableViewer.getSelection();
+                if ( !selection.isEmpty() )
+                {
+                    SupportedMechanismEnum selected = ( SupportedMechanismEnum ) selection.getFirstElement();
+                    editSupportedMechanismButton
+                        .setEnabled( ( SupportedMechanismEnum.NTLM.equals( selected ) || SupportedMechanismEnum.GSS_SPNEGO
+                            .equals( selected ) ) );
+                }
+                else
+                {
+                    editSupportedMechanismButton.setEnabled( false );
+                }
+            }
+        } );
+        supportedMechanismsTableViewer.addDoubleClickListener( new IDoubleClickListener()
+        {
+            public void doubleClick( DoubleClickEvent event )
+            {
+                editSelectedSupportedMechanism();
+            }
+        } );
+        editSupportedMechanismButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                editSelectedSupportedMechanism();
+            }
+        } );
+        selectAllSupportedMechanismsButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                supportedMechanismsTableViewer.setAllChecked( true );
+                setEditorDirty();
+            }
+        } );
+        deselectAllSupportedMechanismsButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                supportedMechanismsTableViewer.setAllChecked( false );
+                setEditorDirty();
+            }
+        } );
+        supportedMechanismsTableViewer.addCheckStateListener( new ICheckStateListener()
+        {
+            public void checkStateChanged( CheckStateChangedEvent event )
+            {
+                setEditorDirty();
+            }
+        } );
+
+        // SASL Host
+        saslHostText.addModifyListener( modifyListener );
+
+        // SASL Principal
+        saslPrincipalText.addModifyListener( modifyListener );
+
+        // Search Base DN
+        searchBaseDnText.addModifyListener( modifyListener );
+
+        // SASL Realms
+        saslRealmsTableViewer.addSelectionChangedListener( new ISelectionChangedListener()
+        {
+            public void selectionChanged( SelectionChangedEvent event )
+            {
+                editSaslRealmsButton.setEnabled( !event.getSelection().isEmpty() );
+                deleteSaslRealmButton.setEnabled( !event.getSelection().isEmpty() );
+            }
+        } );
+        saslRealmsTableViewer.addDoubleClickListener( new IDoubleClickListener()
+        {
+            public void doubleClick( DoubleClickEvent event )
+            {
+                editSelectedSaslRealm();
+            }
+        } );
+        addSaslRealmButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                SaslRealmDialog dialog = new SaslRealmDialog( "" ); //$NON-NLS-1$
+                if ( Dialog.OK == dialog.open() && dialog.isDirty() )
+                {
+                    String newSaslRealm = dialog.getSaslRealm();
+                    if ( newSaslRealm != null && !"".equals( newSaslRealm ) && !saslRealms.contains( newSaslRealm ) ) //$NON-NLS-1$
+                    {
+                        saslRealms.add( newSaslRealm );
+
+                        saslRealmsTableViewer.refresh();
+                        setEditorDirty();
+                    }
+                }
+            }
+        } );
+        editSaslRealmsButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                editSelectedSaslRealm();
+            }
+        } );
+
+        // The SelectionListener for the Binary Attributes Delete Button
+        deleteSaslRealmButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                StructuredSelection selection = ( StructuredSelection ) saslRealmsTableViewer.getSelection();
+                if ( !selection.isEmpty() )
+                {
+                    String saslRealm = ( String ) selection.getFirstElement();
+                    saslRealms.remove( saslRealm );
+
+                    saslRealmsTableViewer.refresh();
+                    setEditorDirty();
+                }
+            }
+        } );
+    }
+
+
+    /**
+     * Opens a NTLM Provider with the selected Supported Mechanism the Supported Mechanisms Table.
+     */
+    private void editSelectedSupportedMechanism()
+    {
+        StructuredSelection selection = ( StructuredSelection ) supportedMechanismsTableViewer.getSelection();
+        if ( !selection.isEmpty() )
+        {
+            SupportedMechanismEnum selected = ( SupportedMechanismEnum ) selection.getFirstElement();
+
+            if ( SupportedMechanismEnum.NTLM.equals( selected ) || SupportedMechanismEnum.GSS_SPNEGO.equals( selected ) )
+            {
+                String oldNtlmProvider = selected.getNtlmProviderFqcn();
+
+                NtlmProviderDialog dialog = new NtlmProviderDialog( oldNtlmProvider );
+                if ( Dialog.OK == dialog.open() && dialog.isDirty() )
+                {
+                    selected.setNtlmProviderFqcn( dialog.getNtlmProvider() );
+                    supportedMechanismsTableViewer.refresh();
+                    setEditorDirty();
+                }
+            }
+        }
+    }
+
+
+    /**
+     * Opens a SASL Realm Dialog with the selected SASL Realm in the SASL 
+     * Realms Table Viewer.
+     */
+    private void editSelectedSaslRealm()
+    {
+        StructuredSelection selection = ( StructuredSelection ) saslRealmsTableViewer.getSelection();
+        if ( !selection.isEmpty() )
+        {
+            String oldSaslRealm = ( String ) selection.getFirstElement();
+
+            SaslRealmDialog dialog = new SaslRealmDialog( oldSaslRealm );
+            if ( Dialog.OK == dialog.open() && dialog.isDirty() )
+            {
+                saslRealms.remove( oldSaslRealm );
+
+                String newSaslRealm = dialog.getSaslRealm();
+                if ( newSaslRealm != null && !"".equals( newSaslRealm ) && !saslRealms.contains( newSaslRealm ) ) //$NON-NLS-1$
+                {
+                    saslRealms.add( newSaslRealm );
+                }
+
+                saslRealmsTableViewer.refresh();
+                setEditorDirty();
+            }
+        }
+    }
+
+
+    /**
+     * Sets the Editor as dirty.
+     */
+    private void setEditorDirty()
+    {
+        ( ( ServerConfigurationEditor ) getEditor() ).setDirty( true );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.configuration.editor.SavableWizardPage#save()
+     */
+    public void save()
+    {
+        ServerConfigurationV157 configuration = ( ServerConfigurationV157 ) ( ( ServerConfigurationEditor ) getEditor() )
+            .getServerConfiguration();
+
+        // Supported Authentication Mechanisms
+        if ( ( supportedMechanismsTableViewer != null ) && ( supportedMechanismsTableViewer.getTable() != null )
+            && ( !supportedMechanismsTableViewer.getTable().isDisposed() ) )
+        {
+            List<SupportedMechanismEnum> supportedMechanismsList = new ArrayList<SupportedMechanismEnum>();
+            for ( Object supportedMechanism : supportedMechanismsTableViewer.getCheckedElements() )
+            {
+                supportedMechanismsList.add( ( SupportedMechanismEnum ) supportedMechanism );
+            }
+            configuration.setSupportedMechanisms( supportedMechanismsList );
+        }
+
+        // SASL Host
+        if ( ( saslHostText != null ) && ( !saslHostText.isDisposed() ) )
+        {
+            configuration.setSaslHost( saslHostText.getText() );
+        }
+
+        // SASL Principal
+        if ( ( saslPrincipalText != null ) && ( !saslPrincipalText.isDisposed() ) )
+        {
+            configuration.setSaslPrincipal( saslPrincipalText.getText() );
+        }
+
+        // Search Base DN
+        if ( ( searchBaseDnText != null ) && ( !searchBaseDnText.isDisposed() ) )
+        {
+            configuration.setSearchBaseDn( searchBaseDnText.getText() );
+        }
+
+        // SASL Realms
+        if ( ( saslRealmsTableViewer != null ) && ( saslRealmsTableViewer.getTable() != null )
+            && ( !saslRealmsTableViewer.getTable().isDisposed() ) )
+        {
+            configuration.setSaslRealms( saslRealms );
+        }
+    }
+}

Added: directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/ExtendedOperationDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/ExtendedOperationDetailsPage.java?rev=995368&view=auto
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/ExtendedOperationDetailsPage.java (added)
+++ directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/ExtendedOperationDetailsPage.java Thu Sep  9 10:11:43 2010
@@ -0,0 +1,209 @@
+/*
+ *  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.apacheds.configuration.editor.v157;
+
+
+import org.apache.directory.studio.apacheds.configuration.model.v157.ExtendedOperationEnum;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.IDetailsPage;
+import org.eclipse.ui.forms.IFormPart;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+
+/**
+ * This class represents the Details Page of the Server Configuration Editor for the Extended Operation type
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ExtendedOperationDetailsPage implements IDetailsPage
+{
+    /** The Managed Form */
+    private IManagedForm mform;
+
+    /** The input Interceptor */
+    private ExtendedOperationEnum input;
+
+    /** The dirty flag */
+    private boolean dirty = false;
+
+    // UI fields
+    private Text nameText;
+    private Text descriptionText;
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IDetailsPage#createContents(org.eclipse.swt.widgets.Composite)
+     */
+    public void createContents( Composite parent )
+    {
+        FormToolkit toolkit = mform.getToolkit();
+        TableWrapLayout layout = new TableWrapLayout();
+        layout.topMargin = 5;
+        layout.leftMargin = 5;
+        layout.rightMargin = 2;
+        layout.bottomMargin = 2;
+        parent.setLayout( layout );
+
+        createDetailsSection( parent, toolkit );
+    }
+
+
+    /**
+     * Creates the Details Section
+     *
+     * @param parent
+     *      the parent composite
+     * @param toolkit
+     *      the toolkit to use
+     */
+    private void createDetailsSection( Composite parent, FormToolkit toolkit )
+    {
+        Section section = toolkit.createSection( parent, Section.TITLE_BAR );
+        section.marginWidth = 10;
+        section.setText( "Extended Operation Details" ); //$NON-NLS-1$
+        TableWrapData td = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
+        td.grabHorizontal = true;
+        section.setLayoutData( td );
+        Composite client = toolkit.createComposite( section );
+        toolkit.paintBordersFor( client );
+        GridLayout glayout = new GridLayout( 2, false );
+        client.setLayout( glayout );
+        section.setClient( client );
+
+        // Name
+        toolkit.createLabel( client, Messages.getString( "ExtendedOperationDetailsPage.Name" ) ); //$NON-NLS-1$
+        nameText = toolkit.createText( client, "" ); //$NON-NLS-1$
+        nameText.setEditable( false );
+        nameText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+        // Description
+        toolkit.createLabel( client, Messages.getString( "ExtendedOperationDetailsPage.Description" ) ); //$NON-NLS-1$
+        descriptionText = toolkit.createText( client, "", SWT.MULTI | SWT.WRAP | SWT.V_SCROLL ); //$NON-NLS-1$
+        descriptionText.setEditable( false );
+        GridData gridData = new GridData( SWT.FILL, SWT.NONE, true, false );
+        gridData.widthHint = 100;
+        gridData.heightHint = 75;
+        descriptionText.setLayoutData( gridData );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IPartSelectionListener#selectionChanged(org.eclipse.ui.forms.IFormPart, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IFormPart part, ISelection selection )
+    {
+        IStructuredSelection ssel = ( IStructuredSelection ) selection;
+        if ( ssel.size() == 1 )
+        {
+            input = ( ExtendedOperationEnum ) ssel.getFirstElement();
+        }
+        else
+        {
+            input = null;
+        }
+        refresh();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IFormPart#commit(boolean)
+     */
+    public void commit( boolean onSave )
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IFormPart#dispose()
+     */
+    public void dispose()
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IFormPart#initialize(org.eclipse.ui.forms.IManagedForm)
+     */
+    public void initialize( IManagedForm form )
+    {
+        this.mform = form;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IFormPart#isDirty()
+     */
+    public boolean isDirty()
+    {
+        return dirty;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IFormPart#isStale()
+     */
+    public boolean isStale()
+    {
+        return false;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IFormPart#refresh()
+     */
+    public void refresh()
+    {
+        // Name
+        String name = input.getName();
+        nameText.setText( ( name == null ) ? "" : name ); //$NON-NLS-1$
+
+        // Description
+        String description = input.getDescription();
+        descriptionText.setText( ( description == null ) ? "" : description ); //$NON-NLS-1$
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IFormPart#setFocus()
+     */
+    public void setFocus()
+    {
+        nameText.setFocus();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.IFormPart#setFormInput(java.lang.Object)
+     */
+    public boolean setFormInput( Object input )
+    {
+        return false;
+    }
+}

Added: directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/ExtendedOperationsMasterDetailsBlock.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/ExtendedOperationsMasterDetailsBlock.java?rev=995368&view=auto
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/ExtendedOperationsMasterDetailsBlock.java (added)
+++ directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/ExtendedOperationsMasterDetailsBlock.java Thu Sep  9 10:11:43 2010
@@ -0,0 +1,295 @@
+/*
+ *  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.apacheds.configuration.editor.v157;
+
+
+import java.util.List;
+
+import org.apache.directory.studio.apacheds.configuration.ApacheDSConfigurationPlugin;
+import org.apache.directory.studio.apacheds.configuration.ApacheDSConfigurationPluginConstants;
+import org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditor;
+import org.apache.directory.studio.apacheds.configuration.editor.v157.dialogs.ExtendedOperationDialog;
+import org.apache.directory.studio.apacheds.configuration.model.v157.ExtendedOperationEnum;
+import org.apache.directory.studio.apacheds.configuration.model.v157.ServerConfigurationV157;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.forms.DetailsPart;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.MasterDetailsBlock;
+import org.eclipse.ui.forms.SectionPart;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+
+
+/**
+ * This class represents the Extended Operations Master/Details Block used in the Extended Operations Page.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ExtendedOperationsMasterDetailsBlock extends MasterDetailsBlock
+{
+    /** The associated page */
+    private FormPage page;
+
+    /** The input Server Configuration */
+    private ServerConfigurationV157 serverConfiguration;
+
+    /** The Extended Operations List */
+    private List<ExtendedOperationEnum> extendedOperations;
+
+    /** The Details Page */
+    private ExtendedOperationDetailsPage detailsPage;
+
+    // UI Fields
+    private TableViewer viewer;
+    private Button addButton;
+    private Button deleteButton;
+
+
+    /**
+     * Creates a new instance of ExtendedOperationsMasterDetailsBlock.
+     *
+     * @param page
+     */
+    public ExtendedOperationsMasterDetailsBlock( FormPage page )
+    {
+        this.page = page;
+        serverConfiguration = ( ServerConfigurationV157 ) ( ( ServerConfigurationEditor ) page.getEditor() )
+            .getServerConfiguration();
+        extendedOperations = serverConfiguration.getExtendedOperations();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.MasterDetailsBlock#createMasterPart(org.eclipse.ui.forms.IManagedForm, org.eclipse.swt.widgets.Composite)
+     */
+    protected void createMasterPart( final IManagedForm managedForm, Composite parent )
+    {
+        FormToolkit toolkit = managedForm.getToolkit();
+
+        // Creating the Section
+        Section section = toolkit.createSection( parent, Section.TITLE_BAR );
+        section.setText( Messages.getString( "ExtendedOperationsMasterDetailsBlock.AllExtendedOperations" ) ); //$NON-NLS-1$
+        section.marginWidth = 10;
+        section.marginHeight = 5;
+        Composite client = toolkit.createComposite( section, SWT.WRAP );
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 2;
+        layout.makeColumnsEqualWidth = false;
+        layout.marginWidth = 2;
+        layout.marginHeight = 2;
+        client.setLayout( layout );
+        toolkit.paintBordersFor( client );
+        section.setClient( client );
+
+        // Creating the Table and Table Viewer
+        Table table = toolkit.createTable( client, SWT.NULL );
+        GridData gd = new GridData( SWT.FILL, SWT.FILL, true, true, 1, 2 );
+        gd.heightHint = 20;
+        gd.widthHint = 100;
+        table.setLayoutData( gd );
+        final SectionPart spart = new SectionPart( section );
+        managedForm.addPart( spart );
+        viewer = new TableViewer( table );
+        viewer.addSelectionChangedListener( new ISelectionChangedListener()
+        {
+            public void selectionChanged( SelectionChangedEvent event )
+            {
+                managedForm.fireSelectionChanged( spart, event.getSelection() );
+            }
+        } );
+        viewer.setContentProvider( new ArrayContentProvider() );
+        viewer.setLabelProvider( new LabelProvider()
+        {
+            public Image getImage( Object element )
+            {
+                return ApacheDSConfigurationPlugin.getDefault().getImage(
+                    ApacheDSConfigurationPluginConstants.IMG_EXTENDED_OPERATION );
+            }
+
+
+            public String getText( Object element )
+            {
+                if ( element instanceof ExtendedOperationEnum )
+                {
+                    return ( ( ExtendedOperationEnum ) element ).getName();
+
+                }
+
+                return super.getText( element );
+            }
+        } );
+
+        // Creating the button(s)
+        addButton = toolkit.createButton( client,
+            Messages.getString( "ExtendedOperationsMasterDetailsBlock.Add" ), SWT.PUSH ); //$NON-NLS-1$
+        addButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+
+        deleteButton = toolkit.createButton( client,
+            Messages.getString( "ExtendedOperationsMasterDetailsBlock.Delete" ), SWT.PUSH ); //$NON-NLS-1$
+        deleteButton.setEnabled( false );
+        deleteButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+
+        initFromInput();
+        addListeners();
+    }
+
+
+    /**
+     * Initializes the page with the Editor input.
+     */
+    private void initFromInput()
+    {
+        viewer.setInput( extendedOperations );
+    }
+
+
+    /**
+     * Add listeners to UI fields.
+     */
+    private void addListeners()
+    {
+        viewer.addSelectionChangedListener( new ISelectionChangedListener()
+        {
+            public void selectionChanged( SelectionChangedEvent event )
+            {
+                viewer.refresh();
+
+                deleteButton.setEnabled( !event.getSelection().isEmpty() );
+            }
+        } );
+
+        addButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                ExtendedOperationDialog dialog = new ExtendedOperationDialog( extendedOperations );
+                if ( Dialog.OK == dialog.open() )
+                {
+                    ExtendedOperationEnum newExtendedOperation = dialog.getExtendedOperation();
+                    extendedOperations.add( newExtendedOperation );
+                    viewer.refresh();
+                    viewer.setSelection( new StructuredSelection( newExtendedOperation ) );
+                    setEditorDirty();
+                }
+            }
+        } );
+
+        deleteButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
+                if ( !selection.isEmpty() )
+                {
+                    ExtendedOperationEnum extendedOperation = ( ExtendedOperationEnum ) selection.getFirstElement();
+
+                    extendedOperations.remove( extendedOperation );
+                    viewer.refresh();
+                    setEditorDirty();
+                }
+            }
+        } );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.MasterDetailsBlock#createToolBarActions(org.eclipse.ui.forms.IManagedForm)
+     */
+    protected void createToolBarActions( IManagedForm managedForm )
+    {
+        final ScrolledForm form = managedForm.getForm();
+
+        // Horizontal layout Action
+        Action horizontalAction = new Action( "Horizontal layout", Action.AS_RADIO_BUTTON ) { //$NON-NLS-1$
+            public void run()
+            {
+                sashForm.setOrientation( SWT.HORIZONTAL );
+                form.reflow( true );
+            }
+        };
+        horizontalAction.setChecked( true );
+        horizontalAction.setToolTipText( "Horizontal Orientation" ); //$NON-NLS-1$
+        horizontalAction.setImageDescriptor( ApacheDSConfigurationPlugin.getDefault().getImageDescriptor(
+            ApacheDSConfigurationPluginConstants.IMG_HORIZONTAL_ORIENTATION ) );
+
+        // Vertical layout Action
+        Action verticalAction = new Action( "Vertical Orientation", Action.AS_RADIO_BUTTON ) { //$NON-NLS-1$
+            public void run()
+            {
+                sashForm.setOrientation( SWT.VERTICAL );
+                form.reflow( true );
+            }
+        };
+        verticalAction.setChecked( false );
+        verticalAction.setToolTipText( "Vertical Orientation" ); //$NON-NLS-1$
+        verticalAction.setImageDescriptor( ApacheDSConfigurationPlugin.getDefault().getImageDescriptor(
+            ApacheDSConfigurationPluginConstants.IMG_VERTICAL_ORIENTATION ) );
+
+        form.getToolBarManager().add( horizontalAction );
+        form.getToolBarManager().add( verticalAction );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.MasterDetailsBlock#registerPages(org.eclipse.ui.forms.DetailsPart)
+     */
+    protected void registerPages( DetailsPart detailsPart )
+    {
+        detailsPage = new ExtendedOperationDetailsPage();
+        detailsPart.registerPage( ExtendedOperationEnum.class, detailsPage );
+    }
+
+
+    /**
+     * Sets the Editor as dirty.
+     */
+    public void setEditorDirty()
+    {
+        ( ( ServerConfigurationEditor ) page.getEditor() ).setDirty( true );
+    }
+
+
+    /**
+     * Saves the necessary elements to the input model.
+     */
+    public void save()
+    {
+        detailsPage.commit( true );
+        viewer.setInput( extendedOperations );
+    }
+}

Added: directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/ExtendedOperationsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/ExtendedOperationsPage.java?rev=995368&view=auto
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/ExtendedOperationsPage.java (added)
+++ directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v157/ExtendedOperationsPage.java Thu Sep  9 10:11:43 2010
@@ -0,0 +1,87 @@
+/*
+ *  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.apacheds.configuration.editor.v157;
+
+
+import org.apache.directory.studio.apacheds.configuration.ApacheDSConfigurationPluginConstants;
+import org.apache.directory.studio.apacheds.configuration.editor.SaveableFormPage;
+import org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditor;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+
+
+/**
+ * This class represents the Extended Operations Page of the Server Configuration Editor.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ExtendedOperationsPage extends FormPage implements SaveableFormPage
+{
+    /** The Page ID*/
+    public static final String ID = ServerConfigurationEditor.ID + ".V157.ExtendedOperationsPage"; //$NON-NLS-1$
+
+    /** The Page Title */
+    private static final String TITLE = Messages.getString( "ExtendedOperationsPage.ExtendedOperations" ); //$NON-NLS-1$
+
+    /** The Master/Details Block */
+    private ExtendedOperationsMasterDetailsBlock masterDetailsBlock;
+
+
+    /**
+     * Creates a new instance of ExtendedOperationsPage.
+     *
+     * @param editor
+     *      the associated editor
+     */
+    public ExtendedOperationsPage( FormEditor editor )
+    {
+        super( editor, ID, TITLE );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.forms.editor.FormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
+     */
+    protected void createFormContent( IManagedForm managedForm )
+    {
+        PlatformUI.getWorkbench().getHelpSystem().setHelp( getPartControl(),
+            ApacheDSConfigurationPluginConstants.PLUGIN_ID + "." + "configuration_editor_157" ); //$NON-NLS-1$ //$NON-NLS-2$
+
+        final ScrolledForm form = managedForm.getForm();
+        form.setText( Messages.getString( "ExtendedOperationsPage.ExtendedOperations" ) ); //$NON-NLS-1$
+        masterDetailsBlock = new ExtendedOperationsMasterDetailsBlock( this );
+        masterDetailsBlock.createContent( managedForm );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.apacheds.configuration.editor.SavableWizardPage#save()
+     */
+    public void save()
+    {
+        if ( masterDetailsBlock != null )
+        {
+            masterDetailsBlock.save();
+        }
+    }
+}



Mime
View raw message