directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r692223 - in /directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common: filtereditor/ widgets/ widgets/search/ wizards/
Date Thu, 04 Sep 2008 20:20:09 GMT
Author: seelmann
Date: Thu Sep  4 13:20:08 2008
New Revision: 692223

URL: http://svn.apache.org/viewvc?rev=692223&view=rev
Log:
o Fix for DIRSTUDIO-354, closing proposal popup when paste a string
o Code cleaning, removed deprecated DecortedField class, use ControlDecoration and ContentAssistCommandAdapter
now



Modified:
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterContentAssistProcessor.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/ModWidget.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/FilterWidget.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/AttributeTypeWizardPage.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryObjectclassWizardPage.java

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterContentAssistProcessor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterContentAssistProcessor.java?rev=692223&r1=692222&r2=692223&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterContentAssistProcessor.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterContentAssistProcessor.java
Thu Sep  4 13:20:08 2008
@@ -300,7 +300,7 @@
 
         List<ICompletionProposal> proposalList = new ArrayList<ICompletionProposal>();
         LdapFilter filter = parser.getModel().getFilter( offset );
-        if ( filter != null )
+        if ( filter != null && offset > 0 )
         {
             // case 0: open curly started, show templates and all attribute types
             if ( filter.getStartToken() != null && filter.getFilterComponent() ==
null )

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java?rev=692223&r1=692222&r2=692223&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java
Thu Sep  4 13:20:08 2008
@@ -34,10 +34,6 @@
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.eclipse.jface.fieldassist.ComboContentAdapter;
 import org.eclipse.jface.fieldassist.ContentProposalAdapter;
-import org.eclipse.jface.fieldassist.DecoratedField;
-import org.eclipse.jface.fieldassist.FieldDecoration;
-import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
-import org.eclipse.jface.fieldassist.IControlCreator;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
@@ -47,10 +43,10 @@
 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.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
 
 
 /**
@@ -83,13 +79,13 @@
 
     /** The selected parent DN. */
     private LdapDN parentDn;
-    
+
     /** The entry widget label. */
     private Label parentEntryLabel;
 
     /** The entry widget to enter/select the parent DN. */
     private EntryWidget parentEntryWidget;
-    
+
     /** The RDN label */
     private Label rdnLabel;
 
@@ -101,7 +97,7 @@
 
     /** The list of RdnLines. */
     private ArrayList<RdnLine> rdnLineList;
-    
+
     /** The preview label. */
     private Label previewLabel;
 
@@ -174,7 +170,7 @@
             {
                 int i = 0;
                 Iterator<AttributeTypeAndValue> atavIterator = currentRdn.iterator();
-                while(atavIterator.hasNext())
+                while ( atavIterator.hasNext() )
                 {
                     AttributeTypeAndValue atav = atavIterator.next();
                     addRdnLine( rdnComposite, i );
@@ -417,7 +413,7 @@
                 String oldValue = oldRdnLine.rdnValueText.getText();
 
                 // delete old
-                oldRdnLine.rdnNameComboField.getLayoutControl().dispose();
+                oldRdnLine.rdnTypeCombo.dispose();
                 oldRdnLine.rdnEqualsLabel.dispose();
                 oldRdnLine.rdnValueText.dispose();
                 oldRdnLine.rdnAddButton.dispose();
@@ -461,30 +457,17 @@
     {
         final RdnLine rdnLine = new RdnLine();
 
-        final FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
-            FieldDecorationRegistry.DEC_CONTENT_PROPOSAL );
-        rdnLine.rdnNameComboField = new DecoratedField( rdnComposite, SWT.NONE, new IControlCreator()
-        {
-            public Control createControl( Composite parent, int style )
-            {
-                Combo combo = new Combo( parent, SWT.DROP_DOWN | SWT.BORDER );
-                GridData gd = new GridData();
-                gd.widthHint = 180;
-                combo.setLayoutData( gd );
-                combo.setVisibleItemCount( 20 );
-                return combo;
-            }
-        } );
-        rdnLine.rdnNameComboField.addFieldDecoration( fieldDecoration, SWT.TOP | SWT.LEFT,
true );
+        rdnLine.rdnTypeCombo = new Combo( rdnComposite, SWT.DROP_DOWN | SWT.BORDER );
         GridData gd = new GridData();
         gd.widthHint = 180;
-        rdnLine.rdnNameComboField.getLayoutControl().setLayoutData( gd );
-        rdnLine.rdnTypeCombo = ( Combo ) rdnLine.rdnNameComboField.getControl();
-
-        rdnLine.rdnNameCPA = new ContentProposalAdapter( rdnLine.rdnTypeCombo, new ComboContentAdapter(),
-            new ListContentProposalProvider( attributeNames ), null, null );
-        rdnLine.rdnNameCPA.setFilterStyle( ContentProposalAdapter.FILTER_NONE );
+        rdnLine.rdnTypeCombo.setLayoutData( gd );
+        rdnLine.rdnTypeCombo.setVisibleItemCount( 20 );
+        rdnLine.rdnNameCPA = new ContentAssistCommandAdapter( rdnLine.rdnTypeCombo, new ComboContentAdapter(),
+            new ListContentProposalProvider( attributeNames ), null, null, true );
         rdnLine.rdnNameCPA.setProposalAcceptanceStyle( ContentProposalAdapter.PROPOSAL_REPLACE
);
+        rdnLine.rdnNameCPA.setFilterStyle( ContentProposalAdapter.FILTER_NONE );
+        rdnLine.rdnNameCPA.setAutoActivationCharacters( null );
+        rdnLine.rdnNameCPA.setAutoActivationDelay( 0 );
 
         rdnLine.rdnEqualsLabel = new Label( rdnComposite, SWT.NONE );
         rdnLine.rdnEqualsLabel.setText( "=" );
@@ -558,7 +541,7 @@
         RdnLine rdnLine = ( RdnLine ) rdnLineList.remove( index );
         if ( rdnLine != null )
         {
-            rdnLine.rdnNameComboField.getLayoutControl().dispose();
+            rdnLine.rdnTypeCombo.dispose();
             rdnLine.rdnEqualsLabel.dispose();
             rdnLine.rdnValueText.dispose();
             rdnLine.rdnAddButton.dispose();
@@ -586,9 +569,6 @@
     {
 
         /** The rdn name combo. */
-        private DecoratedField rdnNameComboField;
-
-        /** The rdn name combo. */
         private Combo rdnTypeCombo;
 
         /** The content proposal adapter */
@@ -632,7 +612,7 @@
                 rdnLine.rdnAddButton.setEnabled( b );
                 rdnLine.rdnDeleteButton.setEnabled( b && rdnLineList.size() >
1 );
             }
-            if( b )
+            if ( b )
             {
                 rdnLineList.get( 0 ).rdnValueText.setFocus();
             }

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/ModWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/ModWidget.java?rev=692223&r1=692222&r2=692223&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/ModWidget.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/ModWidget.java
Thu Sep  4 13:20:08 2008
@@ -30,23 +30,18 @@
 import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
 import org.eclipse.jface.fieldassist.ComboContentAdapter;
 import org.eclipse.jface.fieldassist.ContentProposalAdapter;
-import org.eclipse.jface.fieldassist.DecoratedField;
-import org.eclipse.jface.fieldassist.FieldDecoration;
-import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
-import org.eclipse.jface.fieldassist.IControlCreator;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.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.Group;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
 
 
 /**
@@ -252,30 +247,15 @@
         String[] attributeDescriptions = SchemaUtils.getNamesAsArray( schema.getAttributeTypeDescriptions()
);
         Arrays.sort( attributeDescriptions );
 
-        // attribute combo with field decoration
-        final FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
-            FieldDecorationRegistry.DEC_CONTENT_PROPOSAL );
-        modSpec.modAttributeComboField = new DecoratedField( modSpecComposite, SWT.NONE,
new IControlCreator()
-        {
-            public Control createControl( Composite parent, int style )
-            {
-                Combo combo = BaseWidgetUtils.createCombo( parent, new String[0], -1, 1 );
-                combo.setVisibleItemCount( 20 );
-                return combo;
-            }
-        } );
-        modSpec.modAttributeComboField.addFieldDecoration( fieldDecoration, SWT.TOP | SWT.LEFT,
true );
-        modSpec.modAttributeComboField.getLayoutControl().setLayoutData(
-            new GridData( SWT.FILL, SWT.CENTER, true, false ) );
-        modSpec.modAttributeCombo = ( Combo ) modSpec.modAttributeComboField.getControl();
-        modSpec.modAttributeCombo.setItems( attributeDescriptions );
-        modSpec.modAttributeCombo.addModifyListener( this );
-
-        // content proposal adapter
-        modSpec.modAttributeCPA = new ContentProposalAdapter( modSpec.modAttributeCombo,
new ComboContentAdapter(),
-            new ListContentProposalProvider( attributeDescriptions ), null, null );
-        modSpec.modAttributeCPA.setFilterStyle( ContentProposalAdapter.FILTER_NONE );
+        // attribute combo with field decoration and content proposal
+        modSpec.modAttributeCombo = BaseWidgetUtils.createCombo( modSpecComposite, new String[0],
-1, 1 );
+        modSpec.modAttributeCombo.setVisibleItemCount( 20 );
+        modSpec.modAttributeCPA = new ContentAssistCommandAdapter( modSpec.modAttributeCombo,
+            new ComboContentAdapter(), new ListContentProposalProvider( attributeDescriptions
), null, null, true );
         modSpec.modAttributeCPA.setProposalAcceptanceStyle( ContentProposalAdapter.PROPOSAL_REPLACE
);
+        modSpec.modAttributeCPA.setFilterStyle( ContentProposalAdapter.FILTER_NONE );
+        modSpec.modAttributeCPA.setAutoActivationCharacters( null );
+        modSpec.modAttributeCPA.setAutoActivationDelay( 0 );
 
         // add button with listener
         modSpec.modAddButton = new Button( modComposite, SWT.PUSH );
@@ -557,9 +537,6 @@
         /** The mod type. */
         private Combo modType;
 
-        /** The modification attribute field. */
-        private DecoratedField modAttributeComboField;
-
         /** The modification attribute. */
         private Combo modAttributeCombo;
 

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/FilterWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/FilterWidget.java?rev=692223&r1=692222&r2=692223&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/FilterWidget.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/FilterWidget.java
Thu Sep  4 13:20:08 2008
@@ -21,31 +21,28 @@
 package org.apache.directory.studio.ldapbrowser.common.widgets.search;
 
 
+import org.apache.directory.studio.connection.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.connection.ui.widgets.ExtendedContentAssistCommandAdapter;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.common.dialogs.FilterDialog;
 import org.apache.directory.studio.ldapbrowser.common.filtereditor.FilterContentAssistProcessor;
-import org.apache.directory.studio.connection.ui.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.ldapbrowser.common.widgets.BrowserWidget;
 import org.apache.directory.studio.ldapbrowser.common.widgets.HistoryUtils;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterParser;
-import org.eclipse.jface.bindings.keys.KeyStroke;
 import org.eclipse.jface.fieldassist.ComboContentAdapter;
 import org.eclipse.jface.fieldassist.ContentProposalAdapter;
-import org.eclipse.jface.fieldassist.DecoratedField;
-import org.eclipse.jface.fieldassist.FieldDecoration;
-import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
-import org.eclipse.jface.fieldassist.IControlCreator;
 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.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
 
 
 /**
@@ -62,11 +59,8 @@
     /** The filter combo. */
     private Combo filterCombo;
 
-    /** The filter combo field. */
-    private DecoratedField filterComboField;
-
     /** The filter content proposal adapter */
-    private ContentProposalAdapter filterCPA;
+    private ExtendedContentAssistCommandAdapter filterCPA;
 
     /** The button to open the filter editor. */
     private Button filterEditorButton;
@@ -118,25 +112,10 @@
         gd.horizontalSpan = 1;
         gd.widthHint = 200;
         composite.setLayoutData( gd );
-        
-        // filter combo with field decoration
-        final FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
-            FieldDecorationRegistry.DEC_CONTENT_PROPOSAL );
-        filterComboField = new DecoratedField( composite, SWT.NONE, new IControlCreator()
-        {
-            public Control createControl( Composite parent, int style )
-            {
-                Combo combo = BaseWidgetUtils.createCombo( parent, new String[0], -1, 1 );
-                GridData gd = new GridData( GridData.FILL_HORIZONTAL );
-                gd.horizontalSpan = 1;
-                combo.setLayoutData( gd );
-                combo.setVisibleItemCount( 20 );
-                return combo;
-            }
-        } );
-        filterComboField.addFieldDecoration( fieldDecoration, SWT.TOP | SWT.LEFT, true );
-        filterComboField.getLayoutControl().setLayoutData( new GridData( SWT.FILL, SWT.CENTER,
true, false ) );
-        filterCombo = ( Combo ) filterComboField.getControl();
+
+        // filter combo with field decoration and content proposal
+        filterCombo = BaseWidgetUtils.createCombo( composite, new String[0], -1, 1 );
+        filterCombo.setVisibleItemCount( 20 );
         filterCombo.addModifyListener( new ModifyListener()
         {
             public void modifyText( ModifyEvent e )
@@ -144,13 +123,33 @@
                 notifyListeners();
             }
         } );
+        filterCombo.addVerifyListener( new VerifyListener()
+        {
+            public void verifyText( VerifyEvent e )
+            {
+                // close proposal popup when paste a string
 
+                // either with 3rd mouse button (linux)
+                if ( !filterCombo.getText().equals( e.text ) && e.character == 0
&& e.start == e.end )
+                {
+                    filterCPA.closeProposalPopup();
+                }
+
+                // or with ctrl+v / command+v
+                if ( !filterCombo.getText().equals( e.text ) && e.stateMask == SWT.MOD1
&& e.start == e.end )
+                {
+                    filterCPA.closeProposalPopup();
+                }
+            }
+        } );
         parser = new LdapFilterParser();
         contentAssistProcessor = new FilterContentAssistProcessor( parser );
-        filterCPA = new ContentProposalAdapter( filterCombo, new ComboContentAdapter(), contentAssistProcessor,
-            KeyStroke.getInstance( SWT.CTRL, ' ' ), null );
-        filterCPA.setFilterStyle( ContentProposalAdapter.FILTER_NONE );
+        filterCPA = new ExtendedContentAssistCommandAdapter( filterCombo, new ComboContentAdapter(),
+            contentAssistProcessor, null, null, true );
         filterCPA.setProposalAcceptanceStyle( ContentProposalAdapter.PROPOSAL_REPLACE );
+        filterCPA.setFilterStyle( ContentProposalAdapter.FILTER_NONE );
+        filterCPA.setAutoActivationCharacters( null );
+        filterCPA.setAutoActivationDelay( 0 );
 
         // auto edit strategy
         new FilterWidgetAutoEditStrategyAdapter( filterCombo, parser );

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/AttributeTypeWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/AttributeTypeWizardPage.java?rev=692223&r1=692222&r2=692223&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/AttributeTypeWizardPage.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/AttributeTypeWizardPage.java
Thu Sep  4 13:20:08 2008
@@ -34,10 +34,6 @@
 import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
 import org.eclipse.jface.fieldassist.ComboContentAdapter;
 import org.eclipse.jface.fieldassist.ContentProposalAdapter;
-import org.eclipse.jface.fieldassist.DecoratedField;
-import org.eclipse.jface.fieldassist.FieldDecoration;
-import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
-import org.eclipse.jface.fieldassist.IControlCreator;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
@@ -49,9 +45,9 @@
 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.Label;
 import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
 
 
 /**
@@ -84,9 +80,6 @@
 
     /** The possible attribute types applicable to the entry's schema only, existing attributes
are hidden. */
     private String[] possibleAttributeTypesSubschemaOnlyAndExistingHidden;
-    
-    /** The attribute type combo field. */
-    private DecoratedField attributeTypeComboField;
 
     /** The attribute type combo. */
     private Combo attributeTypeCombo;
@@ -127,7 +120,8 @@
         this.initialShowSubschemaAttributesOnly = initialShowSubschemaAttributesOnly;
         this.initialHideExistingAttributes = initialHideExistingAttributes;
 
-        Collection<AttributeTypeDescription> atds = initialEntry.getBrowserConnection().getSchema().getAttributeTypeDescriptions();
+        Collection<AttributeTypeDescription> atds = initialEntry.getBrowserConnection().getSchema()
+            .getAttributeTypeDescriptions();
         Collection<String> atdNames = SchemaUtils.getNames( atds );
         possibleAttributeTypes = atdNames.toArray( new String[atdNames.size()] );
         Arrays.sort( possibleAttributeTypes );
@@ -187,33 +181,18 @@
         composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
 
         BaseWidgetUtils.createLabel( composite, "Attribute type:", 1 );
-//        attributeTypeCombo = BaseWidgetUtils.createCombo( composite, possibleAttributeTypes,
-1, 1 );
-//        attributeTypeCombo.setText( parsedAttributeType );
 
-        // attribute combo with field decoration
-        final FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
-            FieldDecorationRegistry.DEC_CONTENT_PROPOSAL );
-        attributeTypeComboField = new DecoratedField( composite, SWT.NONE, new IControlCreator()
-        {
-            public Control createControl( Composite parent, int style )
-            {
-                Combo combo = BaseWidgetUtils.createCombo( parent, new String[0], -1, 1 );
-                combo.setVisibleItemCount( 20 );
-                return combo;
-            }
-        } );
-        attributeTypeComboField.addFieldDecoration( fieldDecoration, SWT.TOP | SWT.LEFT,
true );
-        attributeTypeComboField.getLayoutControl().setLayoutData(
-            new GridData( SWT.FILL, SWT.CENTER, true, false ) );
-        attributeTypeCombo = ( Combo ) attributeTypeComboField.getControl();
+        // attribute combo with field decoration and content proposal
+        attributeTypeCombo = BaseWidgetUtils.createCombo( composite, new String[0], -1, 1
);
+        attributeTypeCombo.setVisibleItemCount( 20 );
         attributeTypeCombo.setItems( possibleAttributeTypes );
         attributeTypeCombo.setText( parsedAttributeType );
