You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by fe...@apache.org on 2007/11/05 15:32:32 UTC
svn commit: r592014 [3/6] - in /directory/sandbox/felixk:
studio-apacheds-configuration-feature/
studio-apacheds-configuration-feature/META-INF/
studio-apacheds-configuration-help/
studio-apacheds-configuration-help/META-INF/ studio-apacheds-configurat...
Added: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/PluginConstants.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/PluginConstants.java?rev=592014&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/PluginConstants.java (added)
+++ directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/PluginConstants.java Mon Nov 5 06:32:20 2007
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+
+/**
+ * This interface contains all the Constants used in the Plugin.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface PluginConstants
+{
+ // Images
+ public static final String IMG_VERTICAL_ORIENTATION = "resources/icons/vertical_orientation.gif";
+ public static final String IMG_HORIZONTAL_ORIENTATION = "resources/icons/horizontal_orientation.gif";
+ public static final String IMG_PARTITION = "resources/icons/partition.gif";
+ public static final String IMG_PARTITION_SYSTEM = "resources/icons/partition_system.gif";
+ public static final String IMG_INTERCEPTOR = "resources/icons/interceptor.gif";
+ public static final String IMG_EXTENDED_OPERATION = "resources/icons/extended_operation.gif";
+}
Propchange: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/PluginConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/actions/NewServerConfigurationAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/actions/NewServerConfigurationAction.java?rev=592014&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/actions/NewServerConfigurationAction.java (added)
+++ directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/actions/NewServerConfigurationAction.java Mon Nov 5 06:32:20 2007
@@ -0,0 +1,108 @@
+/*
+ * 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.actions;
+
+
+import org.apache.directory.studio.apacheds.configuration.Activator;
+import org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditor;
+import org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditorInput;
+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.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This class implements the New Server Configuration Action.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NewServerConfigurationAction extends Action implements IWorkbenchWindowActionDelegate
+{
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run( IAction action )
+ {
+ ServerConfigurationParser parser = new ServerConfigurationParser();
+ ServerConfiguration serverConfiguration = null;
+
+ try
+ {
+ serverConfiguration = parser.parse( Activator.class.getResourceAsStream( "default-server.xml" ) );
+ }
+ 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;
+ }
+
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try
+ {
+ page.openEditor( new ServerConfigurationEditorInput( serverConfiguration ), ServerConfigurationEditor.ID );
+ }
+ catch ( PartInitException e )
+ {
+ Activator.getDefault().getLog().log(
+ new Status( Status.ERROR, Activator.PLUGIN_ID, Status.OK, e.getMessage(), e.getCause() ) );
+ return;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged( IAction action, ISelection selection )
+ {
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+ */
+ public void dispose()
+ {
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+ */
+ public void init( IWorkbenchWindow window )
+ {
+ }
+}
Propchange: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/actions/NewServerConfigurationAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/actions/OpenServerConfigurationAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/actions/OpenServerConfigurationAction.java?rev=592014&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/actions/OpenServerConfigurationAction.java (added)
+++ directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/actions/OpenServerConfigurationAction.java Mon Nov 5 06:32:20 2007
@@ -0,0 +1,122 @@
+/*
+ * 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.actions;
+
+
+import org.apache.directory.studio.apacheds.configuration.Activator;
+import org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditor;
+import org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditorInput;
+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.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This class implements the Open Editor Action.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class OpenServerConfigurationAction extends Action implements IWorkbenchWindowActionDelegate
+{
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run( IAction action )
+ {
+ FileDialog fd = new FileDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OPEN );
+ fd.setText( "Select a file" );
+ fd.setFilterExtensions( new String[]
+ { "*.xml", "*.*" } );
+ fd.setFilterNames( new String[]
+ { "XML files", "All files" } );
+ String selectedFile = fd.open();
+ // selected == null if 'cancel' has been pushed
+ if ( selectedFile == null || "".equals( selectedFile ) )
+ {
+ return;
+ }
+
+ ServerConfigurationParser parser = new ServerConfigurationParser();
+ ServerConfiguration serverConfiguration = null;
+
+ try
+ {
+ serverConfiguration = parser.parse( selectedFile );
+ }
+ 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;
+ }
+
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try
+ {
+ page.openEditor( new ServerConfigurationEditorInput( serverConfiguration ), ServerConfigurationEditor.ID );
+ }
+ catch ( PartInitException e )
+ {
+ Activator.getDefault().getLog().log(
+ new Status( Status.ERROR, Activator.PLUGIN_ID, Status.OK, e.getMessage(), e.getCause() ) );
+ return;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged( IAction action, ISelection selection )
+ {
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+ */
+ public void dispose()
+ {
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+ */
+ public void init( IWorkbenchWindow window )
+ {
+ }
+}
Propchange: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/actions/OpenServerConfigurationAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/AttributeValueDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/AttributeValueDialog.java?rev=592014&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/AttributeValueDialog.java (added)
+++ directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/AttributeValueDialog.java Mon Nov 5 06:32:20 2007
@@ -0,0 +1,176 @@
+/*
+ * 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.dialogs;
+
+
+import org.apache.directory.studio.apacheds.configuration.editor.AttributeValueObject;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This class implements the Dialog for Attribute Value.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AttributeValueDialog extends Dialog
+{
+ /** The Attribute Value Object */
+ private AttributeValueObject attributeValueObject;
+
+ /** The dirty flag */
+ private boolean dirty = false;
+
+ // UI Fields
+ private Text attributeText;
+ private Text valueText;
+
+
+ /**
+ * Creates a new instance of AttributeValueDialog.
+ */
+ public AttributeValueDialog( AttributeValueObject attributeValueObject )
+ {
+ super( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() );
+ this.attributeValueObject = attributeValueObject;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ protected void configureShell( Shell newShell )
+ {
+ super.configureShell( newShell );
+ newShell.setText( "Attribute Value Dialog" );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea( Composite parent )
+ {
+ Composite composite = new Composite( parent, SWT.NONE );
+ GridLayout layout = new GridLayout( 2, false );
+ composite.setLayout( layout );
+ composite.setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, true ) );
+
+ Label attributeLabel = new Label( composite, SWT.NONE );
+ attributeLabel.setText( "Attribute:" );
+
+ attributeText = new Text( composite, SWT.BORDER );
+ attributeText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+ Label valueLabel = new Label( composite, SWT.NONE );
+ valueLabel.setText( "Value:" );
+
+ valueText = new Text( composite, SWT.BORDER );
+ valueText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+ initFromInput();
+ addListeners();
+
+ return composite;
+ }
+
+
+ /**
+ * Initializes the UI from the input.
+ */
+ private void initFromInput()
+ {
+ String attribute = attributeValueObject.getAttribute();
+ attributeText.setText( ( attribute == null ) ? "" : attribute );
+
+ Object value = attributeValueObject.getValue();
+ valueText.setText( ( value == null ) ? "" : value.toString() );
+ }
+
+
+ /**
+ * Adds listeners to the UI Fields.
+ */
+ private void addListeners()
+ {
+ attributeText.addModifyListener( new ModifyListener()
+ {
+ public void modifyText( ModifyEvent e )
+ {
+ dirty = true;
+ }
+ } );
+
+ valueText.addModifyListener( new ModifyListener()
+ {
+ public void modifyText( ModifyEvent e )
+ {
+ dirty = true;
+ }
+ } );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ protected void okPressed()
+ {
+ attributeValueObject.setId( attributeText.getText() );
+ attributeValueObject.setValue( valueText.getText() );
+
+ super.okPressed();
+ }
+
+
+ /**
+ * Gets the Attribute Value Object.
+ *
+ * @return
+ * the Attribute Value Object
+ */
+ public AttributeValueObject getAttributeValueObject()
+ {
+ return attributeValueObject;
+ }
+
+
+ /**
+ * Returns the dirty flag of the dialog.
+ *
+ * @return
+ * the dirty flag of the dialog
+ */
+ public boolean isDirty()
+ {
+ return dirty;
+ }
+}
Propchange: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/AttributeValueDialog.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/BinaryAttributeDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/BinaryAttributeDialog.java?rev=592014&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/BinaryAttributeDialog.java (added)
+++ directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/BinaryAttributeDialog.java Mon Nov 5 06:32:20 2007
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.apacheds.configuration.dialogs;
+
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This class implements the Dialog for Binary Attribute.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BinaryAttributeDialog extends Dialog
+{
+ /** The initial value */
+ private String initialValue;
+
+ /** The return value */
+ private String returnValue;
+
+ /** The dirty flag */
+ private boolean dirty = false;
+
+ // UI Fields
+ private Text attributeText;
+
+
+ /**
+ * Creates a new instance of AttributeValueDialog.
+ */
+ public BinaryAttributeDialog( String initialValue )
+ {
+ super( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() );
+ this.initialValue = initialValue;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ protected void configureShell( Shell newShell )
+ {
+ super.configureShell( newShell );
+ newShell.setText( "Binary Attribute Dialog" );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea( Composite parent )
+ {
+ Composite composite = new Composite( parent, SWT.NONE );
+ GridLayout layout = new GridLayout( 2, false );
+ composite.setLayout( layout );
+ composite.setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, true ) );
+
+ Label attributeLabel = new Label( composite, SWT.NONE );
+ attributeLabel.setText( "Attribute:" );
+
+ attributeText = new Text( composite, SWT.BORDER );
+ attributeText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+ initFromInput();
+ addListeners();
+
+ return composite;
+ }
+
+
+ /**
+ * Initializes the UI from the input.
+ */
+ private void initFromInput()
+ {
+ attributeText.setText( ( initialValue == null ) ? "" : initialValue );
+ }
+
+
+ /**
+ * Adds listeners to the UI Fields.
+ */
+ private void addListeners()
+ {
+ attributeText.addModifyListener( new ModifyListener()
+ {
+ public void modifyText( ModifyEvent e )
+ {
+ dirty = true;
+ }
+ } );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ protected void okPressed()
+ {
+ returnValue = attributeText.getText();
+
+ super.okPressed();
+ }
+
+
+ /**
+ * Gets the Attribute.
+ *
+ * @return
+ * the Attribute
+ */
+ public String getAttribute()
+ {
+ return returnValue;
+ }
+
+
+ /**
+ * Returns the dirty flag of the dialog.
+ *
+ * @return
+ * the dirty flag of the dialog
+ */
+ public boolean isDirty()
+ {
+ return dirty;
+ }
+}
Propchange: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/BinaryAttributeDialog.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/IndexedAttributeDialog.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/IndexedAttributeDialog.java?rev=592014&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/IndexedAttributeDialog.java (added)
+++ directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/IndexedAttributeDialog.java Mon Nov 5 06:32:20 2007
@@ -0,0 +1,193 @@
+/*
+ * 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.dialogs;
+
+
+import org.apache.directory.studio.apacheds.configuration.model.IndexedAttribute;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This class implements the Dialog for Indexed Attribute.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class IndexedAttributeDialog extends Dialog
+{
+ /** The Indexed Attribute */
+ private IndexedAttribute indexedAttribute;
+
+ /** The dirty flag */
+ private boolean dirty = false;
+
+ // UI Fields
+ private Text attributeIdText;
+ private Text cacheSizeText;
+
+
+ /**
+ * Creates a new instance of IndexedAttributeDialog.
+ */
+ public IndexedAttributeDialog( IndexedAttribute indexedAttribute )
+ {
+ super( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() );
+ this.indexedAttribute = indexedAttribute;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ protected void configureShell( Shell newShell )
+ {
+ super.configureShell( newShell );
+ newShell.setText( "Indexed Attribute Dialog" );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea( Composite parent )
+ {
+ Composite composite = new Composite( parent, SWT.NONE );
+ GridLayout layout = new GridLayout( 2, false );
+ composite.setLayout( layout );
+ composite.setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, true ) );
+
+ Label attributeIdLabel = new Label( composite, SWT.NONE );
+ attributeIdLabel.setText( "Attribute ID:" );
+
+ attributeIdText = new Text( composite, SWT.BORDER );
+ attributeIdText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+ Label cacheSizeLabel = new Label( composite, SWT.NONE );
+ cacheSizeLabel.setText( "Cache Size:" );
+
+ cacheSizeText = new Text( composite, SWT.BORDER );
+ cacheSizeText.addVerifyListener( new VerifyListener()
+ {
+ public void verifyText( VerifyEvent e )
+ {
+ if ( !e.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
+ {
+ e.doit = false;
+ }
+ }
+ } );
+ cacheSizeText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+ initFromInput();
+ addListeners();
+
+ return composite;
+ }
+
+
+ /**
+ * Initializes the UI from the input.
+ */
+ private void initFromInput()
+ {
+ String attributeId = indexedAttribute.getAttributeId();
+ attributeIdText.setText( ( attributeId == null ) ? "" : attributeId );
+ cacheSizeText.setText( "" + indexedAttribute.getCacheSize() );
+ }
+
+
+ /**
+ * Adds listeners to the UI Fields.
+ */
+ private void addListeners()
+ {
+ attributeIdText.addModifyListener( new ModifyListener()
+ {
+ public void modifyText( ModifyEvent e )
+ {
+ dirty = true;
+ }
+ } );
+
+ cacheSizeText.addModifyListener( new ModifyListener()
+ {
+ public void modifyText( ModifyEvent e )
+ {
+ dirty = true;
+ }
+ } );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ protected void okPressed()
+ {
+ indexedAttribute.setAttributeId( attributeIdText.getText() );
+ try
+ {
+ indexedAttribute.setCacheSize( Integer.parseInt( cacheSizeText.getText() ) );
+ }
+ catch ( NumberFormatException e )
+ {
+ // Nothing to do, it won't happen
+ }
+
+ super.okPressed();
+ }
+
+
+ /**
+ * Gets the Indexed Attribute.
+ *
+ * @return
+ * the Indexed Attribute
+ */
+ public IndexedAttribute getIndexedAttribute()
+ {
+ return indexedAttribute;
+ }
+
+
+ /**
+ * Returns the dirty flag of the dialog.
+ *
+ * @return
+ * the dirty flag of the dialog
+ */
+ public boolean isDirty()
+ {
+ return dirty;
+ }
+}
Propchange: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/IndexedAttributeDialog.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/AttributeValueObject.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/AttributeValueObject.java?rev=592014&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/AttributeValueObject.java (added)
+++ directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/AttributeValueObject.java Mon Nov 5 06:32:20 2007
@@ -0,0 +1,108 @@
+/*
+ * 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;
+
+
+/**
+ * This class implements an Attribute Value Object that is used in the PartitionDetailsPage.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AttributeValueObject
+{
+ /** The attribute */
+ private String attribute;
+
+ /** The value */
+ private Object value;
+
+
+ /**
+ * Creates a new instance of AttributeValueObject.
+ *
+ * @param attribute
+ * the attribute
+ * @param value
+ * the value
+ */
+ public AttributeValueObject( String attribute, Object value )
+ {
+ this.attribute = attribute;
+ this.value = value;
+ }
+
+
+ /**
+ * Gets the attribute.
+ *
+ * @return
+ * the attribute.
+ */
+ public String getAttribute()
+ {
+ return attribute;
+ }
+
+
+ /**
+ * Sets the attribute.
+ *
+ * @param attribute
+ * the new attribute
+ */
+ public void setId( String attribute )
+ {
+ this.attribute = attribute;
+ }
+
+
+ /**
+ * Gets the value.
+ *
+ * @return
+ * the value
+ */
+ public Object getValue()
+ {
+ return value;
+ }
+
+
+ /**
+ * Sets the value.
+ *
+ * @param value
+ * the new value
+ */
+ public void setValue( Object value )
+ {
+ this.value = value;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return "Attribute=\"" + attribute + "\", Value=\"" + value + "\"";
+ }
+}
Propchange: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/AttributeValueObject.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationDetailsPage.java?rev=592014&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationDetailsPage.java (added)
+++ directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationDetailsPage.java Mon Nov 5 06:32:20 2007
@@ -0,0 +1,250 @@
+/*
+ * 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;
+
+
+import org.apache.directory.studio.apacheds.configuration.model.ExtendedOperation;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+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>
+ * @version $Rev$, $Date$
+ */
+public class ExtendedOperationDetailsPage implements IDetailsPage
+{
+ /** The associated Master Details Block */
+ private ExtendedOperationsMasterDetailsBlock masterDetailsBlock;
+
+ /** The Managed Form */
+ private IManagedForm mform;
+
+ /** The input Interceptor */
+ private ExtendedOperation input;
+
+ /** The dirty flag */
+ private boolean dirty = false;
+
+ // UI fields
+ private Text classTypeText;
+
+ // Listeners
+ /** The Modify Listener for Text Widgets */
+ private ModifyListener textModifyListener = new ModifyListener()
+ {
+ public void modifyText( ModifyEvent e )
+ {
+ masterDetailsBlock.setEditorDirty();
+ dirty = true;
+ }
+ };
+
+
+ /**
+ * Creates a new instance of ExtendedOperationDetailsPage.
+ *
+ * @param emdb
+ * the associated Master Details Block
+ */
+ public ExtendedOperationDetailsPage( ExtendedOperationsMasterDetailsBlock emdb )
+ {
+ masterDetailsBlock = emdb;
+ }
+
+
+ /* (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.DESCRIPTION | Section.TITLE_BAR );
+ section.marginWidth = 10;
+ section.setText( "Extended Operation Details" ); //$NON-NLS-1$
+ section.setDescription( "Set the properties of the extended operation." ); //$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( 3, false );
+ client.setLayout( glayout );
+ section.setClient( client );
+
+ // Class
+ toolkit.createLabel( client, "Class:" );
+ classTypeText = toolkit.createText( client, "" );
+ classTypeText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
+
+ addListeners();
+ }
+
+
+ /**
+ * Adds listeners to UI fields.
+ */
+ private void addListeners()
+ {
+ classTypeText.addModifyListener( textModifyListener );
+ }
+
+
+ /**
+ * Removes listeners to UI fields.
+ */
+ private void removeListeners()
+ {
+ classTypeText.removeModifyListener( textModifyListener );
+ }
+
+
+ /* (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 = ( ExtendedOperation ) ssel.getFirstElement();
+ }
+ else
+ {
+ input = null;
+ }
+ refresh();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.forms.IFormPart#commit(boolean)
+ */
+ public void commit( boolean onSave )
+ {
+ if ( input != null )
+ {
+ input.setClassType( classTypeText.getText() );
+ }
+ }
+
+
+ /* (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()
+ {
+ removeListeners();
+
+ classTypeText.setText( input.getClassType() );
+
+ addListeners();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.forms.IFormPart#setFocus()
+ */
+ public void setFocus()
+ {
+ classTypeText.setFocus();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.forms.IFormPart#setFormInput(java.lang.Object)
+ */
+ public boolean setFormInput( Object input )
+ {
+ return false;
+ }
+}
Propchange: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationDetailsPage.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java?rev=592014&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java (added)
+++ directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java Mon Nov 5 06:32:20 2007
@@ -0,0 +1,309 @@
+/*
+ * 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;
+
+
+import java.util.List;
+
+import org.apache.directory.studio.apacheds.configuration.Activator;
+import org.apache.directory.studio.apacheds.configuration.PluginConstants;
+import org.apache.directory.studio.apacheds.configuration.model.ExtendedOperation;
+import org.apache.directory.studio.apacheds.configuration.model.ServerConfiguration;
+import org.eclipse.jface.action.Action;
+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;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * 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>
+ * @version $Rev$, $Date$
+ */
+public class ExtendedOperationsMasterDetailsBlock extends MasterDetailsBlock
+{
+ /** The associated page */
+ private FormPage page;
+
+ /** The input Server Configuration */
+ private ServerConfiguration serverConfiguration;
+
+ /** The Extended Operations List */
+ private List<ExtendedOperation> extendedOperations;
+
+ /** The Details Page */
+ private ExtendedOperationDetailsPage detailsPage;
+
+ private static final String NEW_NAME = "newExtendedOperation";
+
+ // 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 = ( ( ServerConfigurationEditorInput ) page.getEditorInput() ).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( "All Extended Operations" );
+ 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 );
+
+ // Creatig 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 AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_EXTENDED_OPERATION ).createImage();
+ }
+ } );
+
+ // Creating the button(s)
+ addButton = toolkit.createButton( client, "Add...", SWT.PUSH ); //$NON-NLS-1$
+ addButton.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, false, false ) );
+
+ deleteButton = toolkit.createButton( client, "Delete", SWT.PUSH );
+ 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 )
+ {
+ ExtendedOperation newExtendedOperation = new ExtendedOperation( getNewName() );
+ 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() )
+ {
+ ExtendedOperation extendedOperation = ( ExtendedOperation ) selection.getFirstElement();
+
+ extendedOperations.remove( extendedOperation );
+ viewer.refresh();
+ setEditorDirty();
+ }
+ }
+ } );
+ }
+
+
+ /**
+ * Gets a new Name for a new Extended Operation.
+ *
+ * @return
+ * a new Name for a new Extended Operation
+ */
+ private String getNewName()
+ {
+ int counter = 1;
+ String name = NEW_NAME;
+ boolean ok = false;
+
+ while ( !ok )
+ {
+ ok = true;
+ name = NEW_NAME + counter;
+
+ for ( ExtendedOperation extendedOperation : extendedOperations )
+ {
+ if ( extendedOperation.getClassType().equalsIgnoreCase( name ) )
+ {
+ ok = false;
+ }
+ }
+
+ counter++;
+ }
+
+ return name;
+ }
+
+
+ /* (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( Activator.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.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( Activator.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.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( this );
+ detailsPart.registerPage( ExtendedOperation.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 );
+ }
+}
Propchange: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationsPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationsPage.java?rev=592014&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationsPage.java (added)
+++ directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationsPage.java Mon Nov 5 06:32:20 2007
@@ -0,0 +1,81 @@
+/*
+ * 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;
+
+
+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>
+ * @version $Rev$, $Date$
+ */
+public class ExtendedOperationsPage extends FormPage
+{
+ /** The Page ID*/
+ public static final String ID = ServerConfigurationEditor.ID + ".ExtendedOperationsPage";
+
+ /** The Page Title */
+ private static final String TITLE = "Extended Operations";
+
+ /** 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 )
+ {
+ final ScrolledForm form = managedForm.getForm();
+ form.setText( "Extended Operations" );
+ masterDetailsBlock = new ExtendedOperationsMasterDetailsBlock( this );
+ masterDetailsBlock.createContent( managedForm );
+ }
+
+
+ /**
+ * Saves the necessary elements to the input model.
+ */
+ public void save()
+ {
+ if ( masterDetailsBlock != null )
+ {
+ masterDetailsBlock.save();
+ }
+ }
+}
Propchange: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ExtendedOperationsPage.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/GeneralPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/GeneralPage.java?rev=592014&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/GeneralPage.java (added)
+++ directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/GeneralPage.java Mon Nov 5 06:32:20 2007
@@ -0,0 +1,636 @@
+/*
+ * 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;
+
+
+import java.util.List;
+
+import org.apache.directory.studio.apacheds.configuration.dialogs.BinaryAttributeDialog;
+import org.apache.directory.studio.apacheds.configuration.model.ServerConfiguration;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+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;
+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.events.SelectionListener;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+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;
+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 General Page of the Server Configuration Editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class GeneralPage extends FormPage
+{
+ /** The Page ID*/
+ public static final String ID = ServerConfigurationEditor.ID + ".BasicPage";
+
+ /** The Page Title */
+ private static final String TITLE = "General";
+
+ /** The Binary Attribute List */
+ private List<String> binaryAttributes;
+
+ // UI Fields
+ private Text portText;
+ private Combo authenticationCombo;
+ private Text principalText;
+ private Text passwordText;
+ private Button showPasswordCheckbox;
+ private Button allowAnonymousAccessCheckbox;
+ private Text maxTimeLimitText;
+ private Text maxSizeLimitText;
+ private Text synchPeriodText;
+ private Text maxThreadsText;
+ private Button enableAccesControlCheckbox;
+ private Button enableNTPCheckbox;
+ private Button enableKerberosCheckbox;
+ private Button enableChangePasswordCheckbox;
+ private Button denormalizeOpAttrCheckbox;
+ private TableViewer binaryAttributesTableViewer;
+ private Button binaryAttributesAddButton;
+ private Button binaryAttributesEditButton;
+ private Button binaryAttributesDeleteButton;
+
+
+ /**
+ * Creates a new instance of GeneralPage.
+ *
+ * @param editor
+ * the associated editor
+ */
+ public GeneralPage( 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 )
+ {
+ ScrolledForm form = managedForm.getForm();
+ form.setText( "General" );
+
+ Composite parent = form.getBody();
+ TableWrapLayout twl = new TableWrapLayout();
+ twl.numColumns = 2;
+ parent.setLayout( twl );
+ FormToolkit toolkit = managedForm.getToolkit();
+
+ createSettingsSection( parent, toolkit );
+ createBinaryAttributesSection( parent, toolkit );
+ createLimitsSection( parent, toolkit );
+ createOptionsSection( parent, toolkit );
+
+ initFromInput();
+ addListeners();
+ }
+
+
+ /**
+ * Creates the Settings Section.
+ *
+ * @param parent
+ * the parent composite
+ * @param toolkit
+ * the toolkit to use
+ */
+ private void createSettingsSection( 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 );
+ 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, "" );
+ principalText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+ // Password
+ toolkit.createLabel( client, "Password:" );
+ passwordText = toolkit.createText( client, "" );
+ passwordText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ passwordText.setEchoChar( '\u2022' );
+
+ // Show Password
+ toolkit.createLabel( client, "" );
+ showPasswordCheckbox = toolkit.createButton( client, "Show password", SWT.CHECK );
+ showPasswordCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ showPasswordCheckbox.setSelection( false );
+ showPasswordCheckbox.addSelectionListener( new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ if ( showPasswordCheckbox.getSelection() )
+ {
+ passwordText.setEchoChar( '\0' );
+ }
+ else
+ {
+ passwordText.setEchoChar( '\u2022' );
+ }
+ }
+ } );
+
+ // Allow Anonymous Access
+ allowAnonymousAccessCheckbox = toolkit.createButton( client, "Allow Anonymous Access", SWT.CHECK );
+ allowAnonymousAccessCheckbox.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
+ }
+
+
+ /**
+ * Creates the Limits Section
+ *
+ * @param parent
+ * the parent composite
+ * @param toolkit
+ * the toolkit to use
+ */
+ private void createLimitsSection( Composite parent, FormToolkit toolkit )
+ {
+ // Creation of the section
+ Section section = toolkit.createSection( parent, Section.DESCRIPTION | 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 );
+ Composite client = toolkit.createComposite( section );
+ toolkit.paintBordersFor( client );
+ GridLayout glayout = new GridLayout( 2, false );
+ client.setLayout( glayout );
+ section.setClient( client );
+
+ // Max. Time Limit
+ toolkit.createLabel( client, "Max. Time Limit:" );
+ maxTimeLimitText = toolkit.createText( client, "" );
+ maxTimeLimitText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ maxTimeLimitText.addVerifyListener( new VerifyListener()
+ {
+ public void verifyText( VerifyEvent e )
+ {
+ if ( !e.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
+ {
+ e.doit = false;
+ }
+ }
+ } );
+
+ // Max. Size Limit
+ toolkit.createLabel( client, "Max. Size Limit:" );
+ maxSizeLimitText = toolkit.createText( client, "" );
+ maxSizeLimitText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ maxSizeLimitText.addVerifyListener( new VerifyListener()
+ {
+ public void verifyText( VerifyEvent e )
+ {
+ if ( !e.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
+ {
+ e.doit = false;
+ }
+ }
+ } );
+
+ // Synchronization Period
+ toolkit.createLabel( client, "Synchronization Period:" );
+ synchPeriodText = toolkit.createText( client, "" );
+ synchPeriodText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ synchPeriodText.addVerifyListener( new VerifyListener()
+ {
+ public void verifyText( VerifyEvent e )
+ {
+ if ( !e.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
+ {
+ e.doit = false;
+ }
+ }
+ } );
+
+ // Max. Threads
+ toolkit.createLabel( client, "Max. Threads:" );
+ maxThreadsText = toolkit.createText( client, "" );
+ maxThreadsText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ maxThreadsText.addVerifyListener( new VerifyListener()
+ {
+ public void verifyText( VerifyEvent e )
+ {
+ if ( !e.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
+ {
+ e.doit = false;
+ }
+ }
+ } );
+ }
+
+
+ /**
+ * Creates the Options Section
+ *
+ * @param parent
+ * the parent composite
+ * @param toolkit
+ * the toolkit to use
+ */
+ private void createOptionsSection( Composite parent, FormToolkit toolkit )
+ {
+ // Creation of the section
+ Section section = toolkit.createSection( parent, Section.DESCRIPTION | 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 );
+ Composite client = toolkit.createComposite( section );
+ toolkit.paintBordersFor( client );
+ GridLayout glayout = new GridLayout();
+ client.setLayout( glayout );
+ section.setClient( client );
+
+ // 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 ) );
+
+ // 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 );
+ }
+
+
+ /**
+ * Creates the Options Section
+ *
+ * @param parent
+ * the parent composite
+ * @param toolkit
+ * the toolkit to use
+ */
+ private void createBinaryAttributesSection( Composite parent, FormToolkit toolkit )
+ {
+ // Creation of the section
+ 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 );
+ Composite client = toolkit.createComposite( section );
+ toolkit.paintBordersFor( client );
+ GridLayout glayout = new GridLayout( 2, false );
+ client.setLayout( glayout );
+ section.setClient( client );
+
+ Table binaryAttributesTable = toolkit.createTable( client, SWT.NONE );
+ GridData gd = new GridData( SWT.FILL, SWT.NONE, true, false, 1, 3 );
+ gd.heightHint = 103;
+ 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;
+
+ binaryAttributesAddButton = toolkit.createButton( client, "Add...", SWT.PUSH );
+ binaryAttributesAddButton.setLayoutData( buttonsGD );
+
+ binaryAttributesEditButton = toolkit.createButton( client, "Edit...", SWT.PUSH );
+ binaryAttributesEditButton.setEnabled( false );
+ binaryAttributesEditButton.setLayoutData( buttonsGD );
+
+ binaryAttributesDeleteButton = toolkit.createButton( client, "Delete", SWT.PUSH );
+ binaryAttributesDeleteButton.setEnabled( false );
+ binaryAttributesDeleteButton.setLayoutData( buttonsGD );
+ }
+
+
+ /**
+ * Initializes the page with the Editor input.
+ */
+ private void initFromInput()
+ {
+ ServerConfiguration configuration = ( ( ServerConfigurationEditorInput ) getEditorInput() )
+ .getServerConfiguration();
+
+ binaryAttributes = configuration.getBinaryAttributes();
+ binaryAttributesTableViewer.setInput( binaryAttributes );
+
+ // Port
+ portText.setText( "" + configuration.getPort() );
+
+ // Principal
+ String principal = configuration.getPrincipal();
+ if ( principal != null )
+ {
+ principalText.setText( principal );
+ }
+
+ // Password
+ String password = configuration.getPassword();
+ if ( password != null )
+ {
+ passwordText.setText( password );
+ }
+
+ // Allow Anonymous Access
+ allowAnonymousAccessCheckbox.setSelection( configuration.isAllowAnonymousAccess() );
+
+ // Max Time Limit
+ maxTimeLimitText.setText( "" + configuration.getMaxTimeLimit() );
+
+ // Max Size Limit
+ maxSizeLimitText.setText( "" + configuration.getMaxSizeLimit() );
+
+ // Synchronization Period
+ synchPeriodText.setText( "" + configuration.getSynchronizationPeriod() );
+
+ // Max Threads
+ maxThreadsText.setText( "" + configuration.getMaxThreads() );
+
+ // Enable Access Control
+ enableAccesControlCheckbox.setSelection( configuration.isEnableAccessControl() );
+
+ // Enable NTP
+ enableNTPCheckbox.setSelection( configuration.isEnableNTP() );
+
+ // Enable Kerberos
+ enableKerberosCheckbox.setSelection( configuration.isEnableKerberos() );
+
+ // Enable Change Password
+ enableChangePasswordCheckbox.setSelection( configuration.isEnableChangePassword() );
+
+ // Denormalize Op Attr
+ denormalizeOpAttrCheckbox.setSelection( configuration.isDenormalizeOpAttr() );
+ }
+
+
+ /**
+ * Add listeners to UI fields.
+ */
+ private void addListeners()
+ {
+ // The Modify Listener
+ ModifyListener modifyListener = new ModifyListener()
+ {
+ public void modifyText( ModifyEvent e )
+ {
+ setEditorDirty();
+ }
+ };
+
+ // The Selection Listener
+ SelectionListener selectionListener = new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ setEditorDirty();
+ }
+ };
+
+ // The ISelectionChangedListener for the Binary Attributes Table
+ ISelectionChangedListener binaryAttributesTableViewerListener = new ISelectionChangedListener()
+ {
+ public void selectionChanged( SelectionChangedEvent event )
+ {
+ binaryAttributesEditButton.setEnabled( !event.getSelection().isEmpty() );
+ binaryAttributesDeleteButton.setEnabled( !event.getSelection().isEmpty() );
+ }
+ };
+
+ // The IDoubleClickListener for the Binary Attributes Table
+ IDoubleClickListener binaryAttributesTableViewerDoubleClickListener = new IDoubleClickListener()
+ {
+ public void doubleClick( DoubleClickEvent event )
+ {
+ editSelectedBinaryAttribute();
+ }
+ };
+
+ // The SelectionListener for the Binary Attributes Add Button
+ SelectionListener binaryAttributesAddButtonListener = new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ BinaryAttributeDialog dialog = new BinaryAttributeDialog( "" );
+ if ( Dialog.OK == dialog.open() && dialog.isDirty() )
+ {
+ String newAttribute = dialog.getAttribute();
+ if ( newAttribute != null && !"".equals( newAttribute )
+ && !binaryAttributes.contains( newAttribute ) )
+ {
+ binaryAttributes.add( newAttribute );
+
+ binaryAttributesTableViewer.refresh();
+ setEditorDirty();
+ }
+ }
+ }
+ };
+
+ // The SelectionListener for the Binary Attributes Edit Button
+ SelectionListener binaryAttributesEditButtonListener = new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ editSelectedBinaryAttribute();
+ }
+ };
+
+ // The SelectionListener for the Binary Attributes Delete Button
+ SelectionListener binaryAttributesDeleteButtonListener = new SelectionAdapter()
+ {
+ public void widgetSelected( SelectionEvent e )
+ {
+ StructuredSelection selection = ( StructuredSelection ) binaryAttributesTableViewer.getSelection();
+ if ( !selection.isEmpty() )
+ {
+ String attribute = ( String ) selection.getFirstElement();
+ binaryAttributes.remove( attribute );
+
+ binaryAttributesTableViewer.refresh();
+ setEditorDirty();
+ }
+ }
+ };
+
+ portText.addModifyListener( modifyListener );
+ authenticationCombo.addModifyListener( modifyListener );
+ 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 );
+ enableKerberosCheckbox.addSelectionListener( selectionListener );
+ enableChangePasswordCheckbox.addSelectionListener( selectionListener );
+ denormalizeOpAttrCheckbox.addSelectionListener( selectionListener );
+ binaryAttributesTableViewer.addSelectionChangedListener( binaryAttributesTableViewerListener );
+ binaryAttributesTableViewer.addDoubleClickListener( binaryAttributesTableViewerDoubleClickListener );
+ binaryAttributesAddButton.addSelectionListener( binaryAttributesAddButtonListener );
+ binaryAttributesEditButton.addSelectionListener( binaryAttributesEditButtonListener );
+ binaryAttributesDeleteButton.addSelectionListener( binaryAttributesDeleteButtonListener );
+ }
+
+
+ /**
+ * Opens a Binary Attribute Dialog with the selected Attribute Value Object in the
+ * Binary Attributes Table Viewer.
+ */
+ private void editSelectedBinaryAttribute()
+ {
+ StructuredSelection selection = ( StructuredSelection ) binaryAttributesTableViewer.getSelection();
+ if ( !selection.isEmpty() )
+ {
+ String oldAttribute = ( String ) selection.getFirstElement();
+
+ BinaryAttributeDialog dialog = new BinaryAttributeDialog( oldAttribute );
+ if ( Dialog.OK == dialog.open() && dialog.isDirty() )
+ {
+ binaryAttributes.remove( oldAttribute );
+
+ String newAttribute = dialog.getAttribute();
+ if ( newAttribute != null && !"".equals( newAttribute ) && !binaryAttributes.contains( newAttribute ) )
+ {
+ binaryAttributes.add( newAttribute );
+ }
+
+ binaryAttributesTableViewer.refresh();
+ setEditorDirty();
+ }
+ }
+ }
+
+
+ /**
+ * Sets the Editor as dirty.
+ */
+ private void setEditorDirty()
+ {
+ ( ( ServerConfigurationEditor ) getEditor() ).setDirty( true );
+ }
+
+
+ /**
+ * Saves the necessary elements to the input model.
+ */
+ public void save()
+ {
+ ServerConfiguration serverConfiguration = ( ( ServerConfigurationEditorInput ) getEditorInput() )
+ .getServerConfiguration();
+
+ 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() );
+ }
+}
Propchange: directory/sandbox/felixk/studio-apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/GeneralPage.java
------------------------------------------------------------------------------
svn:eol-style = native