directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1688927 - in /directory/studio/trunk/plugins: apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/ common.ui/ common.ui/src/main/java/org/apache/directory/studio/common/ui/ common.ui/src/main/jav...
Date Thu, 02 Jul 2015 23:21:40 GMT
Author: elecharny
Date: Thu Jul  2 23:21:40 2015
New Revision: 1688927

URL: http://svn.apache.org/r1688927
Log:
o Moved the AttributeDialog to the common-ui plugin

Added:
    directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/dialogs/
    directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/dialogs/AttributeDialog.java
Modified:
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/messages.properties
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/messages_de.properties
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/messages_fr.properties
    directory/studio/trunk/plugins/common.ui/pom-first.xml
    directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/TableDecorator.java
    directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/messages.properties
    directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/messages_de.properties
    directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/messages_fr.properties

Modified: directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/messages.properties?rev=1688927&r1=1688926&r2=1688927&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/messages.properties
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/messages.properties
Thu Jul  2 23:21:40 2015
@@ -15,9 +15,6 @@
 #  specific language governing permissions and limitations
 #  under the License.
 
-AttributeDialog.AttributeTypeOrOID=Attribute Type or OID:
-AttributeDialog.SelectAttributeTypeOrOID=Select Attribute Type or OID
-
 AttributeValueDialog.Attribute=Attribute:
 AttributeValueDialog.AttributeValueDialog=Attribute Value Dialog
 AttributeValueDialog.Value=Value:

Modified: directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/messages_de.properties?rev=1688927&r1=1688926&r2=1688927&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/messages_de.properties
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/messages_de.properties
Thu Jul  2 23:21:40 2015
@@ -15,9 +15,6 @@
 #  specific language governing permissions and limitations
 #  under the License.
 
-AttributeDialog.AttributeTypeOrOID=Attributtyp oder OID:
-AttributeDialog.SelectAttributeTypeOrOID=Attributtyp oder OID ausw\u00E4hlen
-
 AttributeValueDialog.Attribute=Attribut:
 AttributeValueDialog.AttributeValueDialog=Attribut Wert Dialog
 AttributeValueDialog.Value=Wert:

Modified: directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/messages_fr.properties?rev=1688927&r1=1688926&r2=1688927&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/messages_fr.properties
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/dialogs/messages_fr.properties
Thu Jul  2 23:21:40 2015
@@ -15,10 +15,6 @@
 #  specific language governing permissions and limitations
 #  under the License.
 
-AttributeDialog.AttributeTypeOrOID=Type d''attribut ou OID:
-AttributeDialog.SelectAttributeTypeOrOID=Selection d''un type d''attribut ou OID
-
-
 AttributeValueDialog.Attribute=Attribut:
 AttributeValueDialog.AttributeValueDialog=Dialogue de valeur d''attribut
 AttributeValueDialog.Value=Valeur:

Modified: directory/studio/trunk/plugins/common.ui/pom-first.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/common.ui/pom-first.xml?rev=1688927&r1=1688926&r2=1688927&view=diff
==============================================================================
--- directory/studio/trunk/plugins/common.ui/pom-first.xml (original)
+++ directory/studio/trunk/plugins/common.ui/pom-first.xml Thu Jul  2 23:21:40 2015
@@ -48,6 +48,7 @@
             <Bundle-Activator>org.apache.directory.studio.common.ui.CommonUIPlugin</Bundle-Activator>
             
             <Export-Package>org.apache.directory.studio.common.ui,
+ org.apache.directory.studio.common.ui.dialogs,
  org.apache.directory.studio.common.ui.filesystem,
  org.apache.directory.studio.common.ui.widgets</Export-Package>
             