-
-        // content proposal adapter
-        attributeTypeCPA = new ContentProposalAdapter (attributeTypeCombo, new ComboContentAdapter(),
-            new ListContentProposalProvider( possibleAttributeTypes ), null, null );
+        attributeTypeCPA = new ContentAssistCommandAdapter( attributeTypeCombo, new ComboContentAdapter(),
+            new ListContentProposalProvider( possibleAttributeTypes ), null, null, true );
+        attributeTypeCPA.setProposalAcceptanceStyle( ContentProposalAdapter.PROPOSAL_REPLACE
);
         attributeTypeCPA.setFilterStyle( ContentProposalAdapter.FILTER_NONE );
-        attributeTypeCPA.setProposalAcceptanceStyle( ContentProposalAdapter.PROPOSAL_REPLACE
);  
+        attributeTypeCPA.setAutoActivationCharacters( null );
+        attributeTypeCPA.setAutoActivationDelay( 0 );
 
         BaseWidgetUtils.createSpacer( composite, 1 );
         showSubschemAttributesOnlyButton = BaseWidgetUtils.createCheckbox( composite, "Show
subschema attributes only",

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryObjectclassWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryObjectclassWizardPage.java?rev=692223&r1=692222&r2=692223&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryObjectclassWizardPage.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryObjectclassWizardPage.java
Thu Sep  4 13:20:08 2008
@@ -28,9 +28,9 @@
 
 import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
 import org.apache.directory.shared.ldap.schema.syntax.ObjectClassDescription;
+import org.apache.directory.studio.connection.ui.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
-import org.apache.directory.studio.connection.ui.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
@@ -39,10 +39,8 @@
 import org.apache.directory.studio.ldapbrowser.core.model.impl.Value;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
-import org.eclipse.jface.fieldassist.DecoratedField;
-import org.eclipse.jface.fieldassist.FieldDecoration;
+import org.eclipse.jface.fieldassist.ControlDecoration;
 import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
-import org.eclipse.jface.fieldassist.IControlCreator;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IDoubleClickListener;
@@ -67,7 +65,6 @@
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 
@@ -232,10 +229,10 @@
             {
                 for ( IValue ocValue : ocAttribute.getValues() )
                 {
-                    if(!ocValue.isEmpty())
+                    if ( !ocValue.isEmpty() )
                     {
                         ObjectClassDescription ocd = wizard.getSelectedConnection().getSchema()
-                        .getObjectClassDescription( ocValue.getStringValue() );
+                            .getObjectClassDescription( ocValue.getStringValue() );
                         availableObjectClasses.remove( ocd );
                         selectedObjectClasses.add( ocd );
                     }
@@ -322,27 +319,7 @@
 
         Composite availableObjectClassesComposite = BaseWidgetUtils.createColumnContainer(
composite, 1, 1 );
 
-        if ( FieldDecorationRegistry.getDefault().getFieldDecoration( getClass().getName()
) == null )
-        {
-            FieldDecoration dummy = FieldDecorationRegistry.getDefault().getFieldDecoration(
-                FieldDecorationRegistry.DEC_CONTENT_PROPOSAL );
-            FieldDecorationRegistry.getDefault().registerFieldDecoration( getClass().getName(),
-                "You may enter a filter to restrict the list below", dummy.getImage() );
-        }
-        final FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
-            getClass().getName() );
-        final DecoratedField availabeObjectClassesInstantSearchField = new DecoratedField(
-            availableObjectClassesComposite, SWT.BORDER, new IControlCreator()
-            {
-                public Control createControl( Composite parent, int style )
-                {
-                    return BaseWidgetUtils.createText( parent, "", 1 );
-                }
-            } );
-        availabeObjectClassesInstantSearchField.addFieldDecoration( fieldDecoration, SWT.TOP
| SWT.LEFT, true );
-        availabeObjectClassesInstantSearchField.getLayoutControl().setLayoutData(
-            new GridData( SWT.FILL, SWT.CENTER, true, false ) );
-        availableObjectClassesInstantSearch = ( Text ) availabeObjectClassesInstantSearchField.getControl();
+        availableObjectClassesInstantSearch = BaseWidgetUtils.createText( availableObjectClassesComposite,
"", 1 );
         availableObjectClassesInstantSearch.addModifyListener( new ModifyListener()
         {
             public void modifyText( ModifyEvent e )
@@ -365,6 +342,12 @@
                 }
             }
         } );
+        ControlDecoration availableObjectClassesInstantSearchDecoration = new ControlDecoration(
+            availableObjectClassesInstantSearch, SWT.TOP | SWT.LEFT, composite );
+        availableObjectClassesInstantSearchDecoration
+            .setDescriptionText( "You may enter a filter to restrict the list below" );
+        availableObjectClassesInstantSearchDecoration.setImage( FieldDecorationRegistry.getDefault()
+            .getFieldDecoration( FieldDecorationRegistry.DEC_CONTENT_PROPOSAL ).getImage()
);
 
         availableObjectClassesViewer = new TableViewer( availableObjectClassesComposite );
         GridData data = new GridData( GridData.FILL_BOTH );



Mime
View raw message