You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2007/11/16 16:45:44 UTC
svn commit: r595708 [1/3] - in
/directory/studio/trunk/studio-apacheds-configuration: ./ META-INF/
resources/icons/
src/main/java/org/apache/directory/studio/apacheds/configuration/
src/main/java/org/apache/directory/studio/apacheds/configuration/actio...
Author: pamarcelot
Date: Fri Nov 16 07:45:41 2007
New Revision: 595708
URL: http://svn.apache.org/viewvc?rev=595708&view=rev
Log:
Part of a fix for DIRSTUDIO-236 (Update the Apache DS Configuration plugin to work with the server.xml file of Apache DS 1.5.1).
Added:
directory/studio/trunk/studio-apacheds-configuration/resources/icons/editor_new.gif (with props)
directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/ApacheDSConfigurationContentDescriber.java
directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/ServerConfigurationContentTypeChecker.java
directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/wizards/
directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/wizards/NewApacheDSConfigurationFileWizard.java
directory/studio/trunk/studio-apacheds-configuration/src/main/resources/org/apache/directory/studio/apacheds/configuration/Copy of default-server.xml
Removed:
directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/actions/
Modified:
directory/studio/trunk/studio-apacheds-configuration/META-INF/MANIFEST.MF
directory/studio/trunk/studio-apacheds-configuration/plugin.xml
directory/studio/trunk/studio-apacheds-configuration/resources/icons/editor.gif
directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java
directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/GeneralPage.java
directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/InterceptorsMasterDetailsBlock.java
directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/PartitionDetailsPage.java
directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/PartitionsMasterDetailsBlock.java
directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java
directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditorInput.java
directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/Partition.java
directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/ServerConfiguration.java
directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/ServerConfigurationParser.java
directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/ServerConfigurationWriter.java
directory/studio/trunk/studio-apacheds-configuration/src/main/resources/org/apache/directory/studio/apacheds/configuration/default-server.xml
Modified: directory/studio/trunk/studio-apacheds-configuration/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-configuration/META-INF/MANIFEST.MF?rev=595708&r1=595707&r2=595708&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-configuration/META-INF/MANIFEST.MF (original)
+++ directory/studio/trunk/studio-apacheds-configuration/META-INF/MANIFEST.MF Fri Nov 16 07:45:41 2007
@@ -11,4 +11,7 @@
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui,
org.eclipse.ui.forms,
- org.apache.directory.studio.jars
+ org.apache.directory.studio.jars,
+ org.eclipse.jface.text,
+ org.eclipse.ui.ide,
+ org.eclipse.core.resources
Modified: directory/studio/trunk/studio-apacheds-configuration/plugin.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-configuration/plugin.xml?rev=595708&r1=595707&r2=595708&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-configuration/plugin.xml (original)
+++ directory/studio/trunk/studio-apacheds-configuration/plugin.xml Fri Nov 16 07:45:41 2007
@@ -20,36 +20,44 @@
-->
<plugin>
<extension
- point="org.eclipse.ui.actionSets">
- <actionSet
- id="org.apache.directory.studio.apacheds.configuration.actionset"
- label="Apache DS"
- visible="true">
- <menu
- id="org.apache.directory.studio.apacheds.configuration.actionset.menu"
- label="Apache DS"/>
- <action
- class="org.apache.directory.studio.apacheds.configuration.actions.OpenServerConfigurationAction"
- id="org.apache.directory.studio.apacheds.configuration.openServerConfiguration"
- label="Open Configuration File..."
- menubarPath="org.apache.directory.studio.apacheds.configuration.actionset.menu/open"
- style="push"/>
- <action
- class="org.apache.directory.studio.apacheds.configuration.actions.NewServerConfigurationAction"
- id="org.apache.directory.studio.apacheds.configuration.newServerConfiguration"
- label="New Configuration File"
- menubarPath="org.apache.directory.studio.apacheds.configuration.actionset.menu/new"
- style="push"/>
- </actionSet>
- </extension>
- <extension
point="org.eclipse.ui.editors">
<editor
class="org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditor"
default="true"
icon="resources/icons/editor.gif"
id="org.apache.directory.studio.apacheds.configuration.editor"
- name="Server Configuration Editor">
+ name="Apache DS Configuration File Editor">
+ <contentTypeBinding
+ contentTypeId="org.apache.directory.studio.apacheds.configuration.contenttype">
+ </contentTypeBinding>
</editor>
+ </extension>
+ <extension
+ point="org.eclipse.core.contenttype.contentTypes">
+ <content-type
+ base-type="org.eclipse.core.runtime.xml"
+ describer="org.apache.directory.studio.apacheds.configuration.ApacheDSConfigurationContentDescriber"
+ file-extensions="xml"
+ file-names="server.xml"
+ id="org.apache.directory.studio.apacheds.configuration.contenttype"
+ name="Apache DS Configuration File"
+ priority="normal">
+ </content-type>
+ </extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ canFinishEarly="true"
+ category="org.apache.directory.studio.apacheds.configuration.newWizards"
+ class="org.apache.directory.studio.apacheds.configuration.wizards.NewApacheDSConfigurationFileWizard"
+ hasPages="false"
+ icon="resources/icons/editor_new.gif"
+ id="org.apache.directory.studio.apacheds.configuration.NewApacheDSConfigurationFileWizard"
+ name="Apache DS Configuration File"
+ project="false"/>
+ <category
+ id="org.apache.directory.studio.apacheds.configuration.newWizards"
+ name="Apache DS">
+ </category>
</extension>
</plugin>
Modified: directory/studio/trunk/studio-apacheds-configuration/resources/icons/editor.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-configuration/resources/icons/editor.gif?rev=595708&r1=595707&r2=595708&view=diff
==============================================================================
Binary files - no diff available.
Added: directory/studio/trunk/studio-apacheds-configuration/resources/icons/editor_new.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-configuration/resources/icons/editor_new.gif?rev=595708&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-configuration/resources/icons/editor_new.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/ApacheDSConfigurationContentDescriber.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/ApacheDSConfigurationContentDescriber.java?rev=595708&view=auto
==============================================================================
--- directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/ApacheDSConfigurationContentDescriber.java (added)
+++ directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/ApacheDSConfigurationContentDescriber.java Fri Nov 16 07:45:41 2007
@@ -0,0 +1,85 @@
+/*
+ * 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;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+
+import org.apache.directory.studio.apacheds.configuration.model.ServerConfigurationContentTypeChecker;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.content.IContentDescription;
+import org.eclipse.core.runtime.content.ITextContentDescriber;
+
+
+/**
+ * This class implements a ContentDescriber for Apache DS Configuration file.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ApacheDSConfigurationContentDescriber implements ITextContentDescriber
+{
+ /** The supported Options */
+ private static final QualifiedName[] SUPPORTED_OPTIONS = new QualifiedName[]
+ { IContentDescription.CHARSET, IContentDescription.BYTE_ORDER_MARK };
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.content.ITextContentDescriber#describe(java.io.Reader, org.eclipse.core.runtime.content.IContentDescription)
+ */
+ public int describe( Reader contents, IContentDescription description ) throws IOException
+ {
+ if ( ServerConfigurationContentTypeChecker.isValid( contents ) )
+ {
+ return ITextContentDescriber.VALID;
+ }
+ else
+ {
+ return ITextContentDescriber.INVALID;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.content.IContentDescriber#describe(java.io.InputStream, org.eclipse.core.runtime.content.IContentDescription)
+ */
+ public int describe( InputStream contents, IContentDescription description ) throws IOException
+ {
+ if ( ServerConfigurationContentTypeChecker.isValid( contents ) )
+ {
+ return ITextContentDescriber.VALID;
+ }
+ else
+ {
+ return ITextContentDescriber.INVALID;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.content.IContentDescriber#getSupportedOptions()
+ */
+ public QualifiedName[] getSupportedOptions()
+ {
+ return SUPPORTED_OPTIONS;
+ }
+}
Modified: directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java?rev=595708&r1=595707&r2=595708&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java (original)
+++ directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java Fri Nov 16 07:45:41 2007
@@ -89,7 +89,7 @@
public ExtendedOperationsMasterDetailsBlock( FormPage page )
{
this.page = page;
- serverConfiguration = ( ( ServerConfigurationEditorInput ) page.getEditorInput() ).getServerConfiguration();
+ serverConfiguration = ( ( ServerConfigurationEditor ) page.getEditor() ).getServerConfiguration();
extendedOperations = serverConfiguration.getExtendedOperations();
}
Modified: directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/GeneralPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/GeneralPage.java?rev=595708&r1=595707&r2=595708&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/GeneralPage.java (original)
+++ directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/GeneralPage.java Fri Nov 16 07:45:41 2007
@@ -20,6 +20,9 @@
package org.apache.directory.studio.apacheds.configuration.editor;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import org.apache.directory.studio.apacheds.configuration.dialogs.BinaryAttributeDialog;
@@ -27,10 +30,10 @@
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
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;
@@ -45,7 +48,6 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
@@ -77,8 +79,6 @@
private List<String> binaryAttributes;
// UI Fields
- private Text portText;
- private Combo authenticationCombo;
private Text principalText;
private Text passwordText;
private Button showPasswordCheckbox;
@@ -88,7 +88,6 @@
private Text synchPeriodText;
private Text maxThreadsText;
private Button enableAccesControlCheckbox;
- private Button enableNTPCheckbox;
private Button enableKerberosCheckbox;
private Button enableChangePasswordCheckbox;
private Button denormalizeOpAttrCheckbox;
@@ -96,6 +95,20 @@
private Button binaryAttributesAddButton;
private Button binaryAttributesEditButton;
private Button binaryAttributesDeleteButton;
+ private Button enableLdapCheckbox;
+ private Text ldapPortText;
+ private Button enableLdapsCheckbox;
+ private Text ldapsPortText;
+ private Text kerberosPortText;
+ private Button enableNtpCheckbox;
+ private Text ntpPortText;
+ private Button enableDnsCheckbox;
+ private Text dnsPortText;
+ private Text changePasswordPortText;
+
+ private CheckboxTableViewer supportedMechanismsTableViewer;
+ private Button selectAllSupportedMechanismsButton;
+ private Button deselectAllSupportedMechanismsButton;
/**
@@ -124,10 +137,29 @@
parent.setLayout( twl );
FormToolkit toolkit = managedForm.getToolkit();
- createSettingsSection( parent, toolkit );
- createBinaryAttributesSection( parent, toolkit );
- createLimitsSection( parent, toolkit );
- createOptionsSection( parent, toolkit );
+ Composite leftComposite = toolkit.createComposite( parent );
+ GridLayout leftCompositeGridLayout = new GridLayout();
+ leftCompositeGridLayout.marginHeight = leftCompositeGridLayout.marginWidth = 0;
+ leftComposite.setLayout( leftCompositeGridLayout );
+ TableWrapData leftCompositeTableWrapData = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
+ leftCompositeTableWrapData.grabHorizontal = true;
+ leftComposite.setLayoutData( leftCompositeTableWrapData );
+
+ createAdministratorSettingsSection( leftComposite, toolkit );
+ createProtocolsSection( leftComposite, toolkit );
+ createSupportedAuthenticationMechanismsSection( leftComposite, toolkit );
+
+ Composite rightComposite = toolkit.createComposite( parent );
+ GridLayout rightCompositeGridLayout = new GridLayout();
+ rightCompositeGridLayout.marginHeight = rightCompositeGridLayout.marginWidth = 0;
+ rightComposite.setLayout( rightCompositeGridLayout );
+ TableWrapData rightCompositeTableWrapData = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
+ rightCompositeTableWrapData.grabHorizontal = true;
+ rightComposite.setLayoutData( rightCompositeTableWrapData );
+
+ createBinaryAttributesSection( rightComposite, toolkit );
+ createLimitsSection( rightComposite, toolkit );
+ createOptionsSection( rightComposite, toolkit );
initFromInput();
addListeners();
@@ -135,53 +167,27 @@
/**
- * Creates the Settings Section.
+ * Creates the Administrator Settings Section.
*
* @param parent
* the parent composite
* @param toolkit
* the toolkit to use
*/
- private void createSettingsSection( Composite parent, FormToolkit toolkit )
+ private void createAdministratorSettingsSection( Composite parent, FormToolkit toolkit )
{
// Creation of the section
Section section = toolkit.createSection( parent, Section.DESCRIPTION | Section.TITLE_BAR );
section.marginWidth = 4;
- section.setText( "Settings" );
- section.setDescription( "Set the settings of the server." );
- TableWrapData td = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
- td.grabHorizontal = true;
- section.setLayoutData( td );
+ section.setText( "Administrator settings" );
+ section.setDescription( "Set the settings about the administrator of the server." );
+ 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 );
- // Port
- toolkit.createLabel( client, "Port:" );
- portText = toolkit.createText( client, "" );
- portText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
- portText.addVerifyListener( new VerifyListener()
- {
- public void verifyText( VerifyEvent e )
- {
- if ( !e.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
- {
- e.doit = false;
- }
- }
- } );
-
- // Authentication
- toolkit.createLabel( client, "Authentication:" );
- authenticationCombo = new Combo( client, SWT.SIMPLE );
- authenticationCombo.setItems( new String[]
- { "Simple" } );
- authenticationCombo.setText( "Simple" );
- authenticationCombo.setEnabled( false );
- authenticationCombo.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-
// Principal
toolkit.createLabel( client, "Principal:" );
principalText = toolkit.createText( client, "" );
@@ -196,7 +202,7 @@
// Show Password
toolkit.createLabel( client, "" );
showPasswordCheckbox = toolkit.createButton( client, "Show password", SWT.CHECK );
- showPasswordCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ showPasswordCheckbox.setLayoutData( new GridData( SWT.NONE, SWT.NONE, true, false ) );
showPasswordCheckbox.setSelection( false );
showPasswordCheckbox.addSelectionListener( new SelectionAdapter()
{
@@ -212,10 +218,6 @@
}
}
} );
-
- // Allow Anonymous Access
- allowAnonymousAccessCheckbox = toolkit.createButton( client, "Allow Anonymous Access", SWT.CHECK );
- allowAnonymousAccessCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
}
@@ -230,13 +232,10 @@
private void createLimitsSection( Composite parent, FormToolkit toolkit )
{
// Creation of the section
- Section section = toolkit.createSection( parent, Section.DESCRIPTION | Section.TITLE_BAR );
+ Section section = toolkit.createSection( parent, Section.TITLE_BAR );
section.marginWidth = 4;
section.setText( "Limits" );
- section.setDescription( "Set the limits of the server." );
- TableWrapData td = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
- td.grabHorizontal = true;
- section.setLayoutData( td );
+ section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
Composite client = toolkit.createComposite( section );
toolkit.paintBordersFor( client );
GridLayout glayout = new GridLayout( 2, false );
@@ -316,40 +315,26 @@
private void createOptionsSection( Composite parent, FormToolkit toolkit )
{
// Creation of the section
- Section section = toolkit.createSection( parent, Section.DESCRIPTION | Section.TITLE_BAR );
+ Section section = toolkit.createSection( parent, Section.TITLE_BAR );
section.marginWidth = 4;
section.setText( "Options" );
- section.setDescription( "Set the options of the server." );
- TableWrapData td = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
- td.grabHorizontal = true;
- section.setLayoutData( td );
+ section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
Composite client = toolkit.createComposite( section );
toolkit.paintBordersFor( client );
- GridLayout glayout = new GridLayout();
- client.setLayout( glayout );
+ client.setLayout( new GridLayout() );
section.setClient( client );
+ // Allow Anonymous Access
+ allowAnonymousAccessCheckbox = toolkit.createButton( client, "Allow Anonymous Access", SWT.CHECK );
+ allowAnonymousAccessCheckbox.setLayoutData( new GridData( SWT.NONE, SWT.NONE, true, false ) );
+
// Enable Access Control
enableAccesControlCheckbox = toolkit.createButton( client, "Enable Access Control", SWT.CHECK );
- enableAccesControlCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-
- // Enable NTP
- enableNTPCheckbox = toolkit.createButton( client, "Enable NTP", SWT.CHECK );
- enableNTPCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ enableAccesControlCheckbox.setLayoutData( new GridData( SWT.NONE, SWT.NONE, true, false ) );
// Denormalize Operational Attributes
denormalizeOpAttrCheckbox = toolkit.createButton( client, "Denormalize Operational Attributes", SWT.CHECK );
- denormalizeOpAttrCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
-
- // Enable Kerberos
- enableKerberosCheckbox = toolkit.createButton( client, "Enable Kerberos", SWT.CHECK );
- enableKerberosCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
- enableKerberosCheckbox.setEnabled( false );
-
- // Enable Change Password
- enableChangePasswordCheckbox = toolkit.createButton( client, "Enable Change Password", SWT.CHECK );
- enableChangePasswordCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
- enableChangePasswordCheckbox.setEnabled( false );
+ denormalizeOpAttrCheckbox.setLayoutData( new GridData( SWT.NONE, SWT.NONE, true, false ) );
}
@@ -367,11 +352,8 @@
Section section = toolkit.createSection( parent, Section.DESCRIPTION | Section.TITLE_BAR );
section.marginWidth = 4;
section.setText( "Binary Attributes" );
- section
- .setDescription( "Set attribute type names and OID's if you want an them to be handled as binary content." );
- TableWrapData td = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
- td.grabHorizontal = true;
- section.setLayoutData( td );
+ section.setDescription( "Set attribute type names and OID's if you want them to be handled as binary content." );
+ section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
Composite client = toolkit.createComposite( section );
toolkit.paintBordersFor( client );
GridLayout glayout = new GridLayout( 2, false );
@@ -384,7 +366,6 @@
binaryAttributesTable.setLayoutData( gd );
binaryAttributesTableViewer = new TableViewer( binaryAttributesTable );
binaryAttributesTableViewer.setContentProvider( new ArrayContentProvider() );
- binaryAttributesTableViewer.setLabelProvider( new LabelProvider() );
GridData buttonsGD = new GridData( SWT.FILL, SWT.BEGINNING, false, false );
buttonsGD.widthHint = IDialogConstants.BUTTON_WIDTH;
@@ -403,18 +384,174 @@
/**
- * Initializes the page with the Editor input.
+ * Creates the Supported Authentication Mechanisms Section
+ *
+ * @param parent
+ * the parent composite
+ * @param toolkit
+ * the toolkit to use
*/
- private void initFromInput()
+ private void createSupportedAuthenticationMechanismsSection( Composite parent, FormToolkit toolkit )
{
- ServerConfiguration configuration = ( ( ServerConfigurationEditorInput ) getEditorInput() )
- .getServerConfiguration();
+ // Creation of the section
+ Section section = toolkit.createSection( parent, Section.TITLE_BAR );
+ section.marginWidth = 4;
+ section.setText( "Supported Authentication Mechanisms" );
+ 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 );
+
+ Table supportedMechanismsTable = toolkit.createTable( client, SWT.CHECK );
+ GridData gd = new GridData( SWT.FILL, SWT.NONE, true, false, 1, 3 );
+ gd.heightHint = 76;
+ supportedMechanismsTable.setLayoutData( gd );
+ supportedMechanismsTableViewer = new CheckboxTableViewer( supportedMechanismsTable );
+ supportedMechanismsTableViewer.setContentProvider( new ArrayContentProvider() );
+ supportedMechanismsTableViewer.setInput( new String[]
+ { "SIMPLE", "CRAM-MD5", "DIGEST-MD5", "GSSAPI" } );
+
+ selectAllSupportedMechanismsButton = toolkit.createButton( client, "Select All", SWT.PUSH );
+ selectAllSupportedMechanismsButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+
+ deselectAllSupportedMechanismsButton = toolkit.createButton( client, "Deselect All", SWT.PUSH );
+ deselectAllSupportedMechanismsButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+ }
+
+
+ /**
+ * Creates the Protocols Section
+ *
+ * @param parent
+ * the parent composite
+ * @param toolkit
+ * the toolkit to use
+ */
+ private void createProtocolsSection( Composite parent, FormToolkit toolkit )
+ {
+ // Creation of the section
+ Section section = toolkit.createSection( parent, Section.TITLE_BAR );
+ section.marginWidth = 4;
+ section.setText( "Protocols" );
+ section.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ Composite client = toolkit.createComposite( section );
+ toolkit.paintBordersFor( client );
+ client.setLayout( new GridLayout( 2, true ) );
+ section.setClient( client );
+
+ // LDAP
+ Composite ldapProtocolComposite = createProtocolComposite( toolkit, client );
+ enableLdapCheckbox = toolkit.createButton( ldapProtocolComposite, "Enable LDAP", SWT.CHECK );
+ enableLdapCheckbox.setLayoutData( new GridData( SWT.NONE, SWT.NONE, true, false, 3, 1 ) );
+ toolkit.createLabel( ldapProtocolComposite, " " );
+ toolkit.createLabel( ldapProtocolComposite, "Port:" );
+ ldapPortText = createPortText( toolkit, ldapProtocolComposite );
+
+ // LDAPS
+ Composite ldapsProtocolComposite = createProtocolComposite( toolkit, client );
+ enableLdapsCheckbox = toolkit.createButton( ldapsProtocolComposite, "Enable LDAPS", SWT.CHECK );
+ enableLdapsCheckbox.setLayoutData( new GridData( SWT.NONE, SWT.NONE, true, false, 3, 1 ) );
+ toolkit.createLabel( ldapsProtocolComposite, " " );
+ toolkit.createLabel( ldapsProtocolComposite, "Port:" );
+ ldapsPortText = createPortText( toolkit, ldapsProtocolComposite );
+
+ // Kerberos
+ Composite kerberosProtocolComposite = createProtocolComposite( toolkit, client );
+ enableKerberosCheckbox = toolkit.createButton( kerberosProtocolComposite, "Enable Kerberos", SWT.CHECK );
+ enableKerberosCheckbox.setLayoutData( new GridData( SWT.NONE, SWT.NONE, true, false, 3, 1 ) );
+ toolkit.createLabel( kerberosProtocolComposite, " " );
+ toolkit.createLabel( kerberosProtocolComposite, "Port:" );
+ kerberosPortText = createPortText( toolkit, kerberosProtocolComposite );
+
+ // NTP
+ Composite ntpProtocolComposite = createProtocolComposite( toolkit, client );
+ enableNtpCheckbox = toolkit.createButton( ntpProtocolComposite, "Enable NTP", SWT.CHECK );
+ enableNtpCheckbox.setLayoutData( new GridData( SWT.NONE, SWT.NONE, true, false, 3, 1 ) );
+ toolkit.createLabel( ntpProtocolComposite, " " );
+ toolkit.createLabel( ntpProtocolComposite, "Port:" );
+ ntpPortText = createPortText( toolkit, ntpProtocolComposite );
+
+ // DNS
+ Composite dnsProtocolComposite = createProtocolComposite( toolkit, client );
+ enableDnsCheckbox = toolkit.createButton( dnsProtocolComposite, "Enable DNS", SWT.CHECK );
+ enableDnsCheckbox.setLayoutData( new GridData( SWT.NONE, SWT.NONE, true, false, 3, 1 ) );
+ toolkit.createLabel( dnsProtocolComposite, " " );
+ toolkit.createLabel( dnsProtocolComposite, "Port:" );
+ dnsPortText = createPortText( toolkit, dnsProtocolComposite );
+
+ // Change Password
+ Composite changePasswordProtocolComposite = createProtocolComposite( toolkit, client );
+ enableChangePasswordCheckbox = toolkit.createButton( changePasswordProtocolComposite, "Enable Change Password",
+ SWT.CHECK );
+ enableChangePasswordCheckbox.setLayoutData( new GridData( SWT.NONE, SWT.NONE, true, false, 3, 1 ) );
+ toolkit.createLabel( changePasswordProtocolComposite, " " );
+ toolkit.createLabel( changePasswordProtocolComposite, "Port:" );
+ changePasswordPortText = createPortText( toolkit, changePasswordProtocolComposite );
+ }
+
+
+ /**
+ * Creates a Protocol Composite : a Composite composed of a GridLayout with
+ * 3 columns and marginHeight and marginWidth set to 0.
+ *
+ * @param toolkit
+ * the toolkit
+ * @param parent
+ * the parent
+ * @return
+ * a Protocol Composite
+ */
+ private Composite createProtocolComposite( FormToolkit toolkit, Composite parent )
+ {
+ Composite protocolComposite = toolkit.createComposite( parent );
+ GridLayout protocolGridLayout = new GridLayout( 3, false );
+ protocolGridLayout.marginHeight = protocolGridLayout.marginWidth = 0;
+ protocolComposite.setLayout( protocolGridLayout );
+
+ return protocolComposite;
+ }
+
+
+ /**
+ * Creates a Text that can be used to enter a port number.
+ *
+ * @param toolkit
+ * the toolkit
+ * @param parent
+ * the parent
+ * @return
+ * a Text that can be used to enter a port number
+ */
+ private Text createPortText( FormToolkit toolkit, Composite parent )
+ {
+ Text portText = toolkit.createText( parent, "" );
+ GridData gd = new GridData( SWT.NONE, SWT.NONE, false, false );
+ gd.widthHint = 42;
+ portText.setLayoutData( gd );
+ portText.addVerifyListener( new VerifyListener()
+ {
+ public void verifyText( VerifyEvent e )
+ {
+ if ( !e.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
+ {
+ e.doit = false;
+ }
+ }
+ } );
+ portText.setTextLimit( 5 );
+
+ return portText;
+ }
- binaryAttributes = configuration.getBinaryAttributes();
- binaryAttributesTableViewer.setInput( binaryAttributes );
- // Port
- portText.setText( "" + configuration.getPort() );
+ /**
+ * Initializes the page with the Editor input.
+ */
+ private void initFromInput()
+ {
+ ServerConfiguration configuration = ( ( ServerConfigurationEditor ) getEditor() ).getServerConfiguration();
// Principal
String principal = configuration.getPrincipal();
@@ -430,8 +567,39 @@
passwordText.setText( password );
}
- // Allow Anonymous Access
- allowAnonymousAccessCheckbox.setSelection( configuration.isAllowAnonymousAccess() );
+ // Binary Attributes
+ binaryAttributes = configuration.getBinaryAttributes();
+ binaryAttributesTableViewer.setInput( binaryAttributes );
+
+ // LDAP Protocol
+ enableLdapCheckbox.setSelection( true );
+ ldapPortText.setEnabled( enableLdapCheckbox.getSelection() );
+ ldapPortText.setText( "" + configuration.getLdapPort() );
+
+ // LDAPS Protocol
+ enableLdapsCheckbox.setSelection( configuration.isEnableLdaps() );
+ ldapsPortText.setEnabled( enableLdapsCheckbox.getSelection() );
+ ldapsPortText.setText( "" + configuration.getLdapsPort() );
+
+ // Kerberos Protocol
+ enableKerberosCheckbox.setSelection( configuration.isEnableKerberos() );
+ kerberosPortText.setEnabled( enableKerberosCheckbox.getSelection() );
+ kerberosPortText.setText( "" + configuration.getKerberosPort() );
+
+ // NTP Protocol
+ enableNtpCheckbox.setSelection( configuration.isEnableNtp() );
+ ntpPortText.setEnabled( enableNtpCheckbox.getSelection() );
+ ntpPortText.setText( "" + configuration.getNtpPort() );
+
+ // DNS Protocol
+ enableDnsCheckbox.setSelection( configuration.isEnableDns() );
+ dnsPortText.setEnabled( enableDnsCheckbox.getSelection() );
+ dnsPortText.setText( "" + configuration.getDnsPort() );
+
+ // Change Password Protocol
+ enableChangePasswordCheckbox.setSelection( configuration.isEnableChangePassword() );
+ changePasswordPortText.setEnabled( enableChangePasswordCheckbox.getSelection() );
+ changePasswordPortText.setText( "" + configuration.getChangePasswordPort() );
// Max Time Limit
maxTimeLimitText.setText( "" + configuration.getMaxTimeLimit() );
@@ -445,17 +613,13 @@
// Max Threads
maxThreadsText.setText( "" + configuration.getMaxThreads() );
- // Enable Access Control
- enableAccesControlCheckbox.setSelection( configuration.isEnableAccessControl() );
+ supportedMechanismsTableViewer.setCheckedElements( configuration.getSupportedMechanisms().toArray() );
- // Enable NTP
- enableNTPCheckbox.setSelection( configuration.isEnableNTP() );
-
- // Enable Kerberos
- enableKerberosCheckbox.setSelection( configuration.isEnableKerberos() );
+ // Allow Anonymous Access
+ allowAnonymousAccessCheckbox.setSelection( configuration.isAllowAnonymousAccess() );
- // Enable Change Password
- enableChangePasswordCheckbox.setSelection( configuration.isEnableChangePassword() );
+ // Enable Access Control
+ enableAccesControlCheckbox.setSelection( configuration.isEnableAccessControl() );
// Denormalize Op Attr
denormalizeOpAttrCheckbox.setSelection( configuration.isDenormalizeOpAttr() );
@@ -551,25 +715,94 @@
}
};
- portText.addModifyListener( modifyListener );
- authenticationCombo.addModifyListener( modifyListener );
+ selectAllSupportedMechanismsButton.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ supportedMechanismsTableViewer.setAllChecked( true );
+ }
+ } );
+
+ deselectAllSupportedMechanismsButton.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ supportedMechanismsTableViewer.setAllChecked( false );
+ }
+ } );
+
principalText.addModifyListener( modifyListener );
passwordText.addModifyListener( modifyListener );
- allowAnonymousAccessCheckbox.addSelectionListener( selectionListener );
- maxTimeLimitText.addModifyListener( modifyListener );
- maxSizeLimitText.addModifyListener( modifyListener );
- synchPeriodText.addModifyListener( modifyListener );
- maxThreadsText.addModifyListener( modifyListener );
- enableAccesControlCheckbox.addSelectionListener( selectionListener );
- enableNTPCheckbox.addSelectionListener( selectionListener );
+
+ enableLdapCheckbox.addSelectionListener( selectionListener );
+ enableLdapCheckbox.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ ldapPortText.setEnabled( enableLdapCheckbox.getSelection() );
+ }
+ } );
+ ldapPortText.addModifyListener( modifyListener );
+ enableLdapsCheckbox.addSelectionListener( selectionListener );
+ enableLdapsCheckbox.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ ldapsPortText.setEnabled( enableLdapsCheckbox.getSelection() );
+ }
+ } );
+ ldapsPortText.addModifyListener( modifyListener );
enableKerberosCheckbox.addSelectionListener( selectionListener );
+ enableKerberosCheckbox.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ kerberosPortText.setEnabled( enableKerberosCheckbox.getSelection() );
+ }
+ } );
+ kerberosPortText.addModifyListener( modifyListener );
+ enableNtpCheckbox.addSelectionListener( selectionListener );
+ enableNtpCheckbox.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ ntpPortText.setEnabled( enableNtpCheckbox.getSelection() );
+ }
+ } );
+ ntpPortText.addModifyListener( modifyListener );
+ enableDnsCheckbox.addSelectionListener( selectionListener );
+ enableDnsCheckbox.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ dnsPortText.setEnabled( enableDnsCheckbox.getSelection() );
+ }
+ } );
+ dnsPortText.addModifyListener( modifyListener );
enableChangePasswordCheckbox.addSelectionListener( selectionListener );
- denormalizeOpAttrCheckbox.addSelectionListener( selectionListener );
+ enableChangePasswordCheckbox.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ changePasswordPortText.setEnabled( enableChangePasswordCheckbox.getSelection() );
+ }
+ } );
+ changePasswordPortText.addModifyListener( modifyListener );
+
binaryAttributesTableViewer.addSelectionChangedListener( binaryAttributesTableViewerListener );
binaryAttributesTableViewer.addDoubleClickListener( binaryAttributesTableViewerDoubleClickListener );
binaryAttributesAddButton.addSelectionListener( binaryAttributesAddButtonListener );
binaryAttributesEditButton.addSelectionListener( binaryAttributesEditButtonListener );
binaryAttributesDeleteButton.addSelectionListener( binaryAttributesDeleteButtonListener );
+
+ maxTimeLimitText.addModifyListener( modifyListener );
+ maxSizeLimitText.addModifyListener( modifyListener );
+ synchPeriodText.addModifyListener( modifyListener );
+ maxThreadsText.addModifyListener( modifyListener );
+
+ allowAnonymousAccessCheckbox.addSelectionListener( selectionListener );
+ enableAccesControlCheckbox.addSelectionListener( selectionListener );
+ denormalizeOpAttrCheckbox.addSelectionListener( selectionListener );
}
@@ -614,23 +847,39 @@
/**
* Saves the necessary elements to the input model.
*/
+ @SuppressWarnings("unchecked")
public void save()
{
- ServerConfiguration serverConfiguration = ( ( ServerConfigurationEditorInput ) getEditorInput() )
- .getServerConfiguration();
+ ServerConfiguration configuration = ( ( ServerConfigurationEditor ) getEditor() ).getServerConfiguration();
+
+ configuration.setPrincipal( principalText.getText() );
+ configuration.setPassword( passwordText.getText() );
+
+ configuration.setBinaryAttributes( binaryAttributes );
+
+ configuration.setLdapPort( Integer.parseInt( ldapPortText.getText() ) );
+ configuration.setEnableLdaps( enableLdapsCheckbox.getSelection() );
+ configuration.setLdapsPort( Integer.parseInt( ldapsPortText.getText() ) );
+ configuration.setEnableKerberos( enableKerberosCheckbox.getSelection() );
+ configuration.setKerberosPort( Integer.parseInt( kerberosPortText.getText() ) );
+ configuration.setEnableNtp( enableNtpCheckbox.getSelection() );
+ configuration.setNtpPort( Integer.parseInt( ntpPortText.getText() ) );
+ configuration.setEnableDns( enableDnsCheckbox.getSelection() );
+ configuration.setDnsPort( Integer.parseInt( dnsPortText.getText() ) );
+ configuration.setEnableChangePassword( enableChangePasswordCheckbox.getSelection() );
+ configuration.setChangePasswordPort( Integer.parseInt( changePasswordPortText.getText() ) );
+
+ configuration.setMaxTimeLimit( Integer.parseInt( maxTimeLimitText.getText() ) );
+ configuration.setMaxSizeLimit( Integer.parseInt( maxSizeLimitText.getText() ) );
+ configuration.setSynchronizationPeriod( Long.parseLong( synchPeriodText.getText() ) );
+ configuration.setMaxThreads( Integer.parseInt( maxThreadsText.getText() ) );
+
+ configuration.setSupportedMechanisms( new ArrayList<String>( ( Collection<? extends String> ) Arrays
+ .asList( supportedMechanismsTableViewer.getCheckedElements() ) ) );
+
+ configuration.setAllowAnonymousAccess( allowAnonymousAccessCheckbox.getSelection() );
+ configuration.setEnableAccessControl( enableAccesControlCheckbox.getSelection() );
+ configuration.setDenormalizeOpAttr( denormalizeOpAttrCheckbox.getSelection() );
- serverConfiguration.setPort( Integer.parseInt( portText.getText() ) );
- serverConfiguration.setPrincipal( principalText.getText() );
- serverConfiguration.setPassword( passwordText.getText() );
- serverConfiguration.setAllowAnonymousAccess( allowAnonymousAccessCheckbox.getSelection() );
- serverConfiguration.setMaxTimeLimit( Integer.parseInt( maxTimeLimitText.getText() ) );
- serverConfiguration.setMaxSizeLimit( Integer.parseInt( maxSizeLimitText.getText() ) );
- serverConfiguration.setSynchronizationPeriod( Long.parseLong( synchPeriodText.getText() ) );
- serverConfiguration.setMaxThreads( Integer.parseInt( maxThreadsText.getText() ) );
- serverConfiguration.setEnableAccessControl( enableAccesControlCheckbox.getSelection() );
- serverConfiguration.setEnableNTP( enableNTPCheckbox.getSelection() );
- serverConfiguration.setEnableKerberos( enableKerberosCheckbox.getSelection() );
- serverConfiguration.setEnableChangePassword( enableChangePasswordCheckbox.getSelection() );
- serverConfiguration.setDenormalizeOpAttr( denormalizeOpAttrCheckbox.getSelection() );
}
}
Modified: directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/InterceptorsMasterDetailsBlock.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/InterceptorsMasterDetailsBlock.java?rev=595708&r1=595707&r2=595708&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/InterceptorsMasterDetailsBlock.java (original)
+++ directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/InterceptorsMasterDetailsBlock.java Fri Nov 16 07:45:41 2007
@@ -91,7 +91,7 @@
public InterceptorsMasterDetailsBlock( FormPage page )
{
this.page = page;
- serverConfiguration = ( ( ServerConfigurationEditorInput ) page.getEditorInput() ).getServerConfiguration();
+ serverConfiguration = ( ( ServerConfigurationEditor ) page.getEditor() ).getServerConfiguration();
interceptors = serverConfiguration.getInterceptors();
}
Modified: directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/PartitionDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/PartitionDetailsPage.java?rev=595708&r1=595707&r2=595708&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/PartitionDetailsPage.java (original)
+++ directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/PartitionDetailsPage.java Fri Nov 16 07:45:41 2007
@@ -101,7 +101,7 @@
private boolean dirty = false;
// UI fields
- private Text nameText;
+ private Text idText;
private Text cacheSizeText;
private Text suffixText;
private Button enableOptimizerCheckbox;
@@ -333,10 +333,10 @@
client.setLayout( glayout );
section.setClient( client );
- // Name
- toolkit.createLabel( client, "Name:" );
- nameText = toolkit.createText( client, "" );
- nameText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
+ // ID
+ toolkit.createLabel( client, "ID:" );
+ idText = toolkit.createText( client, "" );
+ idText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
// Cache Size
toolkit.createLabel( client, "Cache Size:" );
@@ -551,7 +551,7 @@
*/
private void addListeners()
{
- nameText.addModifyListener( textModifyListener );
+ idText.addModifyListener( textModifyListener );
cacheSizeText.addModifyListener( textModifyListener );
suffixText.addModifyListener( textModifyListener );
enableOptimizerCheckbox.addSelectionListener( checkboxSelectionListener );
@@ -576,7 +576,7 @@
*/
private void removeListeners()
{
- nameText.removeModifyListener( textModifyListener );
+ idText.removeModifyListener( textModifyListener );
cacheSizeText.removeModifyListener( textModifyListener );
suffixText.removeModifyListener( textModifyListener );
enableOptimizerCheckbox.removeSelectionListener( checkboxSelectionListener );
@@ -621,7 +621,7 @@
{
if ( input != null )
{
- input.setName( nameText.getText() );
+ input.setId( idText.getText() );
input.setCacheSize( Integer.parseInt( cacheSizeText.getText() ) );
input.setSuffix( suffixText.getText() );
input.setEnableOptimizer( enableOptimizerCheckbox.getSelection() );
@@ -672,9 +672,9 @@
{
removeListeners();
- // Name
- String name = input.getName();
- nameText.setText( ( name == null ) ? "" : name );
+ // ID
+ String id = input.getId();
+ idText.setText( ( id == null ) ? "" : id );
// Cache Size
cacheSizeText.setText( "" + input.getCacheSize() );
@@ -721,7 +721,7 @@
*/
public void setFocus()
{
- nameText.setFocus();
+ idText.setFocus();
}
Modified: directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/PartitionsMasterDetailsBlock.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/PartitionsMasterDetailsBlock.java?rev=595708&r1=595707&r2=595708&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/PartitionsMasterDetailsBlock.java (original)
+++ directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/PartitionsMasterDetailsBlock.java Fri Nov 16 07:45:41 2007
@@ -73,7 +73,7 @@
/** The Details Page */
private PartitionDetailsPage detailsPage;
- private static final String NEW_NAME = "New Partition ";
+ private static final String NEW_ID = "New Partition ";
// UI Fields
private TableViewer viewer;
@@ -90,7 +90,7 @@
public PartitionsMasterDetailsBlock( FormPage page )
{
this.page = page;
- serverConfiguration = ( ( ServerConfigurationEditorInput ) page.getEditorInput() ).getServerConfiguration();
+ serverConfiguration = ( ( ServerConfigurationEditor ) page.getEditor() ).getServerConfiguration();
partitions = serverConfiguration.getPartitions();
}
@@ -196,7 +196,7 @@
{
public void widgetSelected( SelectionEvent e )
{
- Partition newPartition = new Partition( getNewName() );
+ Partition newPartition = new Partition( getNewId() );
partitions.add( newPartition );
viewer.refresh();
viewer.setSelection( new StructuredSelection( newPartition ) );
@@ -225,25 +225,25 @@
/**
- * Gets a new Name for a new Extended Operation.
+ * Gets a new ID for a new Partition.
*
* @return
- * a new Name for a new Extended Operation
+ * a new ID for a new Partition
*/
- private String getNewName()
+ private String getNewId()
{
int counter = 1;
- String name = NEW_NAME;
+ String name = NEW_ID;
boolean ok = false;
while ( !ok )
{
ok = true;
- name = NEW_NAME + counter;
+ name = NEW_ID + counter;
for ( Partition partition : partitions )
{
- if ( partition.getName().equalsIgnoreCase( name ) )
+ if ( partition.getId().equalsIgnoreCase( name ) )
{
ok = false;
}
Modified: directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java?rev=595708&r1=595707&r2=595708&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java (original)
+++ directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java Fri Nov 16 07:45:41 2007
@@ -20,10 +20,17 @@
package org.apache.directory.studio.apacheds.configuration.editor;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+
import org.apache.directory.studio.apacheds.configuration.Activator;
import org.apache.directory.studio.apacheds.configuration.model.ServerConfiguration;
+import org.apache.directory.studio.apacheds.configuration.model.ServerConfigurationParser;
+import org.apache.directory.studio.apacheds.configuration.model.ServerConfigurationParserException;
import org.apache.directory.studio.apacheds.configuration.model.ServerConfigurationWriter;
import org.apache.directory.studio.apacheds.configuration.model.ServerConfigurationWriterException;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.swt.SWT;
@@ -31,9 +38,12 @@
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.SaveAsDialog;
import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.part.FileEditorInput;
/**
@@ -47,9 +57,6 @@
/** The Editor ID */
public static final String ID = "org.apache.directory.studio.apacheds.configuration.editor";
- /** The editor input */
- private IEditorInput input;
-
/** The Server Configuration */
private ServerConfiguration serverConfiguration;
@@ -69,10 +76,97 @@
public void init( IEditorSite site, IEditorInput input ) throws PartInitException
{
super.init( site, input );
- this.input = input;
setPartName( input.getName() );
- serverConfiguration = ( ( ServerConfigurationEditorInput ) input ).getServerConfiguration();
- dirty = serverConfiguration.getPath() == null;
+
+ if ( input instanceof FileEditorInput )
+ {
+ FileEditorInput fei = ( FileEditorInput ) input;
+
+ try
+ {
+ ServerConfigurationParser parser = new ServerConfigurationParser();
+ serverConfiguration = parser.parse( fei.getFile().getContents() );
+ serverConfiguration.setPath( fei.getFile().getFullPath().toOSString() );
+ }
+ catch ( ServerConfigurationParserException e )
+ {
+ MessageBox messageBox = new MessageBox(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.ICON_ERROR );
+ messageBox.setText( "Error!" );
+ messageBox.setMessage( "An error occurred when reading the file." + "\n" + e.getMessage() );
+ messageBox.open();
+ return;
+ }
+ catch ( CoreException e )
+ {
+ MessageBox messageBox = new MessageBox(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.ICON_ERROR );
+ messageBox.setText( "Error!" );
+ messageBox.setMessage( "An error occurred when reading the file." + "\n" + e.getMessage() );
+ messageBox.open();
+ return;
+ }
+ }
+ else if ( input instanceof IPathEditorInput )
+ {
+ IPathEditorInput ipei = ( IPathEditorInput ) input;
+ try
+ {
+ ServerConfigurationParser parser = new ServerConfigurationParser();
+ serverConfiguration = parser.parse( new FileInputStream( new File( ipei.getPath().toOSString() ) ) );
+ serverConfiguration.setPath( ipei.getPath().toOSString() );
+ }
+ catch ( ServerConfigurationParserException e )
+ {
+ MessageBox messageBox = new MessageBox(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.ICON_ERROR );
+ messageBox.setText( "Error!" );
+ messageBox.setMessage( "An error occurred when reading the file." + "\n" + e.getMessage() );
+ messageBox.open();
+ return;
+ }
+ catch ( FileNotFoundException e )
+ {
+ MessageBox messageBox = new MessageBox(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.ICON_ERROR );
+ messageBox.setText( "Error!" );
+ messageBox.setMessage( "An error occurred when reading the file." + "\n" + e.getMessage() );
+ messageBox.open();
+ return;
+ }
+ }
+ else if ( input instanceof ServerConfigurationEditorInput )
+ {
+ serverConfiguration = ( ( ServerConfigurationEditorInput ) input ).getServerConfiguration();
+ dirty = true;
+ }
+ else
+ {
+ try
+ {
+ ServerConfigurationParser parser = new ServerConfigurationParser();
+ serverConfiguration = parser.parse( new FileInputStream( new File( input.getToolTipText() ) ) );
+ serverConfiguration.setPath( input.getToolTipText() );
+ }
+ catch ( ServerConfigurationParserException e )
+ {
+ MessageBox messageBox = new MessageBox(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.ICON_ERROR );
+ messageBox.setText( "Error!" );
+ messageBox.setMessage( "An error occurred when reading the file." + "\n" + e.getMessage() );
+ messageBox.open();
+ return;
+ }
+ catch ( FileNotFoundException e )
+ {
+ MessageBox messageBox = new MessageBox(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OK | SWT.ICON_ERROR );
+ messageBox.setText( "Error!" );
+ messageBox.setMessage( "An error occurred when reading the file." + "\n" + e.getMessage() );
+ messageBox.open();
+ return;
+ }
+ }
}
@@ -138,7 +232,7 @@
// TODO Add the overwrite code...
serverConfiguration.setPath( selectedFile );
- setTitleToolTip( input.getToolTipText() );
+ setTitleToolTip( getEditorInput().getToolTipText() );
}
// Saving the ServerConfiguration to disk
@@ -170,6 +264,10 @@
*/
public void doSaveAs()
{
+ SaveAsDialog dialog = new SaveAsDialog( Activator.getDefault().getWorkbench().getActiveWorkbenchWindow()
+ .getShell() );
+ dialog.setOriginalName( "Copy of" );
+ dialog.open();
}
@@ -178,7 +276,7 @@
*/
public boolean isSaveAsAllowed()
{
- return false;
+ return true;
}
@@ -201,5 +299,17 @@
{
this.dirty = dirty;
editorDirtyStateChanged();
+ }
+
+
+ /**
+ * Gets the Server Configuration.
+ *
+ * @return
+ * the Server Configuration
+ */
+ public ServerConfiguration getServerConfiguration()
+ {
+ return serverConfiguration;
}
}
Modified: directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditorInput.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditorInput.java?rev=595708&r1=595707&r2=595708&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditorInput.java (original)
+++ directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditorInput.java Fri Nov 16 07:45:41 2007
@@ -76,7 +76,6 @@
{
return path;
}
-
}
@@ -119,6 +118,7 @@
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
+ @SuppressWarnings("unchecked")
public Object getAdapter( Class adapter )
{
return null;
@@ -130,10 +130,14 @@
*/
public boolean equals( Object obj )
{
+ if ( obj == null )
+ {
+ return false;
+ }
+
if ( obj instanceof ServerConfigurationEditorInput )
{
ServerConfigurationEditorInput input = ( ServerConfigurationEditorInput ) obj;
-
if ( input.exists() && exists() )
{
String inputPath = input.getServerConfiguration().getPath();
@@ -145,6 +149,7 @@
}
}
}
+
return false;
}
}
Modified: directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/Partition.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/Partition.java?rev=595708&r1=595707&r2=595708&view=diff
==============================================================================
--- directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/Partition.java (original)
+++ directory/studio/trunk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/Partition.java Fri Nov 16 07:45:41 2007
@@ -35,8 +35,8 @@
*/
public class Partition
{
- /** The name of the partition */
- private String name;
+ /** The ID of the partition */
+ private String id;
/** The cache size of the partition */
private int cacheSize;
@@ -80,31 +80,31 @@
{
indexedAttributes = new ArrayList<IndexedAttribute>();
contextEntry = new BasicAttributes( true );
- this.name = name;
+ this.id = name;
}
/**
- * Gets the name of the partition.
+ * Gets the ID of the partition.
*
* @return
- * the name of the partition
+ * the ID of the partition
*/
- public String getName()
+ public String getId()
{
- return this.name;
+ return this.id;
}
/**
- * Sets the name of the partition.
+ * Sets the ID of the partition.
*
- * @param name
- * the new name to set
+ * @param id
+ * the new ID to set
*/
- public void setName( String name )
+ public void setId( String id )
{
- this.name = name;
+ this.id = id;
}
@@ -309,6 +309,6 @@
*/
public String toString()
{
- return name;
+ return id;
}
}