Modified: directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/TableDecorator.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/TableDecorator.java?rev=1688927&r1=1688926&r2=1688927&view=diff
==============================================================================
--- directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/TableDecorator.java
(original)
+++ directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/TableDecorator.java
Thu Jul  2 23:21:40 2015
@@ -24,9 +24,10 @@ import java.util.Comparator;
 import org.eclipse.jface.viewers.LabelProvider;
 
 /**
- * An Class used to store the comparator and labelProvider used by the TableWidget.
+ * A Class used to store the comparator and labelProvider used by the TableWidget.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @param <E>The element being handled bu the decorator
  */
 public abstract class TableDecorator<E> extends LabelProvider implements Comparator<E>
 {

Added: directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/dialogs/AttributeDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/dialogs/AttributeDialog.java?rev=1688927&view=auto
==============================================================================
--- directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/dialogs/AttributeDialog.java
(added)
+++ directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/dialogs/AttributeDialog.java
Thu Jul  2 23:21:40 2015
@@ -0,0 +1,202 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.common.ui.dialogs;
+
+
+import org.apache.directory.studio.common.ui.AddEditDialog;
+import org.apache.directory.studio.common.ui.Messages;
+import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The AttributeDialog is used to enter/select an attribute type. Here is what it looks like
:
+ * <pre>
+ * .---------------------------------------------------------.
+ * |X| Select Attribute Type or OID                          |
+ * +---------------------------------------------------------|
+ * | Attribute Type or OID : [                           |v] |
+ * |                                                         |
+ * |                                      (CANCEL)  (  OK  ) |
+ * '---------------------------------------------------------'
+ * </pre>
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AttributeDialog extends AddEditDialog<String>
+{
+    /** The possible attribute types and OIDs. */
+    private String[] attributeTypesAndOids;
+
+    /** The combo containing the list of attributes. */
+    private Combo typeOrOidCombo;
+
+
+    /**
+     * Creates a new instance of AttributeDialog.
+     * 
+     * @param parentShell the parent shell
+     */
+    public AttributeDialog( Shell parentShell )
+    {
+        super( parentShell );
+    }
+    
+    
+    /**
+     * Set the list of possible attributes and OIDs
+     * 
+     * @param attributeNamesAndOids The list of possible attribuytes and OID
+     */
+    public void setAttributeNamesAndOids( String[] attributeNamesAndOids )
+    {
+        this.attributeTypesAndOids = attributeNamesAndOids;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void configureShell( Shell newShell )
+    {
+        super.configureShell( newShell );
+        newShell.setText( Messages.getString( "AttributeDialog.SelectAttributeTypeOrOID"
) ); //$NON-NLS-1$
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void okPressed()
+    {
+        setEditedElement( typeOrOidCombo.getText() );
+        super.okPressed();
+    }
+
+    
+    /**
+     * Overriding the createButton method. The OK button is not enabled until we have a selected
attribute
+     * 
+     * {@inheritDoc}
+     */
+    protected Button createButton(Composite parent, int id, String label, boolean defaultButton)

+    {
+        Button button = super.createButton(parent, id, label, defaultButton);
+
+        if ( id == IDialogConstants.OK_ID ) 
+        {
+            String attribute = (String)getEditedElement();
+
+            if ( ( attribute == null ) || ( attribute.length() == 0 ) )
+            {
+                button.setEnabled( false );
+            }
+        }
+        
+        return button;
+    }
+
+
+    /**
+     * Create the Attribute dialog :
+     * 
+     * <pre>
+     * .---------------------------------------------------------.
+     * |X| Select Attribute Type or OID                          |
+     * +---------------------------------------------------------|
+     * | Attribute Type or OID : [                           |v] |
+     * |                                                         |
+     * |                                      (CANCEL)  (  OK  ) |
+     * '---------------------------------------------------------'
+     * </pre>
+     * 
+     * {@inheritDoc}
+     */
+    protected Control createDialogArea( Composite parent )
+    {
+        Composite composite = ( Composite ) super.createDialogArea( parent );
+
+        Composite c = BaseWidgetUtils.createColumnContainer( composite, 2, 1 );
+        BaseWidgetUtils.createLabel( c, Messages.getString( "AttributeDialog.AttributeTypeOrOID"
), 1 ); //$NON-NLS-1$
+        typeOrOidCombo = BaseWidgetUtils.createCombo( c, attributeTypesAndOids, -1, 1 );
+        
+        if ( getEditedElement() != null )
+        {
+            typeOrOidCombo.setText( getEditedElement() );
+        }
+        
+        typeOrOidCombo.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                validate();
+            }
+        } );
+
+        initDialog();
+
+        return composite;
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    protected void initDialog()
+    {
+        // Nothing to do
+    }
+
+
+    /**
+     * Check that we have selected an attribute
+     */
+    private void validate()
+    {
+        Button okButton = getButton( IDialogConstants.OK_ID );
+        
+        // This button might be null when the dialog is called.
+        if ( okButton == null )
+        {
+            return;
+        }
+
+        okButton.setEnabled( !"".equals( typeOrOidCombo.getText() ) ); //$NON-NLS-1$
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void addNewElement()
+    {
+        // Default to none
+        setEditedElement( "" );
+    }
+}

Modified: directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/messages.properties?rev=1688927&r1=1688926&r2=1688927&view=diff
==============================================================================
--- directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/messages.properties
(original)
+++ directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/messages.properties
Thu Jul  2 23:21:40 2015
@@ -29,4 +29,9 @@ CommonUIWidgets.AddButton=Add...
 CommonUIWidgets.EditButton=Edit...
 CommonUIWidgets.DeleteButton=Delete
 CommonUIWidgets.UpButton=Up...
-CommonUIWidgets.DownButton=Down...
\ No newline at end of file
+CommonUIWidgets.DownButton=Down...
+
+# The dialogs Strings 
+AttributeDialog.AttributeTypeOrOID=Attribute Type or OID:
+AttributeDialog.SelectAttributeTypeOrOID=Select Attribute Type or OID
+

Modified: directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/messages_de.properties?rev=1688927&r1=1688926&r2=1688927&view=diff
==============================================================================
--- directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/messages_de.properties
(original)
+++ directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/messages_de.properties
Thu Jul  2 23:21:40 2015
@@ -29,4 +29,9 @@ CommonUIWidgets.AddButton=Add...
 CommonUIWidgets.EditButton=Edit...
 CommonUIWidgets.DeleteButton=Delete
 CommonUIWidgets.UpButton=Up...
-CommonUIWidgets.DownButton=Down...
\ No newline at end of file
+CommonUIWidgets.DownButton=Down...
+
+# The dialogs Strings 
+AttributeDialog.AttributeTypeOrOID=Attributtyp oder OID:
+AttributeDialog.SelectAttributeTypeOrOID=Attributtyp oder OID ausw\u00E4hlen
+

Modified: directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/messages_fr.properties?rev=1688927&r1=1688926&r2=1688927&view=diff
==============================================================================
--- directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/messages_fr.properties
(original)
+++ directory/studio/trunk/plugins/common.ui/src/main/java/org/apache/directory/studio/common/ui/messages_fr.properties
Thu Jul  2 23:21:40 2015
@@ -28,4 +28,8 @@ CommonUIWidgets.AddButton=Ajout
 CommonUIWidgets.EditButton=Edition
 CommonUIWidgets.DeleteButton=Suppression
 CommonUIWidgets.UpButton=Remonter
-CommonUIWidgets.DownButton=Descendre
\ No newline at end of file
+CommonUIWidgets.DownButton=Descendre
+
+# The dialogs Strings 
+AttributeDialog.AttributeTypeOrOID=Type d''attribut ou OID:
+AttributeDialog.SelectAttributeTypeOrOID=Selection d''un type d''attribut ou OID



Mime
View raw message