directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r987577 [4/10] - in /directory/studio/branches/studio-rap/plugins: common.ui/src/main/java/org/apache/directory/studio/common/ui/ connection.ui/src/main/java/org/apache/directory/studio/connection/ui/ connection.ui/src/main/java/org/apache/...
Date Fri, 20 Aug 2010 17:07:23 GMT
Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterDamagerRepairer.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterDamagerRepairer.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterDamagerRepairer.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterDamagerRepairer.java Fri Aug 20 17:07:19 2010
@@ -21,20 +21,6 @@
 package org.apache.directory.studio.ldapbrowser.common.filtereditor;
 
 
-import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterParser;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterToken;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.TextPresentation;
-import org.eclipse.jface.text.presentation.IPresentationDamager;
-import org.eclipse.jface.text.presentation.IPresentationRepairer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.graphics.RGB;
 
 
 /**
@@ -42,131 +28,131 @@ import org.eclipse.swt.graphics.RGB;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class FilterDamagerRepairer implements IPresentationDamager, IPresentationRepairer
+public class FilterDamagerRepairer /*implements IPresentationDamager, IPresentationRepairer*/
 {
-
-    private static final TextAttribute DEFAULT_TEXT_ATTRIBUTE = new TextAttribute( BrowserCommonActivator.getDefault()
-        .getColor( new RGB( 0, 0, 0 ) ) );
-
-    private static final TextAttribute AND_OR_NOT_TEXT_ATTRIBUTE = new TextAttribute( BrowserCommonActivator
-        .getDefault().getColor( new RGB( 0, 127, 0 ) ), null, SWT.BOLD );
-
-    private static final TextAttribute ATTRIBUTE_TEXT_ATTRIBUTE = new TextAttribute( BrowserCommonActivator
-        .getDefault().getColor( new RGB( 127, 0, 85 ) ) );
-
-    private static final TextAttribute FILTER_TYPE_TEXT_ATTRIBUTE = new TextAttribute( BrowserCommonActivator
-        .getDefault().getColor( new RGB( 255, 0, 0 ) ), null, SWT.BOLD );
-
-    private static final TextAttribute VALUE_TEXT_ATTRIBUTE = new TextAttribute( BrowserCommonActivator.getDefault()
-        .getColor( new RGB( 0, 0, 127 ) ) );
-
-    private static final TextAttribute PARENTHESIS_TEXT_ATTRIBUTE = new TextAttribute( BrowserCommonActivator
-        .getDefault().getColor( new RGB( 0, 0, 0 ) ), null, SWT.BOLD );
-
-    /** The filter parser. */
-    private LdapFilterParser parser;
-
-    /** The document. */
-    private IDocument document;
-
-
-    /**
-     * Creates a new instance of FilterDamagerRepairer.
-     * 
-     * @param parser the filter parser
-     */
-    public FilterDamagerRepairer( LdapFilterParser parser )
-    {
-        this.parser = parser;
-        this.document = null;
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.presentation.IPresentationDamager#setDocument(org.eclipse.jface.text.IDocument)
-     */
-    public void setDocument( IDocument document )
-    {
-        this.document = document;
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.presentation.IPresentationDamager#getDamageRegion(org.eclipse.jface.text.ITypedRegion, org.eclipse.jface.text.DocumentEvent, boolean)
-     */
-    public IRegion getDamageRegion( ITypedRegion partition, DocumentEvent event, boolean documentPartitioningChanged )
-    {
-        return partition;
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.presentation.IPresentationRepairer#createPresentation(org.eclipse.jface.text.TextPresentation, org.eclipse.jface.text.ITypedRegion)
-     */
-    public void createPresentation( TextPresentation presentation, ITypedRegion damage )
-    {
-        // parse the filter
-        parser.parse( this.document.get() );
-
-        // get tokens
-        LdapFilterToken[] tokens = parser.getModel().getTokens();
-
-        // syntax highlighting
-        for ( int i = 0; i < tokens.length; i++ )
-        {
-            switch ( tokens[i].getType() )
-            {
-                case LdapFilterToken.LPAR:
-                case LdapFilterToken.RPAR:
-                    this.addStyleRange( presentation, tokens[i], PARENTHESIS_TEXT_ATTRIBUTE );
-                    break;
-                case LdapFilterToken.AND:
-                case LdapFilterToken.OR:
-                case LdapFilterToken.NOT:
-                    this.addStyleRange( presentation, tokens[i], AND_OR_NOT_TEXT_ATTRIBUTE );
-                    break;
-                case LdapFilterToken.EQUAL:
-                case LdapFilterToken.GREATER:
-                case LdapFilterToken.LESS:
-                case LdapFilterToken.APROX:
-                case LdapFilterToken.PRESENT:
-                case LdapFilterToken.SUBSTRING:
-                case LdapFilterToken.EXTENSIBLE_DNATTR_COLON:
-                case LdapFilterToken.EXTENSIBLE_MATCHINGRULEOID_COLON:
-                case LdapFilterToken.EXTENSIBLE_EQUALS_COLON:
-                    this.addStyleRange( presentation, tokens[i], FILTER_TYPE_TEXT_ATTRIBUTE );
-                    break;
-                case LdapFilterToken.ATTRIBUTE:
-                case LdapFilterToken.EXTENSIBLE_ATTRIBUTE:
-                case LdapFilterToken.EXTENSIBLE_DNATTR:
-                case LdapFilterToken.EXTENSIBLE_MATCHINGRULEOID:
-                    this.addStyleRange( presentation, tokens[i], ATTRIBUTE_TEXT_ATTRIBUTE );
-                    break;
-                case LdapFilterToken.VALUE:
-                    this.addStyleRange( presentation, tokens[i], VALUE_TEXT_ATTRIBUTE );
-                    break;
-                default:
-                    this.addStyleRange( presentation, tokens[i], DEFAULT_TEXT_ATTRIBUTE );
-            }
-        }
-    }
-
-
-    /**
-     * Adds the style range.
-     * 
-     * @param presentation the presentation
-     * @param textAttribute the text attribute
-     * @param token the token
-     */
-    private void addStyleRange( TextPresentation presentation, LdapFilterToken token, TextAttribute textAttribute )
-    {
-        if ( token.getLength() > 0 )
-        {
-            StyleRange range = new StyleRange( token.getOffset(), token.getLength(), textAttribute.getForeground(),
-                textAttribute.getBackground(), textAttribute.getStyle() );
-            presentation.addStyleRange( range );
-        }
-    }
+//
+//    private static final TextAttribute DEFAULT_TEXT_ATTRIBUTE = new TextAttribute( BrowserCommonActivator.getDefault()
+//        .getColor( new RGB( 0, 0, 0 ) ) );
+//
+//    private static final TextAttribute AND_OR_NOT_TEXT_ATTRIBUTE = new TextAttribute( BrowserCommonActivator
+//        .getDefault().getColor( new RGB( 0, 127, 0 ) ), null, SWT.BOLD );
+//
+//    private static final TextAttribute ATTRIBUTE_TEXT_ATTRIBUTE = new TextAttribute( BrowserCommonActivator
+//        .getDefault().getColor( new RGB( 127, 0, 85 ) ) );
+//
+//    private static final TextAttribute FILTER_TYPE_TEXT_ATTRIBUTE = new TextAttribute( BrowserCommonActivator
+//        .getDefault().getColor( new RGB( 255, 0, 0 ) ), null, SWT.BOLD );
+//
+//    private static final TextAttribute VALUE_TEXT_ATTRIBUTE = new TextAttribute( BrowserCommonActivator.getDefault()
+//        .getColor( new RGB( 0, 0, 127 ) ) );
+//
+//    private static final TextAttribute PARENTHESIS_TEXT_ATTRIBUTE = new TextAttribute( BrowserCommonActivator
+//        .getDefault().getColor( new RGB( 0, 0, 0 ) ), null, SWT.BOLD );
+//
+//    /** The filter parser. */
+//    private LdapFilterParser parser;
+//
+//    /** The document. */
+//    private IDocument document;
+//
+//
+//    /**
+//     * Creates a new instance of FilterDamagerRepairer.
+//     * 
+//     * @param parser the filter parser
+//     */
+//    public FilterDamagerRepairer( LdapFilterParser parser )
+//    {
+//        this.parser = parser;
+//        this.document = null;
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.presentation.IPresentationDamager#setDocument(org.eclipse.jface.text.IDocument)
+//     */
+//    public void setDocument( IDocument document )
+//    {
+//        this.document = document;
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.presentation.IPresentationDamager#getDamageRegion(org.eclipse.jface.text.ITypedRegion, org.eclipse.jface.text.DocumentEvent, boolean)
+//     */
+//    public IRegion getDamageRegion( ITypedRegion partition, DocumentEvent event, boolean documentPartitioningChanged )
+//    {
+//        return partition;
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.presentation.IPresentationRepairer#createPresentation(org.eclipse.jface.text.TextPresentation, org.eclipse.jface.text.ITypedRegion)
+//     */
+//    public void createPresentation( TextPresentation presentation, ITypedRegion damage )
+//    {
+//        // parse the filter
+//        parser.parse( this.document.get() );
+//
+//        // get tokens
+//        LdapFilterToken[] tokens = parser.getModel().getTokens();
+//
+//        // syntax highlighting
+//        for ( int i = 0; i < tokens.length; i++ )
+//        {
+//            switch ( tokens[i].getType() )
+//            {
+//                case LdapFilterToken.LPAR:
+//                case LdapFilterToken.RPAR:
+//                    this.addStyleRange( presentation, tokens[i], PARENTHESIS_TEXT_ATTRIBUTE );
+//                    break;
+//                case LdapFilterToken.AND:
+//                case LdapFilterToken.OR:
+//                case LdapFilterToken.NOT:
+//                    this.addStyleRange( presentation, tokens[i], AND_OR_NOT_TEXT_ATTRIBUTE );
+//                    break;
+//                case LdapFilterToken.EQUAL:
+//                case LdapFilterToken.GREATER:
+//                case LdapFilterToken.LESS:
+//                case LdapFilterToken.APROX:
+//                case LdapFilterToken.PRESENT:
+//                case LdapFilterToken.SUBSTRING:
+//                case LdapFilterToken.EXTENSIBLE_DNATTR_COLON:
+//                case LdapFilterToken.EXTENSIBLE_MATCHINGRULEOID_COLON:
+//                case LdapFilterToken.EXTENSIBLE_EQUALS_COLON:
+//                    this.addStyleRange( presentation, tokens[i], FILTER_TYPE_TEXT_ATTRIBUTE );
+//                    break;
+//                case LdapFilterToken.ATTRIBUTE:
+//                case LdapFilterToken.EXTENSIBLE_ATTRIBUTE:
+//                case LdapFilterToken.EXTENSIBLE_DNATTR:
+//                case LdapFilterToken.EXTENSIBLE_MATCHINGRULEOID:
+//                    this.addStyleRange( presentation, tokens[i], ATTRIBUTE_TEXT_ATTRIBUTE );
+//                    break;
+//                case LdapFilterToken.VALUE:
+//                    this.addStyleRange( presentation, tokens[i], VALUE_TEXT_ATTRIBUTE );
+//                    break;
+//                default:
+//                    this.addStyleRange( presentation, tokens[i], DEFAULT_TEXT_ATTRIBUTE );
+//            }
+//        }
+//    }
+//
+//
+//    /**
+//     * Adds the style range.
+//     * 
+//     * @param presentation the presentation
+//     * @param textAttribute the text attribute
+//     * @param token the token
+//     */
+//    private void addStyleRange( TextPresentation presentation, LdapFilterToken token, TextAttribute textAttribute )
+//    {
+//        if ( token.getLength() > 0 )
+//        {
+//            StyleRange range = new StyleRange( token.getOffset(), token.getLength(), textAttribute.getForeground(),
+//                textAttribute.getBackground(), textAttribute.getStyle() );
+//            presentation.addStyleRange( range );
+//        }
+//    }
 
 }

Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterFormattingStrategy.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterFormattingStrategy.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterFormattingStrategy.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterFormattingStrategy.java Fri Aug 20 17:07:19 2010
@@ -21,16 +21,6 @@
 package org.apache.directory.studio.ldapbrowser.common.filtereditor;
 
 
-import org.apache.directory.studio.ldapbrowser.core.model.filter.LdapAndFilterComponent;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.LdapFilter;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.LdapFilterComponent;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.LdapFilterExtensibleComponent;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.LdapFilterItemComponent;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.LdapNotFilterComponent;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.LdapOrFilterComponent;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterParser;
-import org.eclipse.jface.text.formatter.IFormattingStrategy;
-import org.eclipse.jface.text.source.ISourceViewer;
 
 
 /**
@@ -39,136 +29,136 @@ import org.eclipse.jface.text.source.ISo
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class FilterFormattingStrategy implements IFormattingStrategy
+public class FilterFormattingStrategy /* implements IFormattingStrategy */
 {
-
-    /** The filter parser. */
-    private LdapFilterParser parser;
-
-    /** The source viewer. */
-    private ISourceViewer sourceViewer;
-
-
-    /**
-     * Creates a new instance of FilterFormattingStrategy.
-     * 
-     * @param sourceViewer the source viewer
-     * @param parser the filter parser
-     */
-    public FilterFormattingStrategy( ISourceViewer sourceViewer, LdapFilterParser parser )
-    {
-        this.parser = parser;
-        this.sourceViewer = sourceViewer;
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.formatter.IFormattingStrategy#formatterStarts(java.lang.String)
-     */
-    public void formatterStarts( String initialIndentation )
-    {
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.formatter.IFormattingStrategy#format(java.lang.String, boolean, java.lang.String, int[])
-     */
-    public String format( String content, boolean isLineStart, String indentation, int[] positions )
-    {
-        // this.parser.parse(content);
-        LdapFilter model = parser.getModel();
-        if ( model != null && model.isValid() )
-        {
-            sourceViewer.getDocument().set( getFormattedFilter( model, 0 ) );
-        }
-
-        return null;
-    }
-
-
-    /**
-     * Gets the formatted string respresentation of the filter.
-     * 
-     * @param filter the filter
-     * @param indent the indent
-     * 
-     * @return the formatted string respresentation of the filter
-     */
-    private String getFormattedFilter( LdapFilter filter, int indent )
-    {
-        StringBuffer sb = new StringBuffer();
-
-        for ( int i = 0; i < indent; i++ )
-        {
-            sb.append( FilterAutoEditStrategy.INDENT_STRING );
-        }
-
-        LdapFilterComponent fc = filter.getFilterComponent();
-        if ( fc instanceof LdapFilterItemComponent )
-        {
-            sb.append( '(' ).append( ( ( LdapFilterItemComponent ) fc ).toString() ).append( ')' );
-        }
-        else if ( fc instanceof LdapFilterExtensibleComponent )
-        {
-            sb.append( '(' ).append( ( ( LdapFilterExtensibleComponent ) fc ).toString() ).append( ')' );
-        }
-        else if ( fc instanceof LdapNotFilterComponent )
-        {
-            sb.append( "(!" ); //$NON-NLS-1$
-            LdapNotFilterComponent lnfc = ( LdapNotFilterComponent ) fc;
-            if ( lnfc.getFilters().length > 0
-                && lnfc.getFilters()[0].getFilterComponent() instanceof LdapFilterItemComponent )
-            {
-                sb.append( getFormattedFilter( ( lnfc ).getFilters()[0], 0 ) );
-            }
-            else
-            {
-                sb.append( '\n' );
-                sb.append( getFormattedFilter( ( lnfc ).getFilters()[0], indent + 1 ) );
-                sb.append( '\n' );
-                for ( int i = 0; i < indent; i++ )
-                    sb.append( FilterAutoEditStrategy.INDENT_STRING );
-            }
-            sb.append( ')' );
-        }
-        else if ( fc instanceof LdapAndFilterComponent )
-        {
-            sb.append( "(&" ); //$NON-NLS-1$
-            sb.append( '\n' );
-            LdapFilter[] filters = ( ( LdapAndFilterComponent ) fc ).getFilters();
-            for ( int i = 0; i < filters.length; i++ )
-            {
-                sb.append( getFormattedFilter( filters[i], indent + 1 ) );
-                sb.append( '\n' );
-            }
-            for ( int i = 0; i < indent; i++ )
-                sb.append( FilterAutoEditStrategy.INDENT_STRING );
-            sb.append( ')' );
-        }
-        else if ( fc instanceof LdapOrFilterComponent )
-        {
-            sb.append( "(|" ); //$NON-NLS-1$
-            sb.append( '\n' );
-            LdapFilter[] filters = ( ( LdapOrFilterComponent ) fc ).getFilters();
-            for ( int i = 0; i < filters.length; i++ )
-            {
-                sb.append( getFormattedFilter( filters[i], indent + 1 ) );
-                sb.append( '\n' );
-            }
-            for ( int i = 0; i < indent; i++ )
-                sb.append( FilterAutoEditStrategy.INDENT_STRING );
-            sb.append( ')' );
-        }
-
-        return sb.toString();
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.formatter.IFormattingStrategy#formatterStops()
-     */
-    public void formatterStops()
-    {
-    }
+//
+//    /** The filter parser. */
+//    private LdapFilterParser parser;
+//
+//    /** The source viewer. */
+//    private ISourceViewer sourceViewer;
+//
+//
+//    /**
+//     * Creates a new instance of FilterFormattingStrategy.
+//     * 
+//     * @param sourceViewer the source viewer
+//     * @param parser the filter parser
+//     */
+//    public FilterFormattingStrategy( ISourceViewer sourceViewer, LdapFilterParser parser )
+//    {
+//        this.parser = parser;
+//        this.sourceViewer = sourceViewer;
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.formatter.IFormattingStrategy#formatterStarts(java.lang.String)
+//     */
+//    public void formatterStarts( String initialIndentation )
+//    {
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.formatter.IFormattingStrategy#format(java.lang.String, boolean, java.lang.String, int[])
+//     */
+//    public String format( String content, boolean isLineStart, String indentation, int[] positions )
+//    {
+//        // this.parser.parse(content);
+//        LdapFilter model = parser.getModel();
+//        if ( model != null && model.isValid() )
+//        {
+//            sourceViewer.getDocument().set( getFormattedFilter( model, 0 ) );
+//        }
+//
+//        return null;
+//    }
+//
+//
+//    /**
+//     * Gets the formatted string respresentation of the filter.
+//     * 
+//     * @param filter the filter
+//     * @param indent the indent
+//     * 
+//     * @return the formatted string respresentation of the filter
+//     */
+//    private String getFormattedFilter( LdapFilter filter, int indent )
+//    {
+//        StringBuffer sb = new StringBuffer();
+//
+//        for ( int i = 0; i < indent; i++ )
+//        {
+//            sb.append( FilterAutoEditStrategy.INDENT_STRING );
+//        }
+//
+//        LdapFilterComponent fc = filter.getFilterComponent();
+//        if ( fc instanceof LdapFilterItemComponent )
+//        {
+//            sb.append( '(' ).append( ( ( LdapFilterItemComponent ) fc ).toString() ).append( ')' );
+//        }
+//        else if ( fc instanceof LdapFilterExtensibleComponent )
+//        {
+//            sb.append( '(' ).append( ( ( LdapFilterExtensibleComponent ) fc ).toString() ).append( ')' );
+//        }
+//        else if ( fc instanceof LdapNotFilterComponent )
+//        {
+//            sb.append( "(!" ); //$NON-NLS-1$
+//            LdapNotFilterComponent lnfc = ( LdapNotFilterComponent ) fc;
+//            if ( lnfc.getFilters().length > 0
+//                && lnfc.getFilters()[0].getFilterComponent() instanceof LdapFilterItemComponent )
+//            {
+//                sb.append( getFormattedFilter( ( lnfc ).getFilters()[0], 0 ) );
+//            }
+//            else
+//            {
+//                sb.append( '\n' );
+//                sb.append( getFormattedFilter( ( lnfc ).getFilters()[0], indent + 1 ) );
+//                sb.append( '\n' );
+//                for ( int i = 0; i < indent; i++ )
+//                    sb.append( FilterAutoEditStrategy.INDENT_STRING );
+//            }
+//            sb.append( ')' );
+//        }
+//        else if ( fc instanceof LdapAndFilterComponent )
+//        {
+//            sb.append( "(&" ); //$NON-NLS-1$
+//            sb.append( '\n' );
+//            LdapFilter[] filters = ( ( LdapAndFilterComponent ) fc ).getFilters();
+//            for ( int i = 0; i < filters.length; i++ )
+//            {
+//                sb.append( getFormattedFilter( filters[i], indent + 1 ) );
+//                sb.append( '\n' );
+//            }
+//            for ( int i = 0; i < indent; i++ )
+//                sb.append( FilterAutoEditStrategy.INDENT_STRING );
+//            sb.append( ')' );
+//        }
+//        else if ( fc instanceof LdapOrFilterComponent )
+//        {
+//            sb.append( "(|" ); //$NON-NLS-1$
+//            sb.append( '\n' );
+//            LdapFilter[] filters = ( ( LdapOrFilterComponent ) fc ).getFilters();
+//            for ( int i = 0; i < filters.length; i++ )
+//            {
+//                sb.append( getFormattedFilter( filters[i], indent + 1 ) );
+//                sb.append( '\n' );
+//            }
+//            for ( int i = 0; i < indent; i++ )
+//                sb.append( FilterAutoEditStrategy.INDENT_STRING );
+//            sb.append( ')' );
+//        }
+//
+//        return sb.toString();
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.formatter.IFormattingStrategy#formatterStops()
+//     */
+//    public void formatterStops()
+//    {
+//    }
 
 }

Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterReconcilingStrategy.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterReconcilingStrategy.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterReconcilingStrategy.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterReconcilingStrategy.java Fri Aug 20 17:07:19 2010
@@ -21,27 +21,6 @@
 package org.apache.directory.studio.ldapbrowser.common.filtereditor;
 
 
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.LdapFilter;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterParser;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterToken;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.PaintManager;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
-import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.AnnotationModel;
-import org.eclipse.jface.text.source.AnnotationPainter;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.IAnnotationModelExtension;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.MatchingCharacterPainter;
-import org.eclipse.swt.graphics.RGB;
 
 
 /**
@@ -50,128 +29,128 @@ import org.eclipse.swt.graphics.RGB;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class FilterReconcilingStrategy implements IReconcilingStrategy
+public class FilterReconcilingStrategy /*implements IReconcilingStrategy*/
 {
-
-    /** The source viewer. */
-    private ISourceViewer sourceViewer;
-
-    /** The filter parser. */
-    private LdapFilterParser parser;
-
-    /** The paint manager. */
-    private PaintManager paintManager;
-
-
-    /**
-     * Creates a new instance of FilterReconcilingStrategy.
-     * 
-     * @param sourceViewer the source viewer
-     * @param parser the filter parser
-     */
-    public FilterReconcilingStrategy( ISourceViewer sourceViewer, LdapFilterParser parser )
-    {
-        this.sourceViewer = sourceViewer;
-        this.parser = parser;
-        this.paintManager = null;
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#setDocument(org.eclipse.jface.text.IDocument)
-     */
-    public void setDocument( IDocument document )
-    {
-        if ( sourceViewer.getAnnotationModel() == null )
-        {
-            IAnnotationModel model = new AnnotationModel();
-            sourceViewer.setDocument( sourceViewer.getDocument(), model );
-        }
-
-        // add annotation painter
-        if ( paintManager == null && sourceViewer.getAnnotationModel() instanceof IAnnotationModelExtension )
-        {
-            AnnotationPainter ap = new AnnotationPainter( sourceViewer, null );
-            ap.addAnnotationType( "DEFAULT" ); //$NON-NLS-1$
-            ap.setAnnotationTypeColor( "DEFAULT", BrowserCommonActivator.getDefault().getColor( new RGB( 255, 0, 0 ) ) ); //$NON-NLS-1$
-            sourceViewer.getAnnotationModel().addAnnotationModelListener( ap );
-
-            FilterCharacterPairMatcher cpm = new FilterCharacterPairMatcher( sourceViewer, parser );
-            MatchingCharacterPainter mcp = new MatchingCharacterPainter( sourceViewer, cpm );
-            mcp.setColor( BrowserCommonActivator.getDefault().getColor( new RGB( 159, 159, 159 ) ) );
-
-            paintManager = new PaintManager( sourceViewer );
-            paintManager.addPainter( ap );
-            paintManager.addPainter( mcp );
-        }
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.reconciler.DirtyRegion, org.eclipse.jface.text.IRegion)
-     */
-    public void reconcile( DirtyRegion dirtyRegion, IRegion subRegion )
-    {
-        reconcile( dirtyRegion );
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.IRegion)
-     */
-    public void reconcile( IRegion partition )
-    {
-
-        LdapFilterToken[] tokens = parser.getModel().getTokens();
-
-        // annotations
-        if ( sourceViewer.getAnnotationModel() instanceof IAnnotationModelExtension )
-        {
-            ( ( IAnnotationModelExtension ) sourceViewer.getAnnotationModel() ).removeAllAnnotations();
-
-            List<Position> positionList = new ArrayList<Position>();
-
-            LdapFilter[] invalidFilters = parser.getModel().getInvalidFilters();
-            for ( int i = 0; i < invalidFilters.length; i++ )
-            {
-                if ( invalidFilters[i].getStartToken() != null )
-                {
-                    int start = invalidFilters[i].getStartToken().getOffset();
-                    int stop = invalidFilters[i].getStopToken() != null ? invalidFilters[i].getStopToken().getOffset()
-                        + invalidFilters[i].getStopToken().getLength() : start
-                        + invalidFilters[i].getStartToken().getLength();
-
-                    Annotation annotation = new Annotation( "DEFAULT", true, invalidFilters[i].toString() ); //$NON-NLS-1$
-                    Position position = new Position( start, stop - start );
-                    positionList.add( position );
-                    sourceViewer.getAnnotationModel().addAnnotation( annotation, position );
-                }
-            }
-
-            for ( int i = 0; i < tokens.length; i++ )
-            {
-                if ( tokens[i].getType() == LdapFilterToken.ERROR )
-                {
-
-                    boolean overlaps = false;
-                    for ( int k = 0; k < positionList.size(); k++ )
-                    {
-                        Position pos = positionList.get( k );
-                        if ( pos.overlapsWith( tokens[i].getOffset(), tokens[i].getLength() ) )
-                        {
-                            overlaps = true;
-                            break;
-                        }
-                    }
-                    if ( !overlaps )
-                    {
-                        Annotation annotation = new Annotation( "DEFAULT", true, tokens[i].getValue() ); //$NON-NLS-1$
-                        Position position = new Position( tokens[i].getOffset(), tokens[i].getLength() );
-                        sourceViewer.getAnnotationModel().addAnnotation( annotation, position );
-                    }
-                }
-            }
-        }
-    }
+//
+//    /** The source viewer. */
+//    private ISourceViewer sourceViewer;
+//
+//    /** The filter parser. */
+//    private LdapFilterParser parser;
+//
+//    /** The paint manager. */
+//    private PaintManager paintManager;
+//
+//
+//    /**
+//     * Creates a new instance of FilterReconcilingStrategy.
+//     * 
+//     * @param sourceViewer the source viewer
+//     * @param parser the filter parser
+//     */
+//    public FilterReconcilingStrategy( ISourceViewer sourceViewer, LdapFilterParser parser )
+//    {
+//        this.sourceViewer = sourceViewer;
+//        this.parser = parser;
+//        this.paintManager = null;
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#setDocument(org.eclipse.jface.text.IDocument)
+//     */
+//    public void setDocument( IDocument document )
+//    {
+//        if ( sourceViewer.getAnnotationModel() == null )
+//        {
+//            IAnnotationModel model = new AnnotationModel();
+//            sourceViewer.setDocument( sourceViewer.getDocument(), model );
+//        }
+//
+//        // add annotation painter
+//        if ( paintManager == null && sourceViewer.getAnnotationModel() instanceof IAnnotationModelExtension )
+//        {
+//            AnnotationPainter ap = new AnnotationPainter( sourceViewer, null );
+//            ap.addAnnotationType( "DEFAULT" ); //$NON-NLS-1$
+//            ap.setAnnotationTypeColor( "DEFAULT", BrowserCommonActivator.getDefault().getColor( new RGB( 255, 0, 0 ) ) ); //$NON-NLS-1$
+//            sourceViewer.getAnnotationModel().addAnnotationModelListener( ap );
+//
+//            FilterCharacterPairMatcher cpm = new FilterCharacterPairMatcher( sourceViewer, parser );
+//            MatchingCharacterPainter mcp = new MatchingCharacterPainter( sourceViewer, cpm );
+//            mcp.setColor( BrowserCommonActivator.getDefault().getColor( new RGB( 159, 159, 159 ) ) );
+//
+//            paintManager = new PaintManager( sourceViewer );
+//            paintManager.addPainter( ap );
+//            paintManager.addPainter( mcp );
+//        }
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.reconciler.DirtyRegion, org.eclipse.jface.text.IRegion)
+//     */
+//    public void reconcile( DirtyRegion dirtyRegion, IRegion subRegion )
+//    {
+//        reconcile( dirtyRegion );
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.IRegion)
+//     */
+//    public void reconcile( IRegion partition )
+//    {
+//
+//        LdapFilterToken[] tokens = parser.getModel().getTokens();
+//
+//        // annotations
+//        if ( sourceViewer.getAnnotationModel() instanceof IAnnotationModelExtension )
+//        {
+//            ( ( IAnnotationModelExtension ) sourceViewer.getAnnotationModel() ).removeAllAnnotations();
+//
+//            List<Position> positionList = new ArrayList<Position>();
+//
+//            LdapFilter[] invalidFilters = parser.getModel().getInvalidFilters();
+//            for ( int i = 0; i < invalidFilters.length; i++ )
+//            {
+//                if ( invalidFilters[i].getStartToken() != null )
+//                {
+//                    int start = invalidFilters[i].getStartToken().getOffset();
+//                    int stop = invalidFilters[i].getStopToken() != null ? invalidFilters[i].getStopToken().getOffset()
+//                        + invalidFilters[i].getStopToken().getLength() : start
+//                        + invalidFilters[i].getStartToken().getLength();
+//
+//                    Annotation annotation = new Annotation( "DEFAULT", true, invalidFilters[i].toString() ); //$NON-NLS-1$
+//                    Position position = new Position( start, stop - start );
+//                    positionList.add( position );
+//                    sourceViewer.getAnnotationModel().addAnnotation( annotation, position );
+//                }
+//            }
+//
+//            for ( int i = 0; i < tokens.length; i++ )
+//            {
+//                if ( tokens[i].getType() == LdapFilterToken.ERROR )
+//                {
+//
+//                    boolean overlaps = false;
+//                    for ( int k = 0; k < positionList.size(); k++ )
+//                    {
+//                        Position pos = positionList.get( k );
+//                        if ( pos.overlapsWith( tokens[i].getOffset(), tokens[i].getLength() ) )
+//                        {
+//                            overlaps = true;
+//                            break;
+//                        }
+//                    }
+//                    if ( !overlaps )
+//                    {
+//                        Annotation annotation = new Annotation( "DEFAULT", true, tokens[i].getValue() ); //$NON-NLS-1$
+//                        Position position = new Position( tokens[i].getOffset(), tokens[i].getLength() );
+//                        sourceViewer.getAnnotationModel().addAnnotation( annotation, position );
+//                    }
+//                }
+//            }
+//        }
+//    }
 
 }

Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterSourceViewerConfiguration.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterSourceViewerConfiguration.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterSourceViewerConfiguration.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterSourceViewerConfiguration.java Fri Aug 20 17:07:19 2010
@@ -21,26 +21,6 @@
 package org.apache.directory.studio.ldapbrowser.common.filtereditor;
 
 
-import org.apache.directory.studio.ldapbrowser.common.widgets.DialogContentAssistant;
-import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterParser;
-import org.eclipse.jface.text.DefaultInformationControl;
-import org.eclipse.jface.text.IAutoEditStrategy;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.ITextHover;
-import org.eclipse.jface.text.contentassist.IContentAssistant;
-import org.eclipse.jface.text.formatter.ContentFormatter;
-import org.eclipse.jface.text.formatter.IContentFormatter;
-import org.eclipse.jface.text.presentation.IPresentationReconciler;
-import org.eclipse.jface.text.presentation.PresentationReconciler;
-import org.eclipse.jface.text.reconciler.IReconciler;
-import org.eclipse.jface.text.reconciler.MonoReconciler;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
 
 
 /**
@@ -49,192 +29,192 @@ import org.eclipse.swt.widgets.Shell;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class FilterSourceViewerConfiguration extends SourceViewerConfiguration
+public class FilterSourceViewerConfiguration /*extends SourceViewerConfiguration*/
 {
 
-    /** The current connection, used to retrieve schema information. */
-    private IBrowserConnection connection;
-
-    /** The filter parser. */
-    private LdapFilterParser parser;
-
-    /** The presentation reconciler, used for syntax highlighting. */
-    private PresentationReconciler presentationReconciler;
-
-    /** The damager repairer, used for syntax highlighting. */
-    private FilterDamagerRepairer damagerRepairer;
-
-    /** The reconciler, used to maintain error annotations. */
-    private MonoReconciler reconciler;
-
-    /** The reconciling strategy, used to maintain error annotations. */
-    private FilterReconcilingStrategy reconcilingStrategy;
-
-    /** The text hover, used to display error message tooltips. */
-    private FilterTextHover textHover;
-
-    /** The auto edit strategy, used for smart parentesis handling. */
-    private FilterAutoEditStrategy[] autoEditStrategies;
-
-    /** The formatter, used to format the filter. */
-    private ContentFormatter formatter;
-
-    /** The formatting strategy, used to format the filter. */
-    private FilterFormattingStrategy formattingStrategy;
-
-    /** The content assistant, used for content proposals. */
-    private DialogContentAssistant contentAssistant;
-
-    /** The content assist processor, used for content proposals. */
-    private FilterContentAssistProcessor contentAssistProcessor;
-
-
-    /**
-     * Creates a new instance of FilterSourceViewerConfiguration.
-     * 
-     * @param parser the filer parser
-     * @param connection the connection
-     */
-    public FilterSourceViewerConfiguration( LdapFilterParser parser, IBrowserConnection connection )
-    {
-        this.parser = parser;
-        this.connection = connection;
-    }
-
-
-    /**
-     * Sets the connection.
-     * 
-     * @param connection the connection
-     */
-    public void setConnection( IBrowserConnection connection )
-    {
-        this.connection = connection;
-        contentAssistProcessor.setSchema( connection == null ? null : connection.getSchema() );
-        textHover.setSchema( connection == null ? null : connection.getSchema() );
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(org.eclipse.jface.text.source.ISourceViewer)
-     */
-    public IPresentationReconciler getPresentationReconciler( ISourceViewer sourceViewer )
-    {
-        if ( damagerRepairer == null )
-        {
-            damagerRepairer = new FilterDamagerRepairer( parser );
-        }
-        if ( presentationReconciler == null )
-        {
-            presentationReconciler = new PresentationReconciler();
-            presentationReconciler.setDamager( damagerRepairer, IDocument.DEFAULT_CONTENT_TYPE );
-            presentationReconciler.setRepairer( damagerRepairer, IDocument.DEFAULT_CONTENT_TYPE );
-        }
-        return presentationReconciler;
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getTextHover(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
-     */
-    public ITextHover getTextHover( ISourceViewer sourceViewer, String contentType )
-    {
-        if ( textHover == null )
-        {
-            textHover = new FilterTextHover( parser );
-            textHover.setSchema( connection == null ? null : connection.getSchema() );
-        }
-        return textHover;
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer)
-     */
-    public IReconciler getReconciler( ISourceViewer sourceViewer )
-    {
-        if ( reconcilingStrategy == null )
-        {
-            reconcilingStrategy = new FilterReconcilingStrategy( sourceViewer, parser );
-        }
-        if ( reconciler == null )
-        {
-            reconciler = new MonoReconciler( reconcilingStrategy, false );
-        }
-        return reconciler;
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
-     */
-    public IAutoEditStrategy[] getAutoEditStrategies( ISourceViewer sourceViewer, String contentType )
-    {
-        if ( autoEditStrategies == null )
-        {
-            autoEditStrategies = new FilterAutoEditStrategy[]
-                { new FilterAutoEditStrategy( parser ) };
-        }
-        return autoEditStrategies;
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentFormatter(org.eclipse.jface.text.source.ISourceViewer)
-     */
-    public IContentFormatter getContentFormatter( ISourceViewer sourceViewer )
-    {
-        if ( formattingStrategy == null )
-        {
-            formattingStrategy = new FilterFormattingStrategy( sourceViewer, parser );
-        }
-        if ( formatter == null )
-        {
-            formatter = new ContentFormatter();
-            formatter.enablePartitionAwareFormatting( false );
-            formatter.setFormattingStrategy( formattingStrategy, IDocument.DEFAULT_CONTENT_TYPE );
-        }
-        return formatter;
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(org.eclipse.jface.text.source.ISourceViewer)
-     */
-    public IContentAssistant getContentAssistant( ISourceViewer sourceViewer )
-    {
-        if ( contentAssistProcessor == null )
-        {
-            contentAssistProcessor = new FilterContentAssistProcessor( sourceViewer, parser );
-            contentAssistProcessor.setSchema( connection == null ? null : connection.getSchema() );
-        }
-        if ( contentAssistant == null )
-        {
-            contentAssistant = new DialogContentAssistant();
-            contentAssistant.enableAutoInsert( true );
-            contentAssistant.setContentAssistProcessor( contentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE );
-            contentAssistant.enableAutoActivation( true );
-            contentAssistant.setAutoActivationDelay( 100 );
-
-            contentAssistant.setContextInformationPopupOrientation( IContentAssistant.CONTEXT_INFO_ABOVE );
-            contentAssistant.setInformationControlCreator( getInformationControlCreator( sourceViewer ) );
-
-        }
-        return contentAssistant;
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getInformationControlCreator(org.eclipse.jface.text.source.ISourceViewer)
-     */
-    public IInformationControlCreator getInformationControlCreator( ISourceViewer sourceViewer )
-    {
-        return new IInformationControlCreator()
-        {
-            public IInformationControl createInformationControl( Shell parent )
-            {
-                return new DefaultInformationControl( parent, SWT.WRAP, null );
-            }
-        };
-    }
+//    /** The current connection, used to retrieve schema information. */
+//    private IBrowserConnection connection;
+//
+//    /** The filter parser. */
+//    private LdapFilterParser parser;
+//
+//    /** The presentation reconciler, used for syntax highlighting. */
+//    private PresentationReconciler presentationReconciler;
+//
+//    /** The damager repairer, used for syntax highlighting. */
+//    private FilterDamagerRepairer damagerRepairer;
+//
+//    /** The reconciler, used to maintain error annotations. */
+//    private MonoReconciler reconciler;
+//
+//    /** The reconciling strategy, used to maintain error annotations. */
+//    private FilterReconcilingStrategy reconcilingStrategy;
+//
+//    /** The text hover, used to display error message tooltips. */
+//    private FilterTextHover textHover;
+//
+//    /** The auto edit strategy, used for smart parentesis handling. */
+//    private FilterAutoEditStrategy[] autoEditStrategies;
+//
+//    /** The formatter, used to format the filter. */
+//    private ContentFormatter formatter;
+//
+//    /** The formatting strategy, used to format the filter. */
+//    private FilterFormattingStrategy formattingStrategy;
+//
+//    /** The content assistant, used for content proposals. */
+//    private DialogContentAssistant contentAssistant;
+//
+//    /** The content assist processor, used for content proposals. */
+//    private FilterContentAssistProcessor contentAssistProcessor;
+//
+//
+//    /**
+//     * Creates a new instance of FilterSourceViewerConfiguration.
+//     * 
+//     * @param parser the filer parser
+//     * @param connection the connection
+//     */
+//    public FilterSourceViewerConfiguration( LdapFilterParser parser, IBrowserConnection connection )
+//    {
+//        this.parser = parser;
+//        this.connection = connection;
+//    }
+//
+//
+//    /**
+//     * Sets the connection.
+//     * 
+//     * @param connection the connection
+//     */
+//    public void setConnection( IBrowserConnection connection )
+//    {
+//        this.connection = connection;
+//        contentAssistProcessor.setSchema( connection == null ? null : connection.getSchema() );
+//        textHover.setSchema( connection == null ? null : connection.getSchema() );
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(org.eclipse.jface.text.source.ISourceViewer)
+//     */
+//    public IPresentationReconciler getPresentationReconciler( ISourceViewer sourceViewer )
+//    {
+//        if ( damagerRepairer == null )
+//        {
+//            damagerRepairer = new FilterDamagerRepairer( parser );
+//        }
+//        if ( presentationReconciler == null )
+//        {
+//            presentationReconciler = new PresentationReconciler();
+//            presentationReconciler.setDamager( damagerRepairer, IDocument.DEFAULT_CONTENT_TYPE );
+//            presentationReconciler.setRepairer( damagerRepairer, IDocument.DEFAULT_CONTENT_TYPE );
+//        }
+//        return presentationReconciler;
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getTextHover(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
+//     */
+//    public ITextHover getTextHover( ISourceViewer sourceViewer, String contentType )
+//    {
+//        if ( textHover == null )
+//        {
+//            textHover = new FilterTextHover( parser );
+//            textHover.setSchema( connection == null ? null : connection.getSchema() );
+//        }
+//        return textHover;
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer)
+//     */
+//    public IReconciler getReconciler( ISourceViewer sourceViewer )
+//    {
+//        if ( reconcilingStrategy == null )
+//        {
+//            reconcilingStrategy = new FilterReconcilingStrategy( sourceViewer, parser );
+//        }
+//        if ( reconciler == null )
+//        {
+//            reconciler = new MonoReconciler( reconcilingStrategy, false );
+//        }
+//        return reconciler;
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
+//     */
+//    public IAutoEditStrategy[] getAutoEditStrategies( ISourceViewer sourceViewer, String contentType )
+//    {
+//        if ( autoEditStrategies == null )
+//        {
+//            autoEditStrategies = new FilterAutoEditStrategy[]
+//                { new FilterAutoEditStrategy( parser ) };
+//        }
+//        return autoEditStrategies;
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentFormatter(org.eclipse.jface.text.source.ISourceViewer)
+//     */
+//    public IContentFormatter getContentFormatter( ISourceViewer sourceViewer )
+//    {
+//        if ( formattingStrategy == null )
+//        {
+//            formattingStrategy = new FilterFormattingStrategy( sourceViewer, parser );
+//        }
+//        if ( formatter == null )
+//        {
+//            formatter = new ContentFormatter();
+//            formatter.enablePartitionAwareFormatting( false );
+//            formatter.setFormattingStrategy( formattingStrategy, IDocument.DEFAULT_CONTENT_TYPE );
+//        }
+//        return formatter;
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(org.eclipse.jface.text.source.ISourceViewer)
+//     */
+//    public IContentAssistant getContentAssistant( ISourceViewer sourceViewer )
+//    {
+//        if ( contentAssistProcessor == null )
+//        {
+//            contentAssistProcessor = new FilterContentAssistProcessor( sourceViewer, parser );
+//            contentAssistProcessor.setSchema( connection == null ? null : connection.getSchema() );
+//        }
+//        if ( contentAssistant == null )
+//        {
+//            contentAssistant = new DialogContentAssistant();
+//            contentAssistant.enableAutoInsert( true );
+//            contentAssistant.setContentAssistProcessor( contentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE );
+//            contentAssistant.enableAutoActivation( true );
+//            contentAssistant.setAutoActivationDelay( 100 );
+//
+//            contentAssistant.setContextInformationPopupOrientation( IContentAssistant.CONTEXT_INFO_ABOVE );
+//            contentAssistant.setInformationControlCreator( getInformationControlCreator( sourceViewer ) );
+//
+//        }
+//        return contentAssistant;
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getInformationControlCreator(org.eclipse.jface.text.source.ISourceViewer)
+//     */
+//    public IInformationControlCreator getInformationControlCreator( ISourceViewer sourceViewer )
+//    {
+//        return new IInformationControlCreator()
+//        {
+//            public IInformationControl createInformationControl( Shell parent )
+//            {
+//                return new DefaultInformationControl( parent, SWT.WRAP, null );
+//            }
+//        };
+//    }
 }

Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterTextHover.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterTextHover.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterTextHover.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/filtereditor/FilterTextHover.java Fri Aug 20 17:07:19 2010
@@ -21,21 +21,6 @@
 package org.apache.directory.studio.ldapbrowser.common.filtereditor;
 
 
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.schema.parsers.AttributeTypeDescription;
-import org.apache.directory.shared.ldap.schema.parsers.MatchingRuleDescription;
-import org.apache.directory.shared.ldap.schema.parsers.ObjectClassDescription;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.LdapFilter;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.LdapFilterExtensibleComponent;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.LdapFilterItemComponent;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterParser;
-import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterToken;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextHover;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.Region;
 
 
 /**
@@ -43,142 +28,142 @@ import org.eclipse.jface.text.Region;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class FilterTextHover implements ITextHover
+public class FilterTextHover /*implements ITextHover*/
 {
-
-    /** The filter parser. */
-    private LdapFilterParser parser;
-
-    /** The schema, used to retrieve attributeType and objectClass information. */
-    private Schema schema;
-
-
-    /**
-     * Creates a new instance of FilterTextHover.
-     *
-     * @param parser filter parser
-     */
-    public FilterTextHover( LdapFilterParser parser )
-    {
-        this.parser = parser;
-    }
-
-
-    /**
-     * Sets the schema, used to retrieve attributeType and objectClass information.
-     * 
-     * @param schema the schema
-     */
-    public void setSchema( Schema schema )
-    {
-        this.schema = schema;
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.ITextHover#getHoverInfo(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
-     */
-    public String getHoverInfo( ITextViewer textViewer, IRegion hoverRegion )
-    {
-        // check attribute type, object class or matching rule values
-        if ( schema != null )
-        {
-            LdapFilter filter = parser.getModel().getFilter( hoverRegion.getOffset() );
-
-            if ( filter.getFilterComponent() instanceof LdapFilterItemComponent )
-            {
-                LdapFilterItemComponent fc = ( LdapFilterItemComponent ) filter.getFilterComponent();
-                if ( fc.getAttributeToken() != null
-                    && fc.getAttributeToken().getOffset() <= hoverRegion.getOffset()
-                    && hoverRegion.getOffset() <= fc.getAttributeToken().getOffset()
-                        + fc.getAttributeToken().getLength() )
-                {
-                    String attributeType = fc.getAttributeToken().getValue();
-                    AttributeTypeDescription attributeTypeDescription = schema
-                        .getAttributeTypeDescription( attributeType );
-                    String ldifLine = SchemaUtils.getLdifLine( attributeTypeDescription );
-                    return ldifLine;
-                }
-                if ( fc.getAttributeToken() != null
-                    && SchemaConstants.OBJECT_CLASS_AT.equalsIgnoreCase( fc.getAttributeToken().getValue() )
-                    && fc.getValueToken() != null && fc.getValueToken().getOffset() <= hoverRegion.getOffset()
-                    && hoverRegion.getOffset() <= fc.getValueToken().getOffset() + fc.getValueToken().getLength() )
-                {
-                    String objectClass = fc.getValueToken().getValue();
-                    ObjectClassDescription objectClassDescription = schema.getObjectClassDescription( objectClass );
-                    String ldifLine = SchemaUtils.getLdifLine( objectClassDescription );
-                    return ldifLine;
-                }
-            }
-            if ( filter.getFilterComponent() instanceof LdapFilterExtensibleComponent )
-            {
-                LdapFilterExtensibleComponent fc = ( LdapFilterExtensibleComponent ) filter.getFilterComponent();
-                if ( fc.getAttributeToken() != null
-                    && fc.getAttributeToken().getOffset() <= hoverRegion.getOffset()
-                    && hoverRegion.getOffset() <= fc.getAttributeToken().getOffset()
-                        + fc.getAttributeToken().getLength() )
-                {
-                    String attributeType = fc.getAttributeToken().getValue();
-                    AttributeTypeDescription attributeTypeDescription = schema
-                        .getAttributeTypeDescription( attributeType );
-                    String ldifLine = SchemaUtils.getLdifLine( attributeTypeDescription );
-                    return ldifLine;
-                }
-                if ( fc.getMatchingRuleToken() != null
-                    && fc.getMatchingRuleToken().getOffset() <= hoverRegion.getOffset()
-                    && hoverRegion.getOffset() <= fc.getMatchingRuleToken().getOffset()
-                        + fc.getMatchingRuleToken().getLength() )
-                {
-                    String matchingRule = fc.getMatchingRuleToken().getValue();
-                    MatchingRuleDescription matchingRuleDescription = schema.getMatchingRuleDescription( matchingRule );
-                    String info = SchemaUtils.getLdifLine( matchingRuleDescription );
-                    return info;
-                }
-            }
-        }
-
-        // check invalid tokens
-        LdapFilter[] invalidFilters = parser.getModel().getInvalidFilters();
-        for ( int i = 0; i < invalidFilters.length; i++ )
-        {
-            if ( invalidFilters[i].getStartToken() != null )
-            {
-                int start = invalidFilters[i].getStartToken().getOffset();
-                int stop = invalidFilters[i].getStopToken() != null ? invalidFilters[i].getStopToken().getOffset()
-                    + invalidFilters[i].getStopToken().getLength() : start
-                    + invalidFilters[i].getStartToken().getLength();
-                if ( start <= hoverRegion.getOffset() && hoverRegion.getOffset() < stop )
-                {
-                    return invalidFilters[i].getInvalidCause();
-                }
-            }
-        }
-
-        // check error tokens
-        LdapFilterToken[] tokens = parser.getModel().getTokens();
-        for ( int i = 0; i < tokens.length; i++ )
-        {
-            if ( tokens[i].getType() == LdapFilterToken.ERROR )
-            {
-
-                int start = tokens[i].getOffset();
-                int stop = start + tokens[i].getLength();
-                if ( start <= hoverRegion.getOffset() && hoverRegion.getOffset() < stop )
-                {
-                    return Messages.getString( "FilterTextHover.InvalidCharacters" ); //$NON-NLS-1$
-                }
-            }
-        }
-        return null;
-    }
-
-
-    /**
-     * @see org.eclipse.jface.text.ITextHover#getHoverRegion(org.eclipse.jface.text.ITextViewer, int)
-     */
-    public IRegion getHoverRegion( ITextViewer textViewer, int offset )
-    {
-        return new Region( offset, 1 );
-    }
+//
+//    /** The filter parser. */
+//    private LdapFilterParser parser;
+//
+//    /** The schema, used to retrieve attributeType and objectClass information. */
+//    private Schema schema;
+//
+//
+//    /**
+//     * Creates a new instance of FilterTextHover.
+//     *
+//     * @param parser filter parser
+//     */
+//    public FilterTextHover( LdapFilterParser parser )
+//    {
+//        this.parser = parser;
+//    }
+//
+//
+//    /**
+//     * Sets the schema, used to retrieve attributeType and objectClass information.
+//     * 
+//     * @param schema the schema
+//     */
+//    public void setSchema( Schema schema )
+//    {
+//        this.schema = schema;
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.ITextHover#getHoverInfo(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
+//     */
+//    public String getHoverInfo( ITextViewer textViewer, IRegion hoverRegion )
+//    {
+//        // check attribute type, object class or matching rule values
+//        if ( schema != null )
+//        {
+//            LdapFilter filter = parser.getModel().getFilter( hoverRegion.getOffset() );
+//
+//            if ( filter.getFilterComponent() instanceof LdapFilterItemComponent )
+//            {
+//                LdapFilterItemComponent fc = ( LdapFilterItemComponent ) filter.getFilterComponent();
+//                if ( fc.getAttributeToken() != null
+//                    && fc.getAttributeToken().getOffset() <= hoverRegion.getOffset()
+//                    && hoverRegion.getOffset() <= fc.getAttributeToken().getOffset()
+//                        + fc.getAttributeToken().getLength() )
+//                {
+//                    String attributeType = fc.getAttributeToken().getValue();
+//                    AttributeTypeDescription attributeTypeDescription = schema
+//                        .getAttributeTypeDescription( attributeType );
+//                    String ldifLine = SchemaUtils.getLdifLine( attributeTypeDescription );
+//                    return ldifLine;
+//                }
+//                if ( fc.getAttributeToken() != null
+//                    && SchemaConstants.OBJECT_CLASS_AT.equalsIgnoreCase( fc.getAttributeToken().getValue() )
+//                    && fc.getValueToken() != null && fc.getValueToken().getOffset() <= hoverRegion.getOffset()
+//                    && hoverRegion.getOffset() <= fc.getValueToken().getOffset() + fc.getValueToken().getLength() )
+//                {
+//                    String objectClass = fc.getValueToken().getValue();
+//                    ObjectClassDescription objectClassDescription = schema.getObjectClassDescription( objectClass );
+//                    String ldifLine = SchemaUtils.getLdifLine( objectClassDescription );
+//                    return ldifLine;
+//                }
+//            }
+//            if ( filter.getFilterComponent() instanceof LdapFilterExtensibleComponent )
+//            {
+//                LdapFilterExtensibleComponent fc = ( LdapFilterExtensibleComponent ) filter.getFilterComponent();
+//                if ( fc.getAttributeToken() != null
+//                    && fc.getAttributeToken().getOffset() <= hoverRegion.getOffset()
+//                    && hoverRegion.getOffset() <= fc.getAttributeToken().getOffset()
+//                        + fc.getAttributeToken().getLength() )
+//                {
+//                    String attributeType = fc.getAttributeToken().getValue();
+//                    AttributeTypeDescription attributeTypeDescription = schema
+//                        .getAttributeTypeDescription( attributeType );
+//                    String ldifLine = SchemaUtils.getLdifLine( attributeTypeDescription );
+//                    return ldifLine;
+//                }
+//                if ( fc.getMatchingRuleToken() != null
+//                    && fc.getMatchingRuleToken().getOffset() <= hoverRegion.getOffset()
+//                    && hoverRegion.getOffset() <= fc.getMatchingRuleToken().getOffset()
+//                        + fc.getMatchingRuleToken().getLength() )
+//                {
+//                    String matchingRule = fc.getMatchingRuleToken().getValue();
+//                    MatchingRuleDescription matchingRuleDescription = schema.getMatchingRuleDescription( matchingRule );
+//                    String info = SchemaUtils.getLdifLine( matchingRuleDescription );
+//                    return info;
+//                }
+//            }
+//        }
+//
+//        // check invalid tokens
+//        LdapFilter[] invalidFilters = parser.getModel().getInvalidFilters();
+//        for ( int i = 0; i < invalidFilters.length; i++ )
+//        {
+//            if ( invalidFilters[i].getStartToken() != null )
+//            {
+//                int start = invalidFilters[i].getStartToken().getOffset();
+//                int stop = invalidFilters[i].getStopToken() != null ? invalidFilters[i].getStopToken().getOffset()
+//                    + invalidFilters[i].getStopToken().getLength() : start
+//                    + invalidFilters[i].getStartToken().getLength();
+//                if ( start <= hoverRegion.getOffset() && hoverRegion.getOffset() < stop )
+//                {
+//                    return invalidFilters[i].getInvalidCause();
+//                }
+//            }
+//        }
+//
+//        // check error tokens
+//        LdapFilterToken[] tokens = parser.getModel().getTokens();
+//        for ( int i = 0; i < tokens.length; i++ )
+//        {
+//            if ( tokens[i].getType() == LdapFilterToken.ERROR )
+//            {
+//
+//                int start = tokens[i].getOffset();
+//                int stop = start + tokens[i].getLength();
+//                if ( start <= hoverRegion.getOffset() && hoverRegion.getOffset() < stop )
+//                {
+//                    return Messages.getString( "FilterTextHover.InvalidCharacters" ); //$NON-NLS-1$
+//                }
+//            }
+//        }
+//        return null;
+//    }
+//
+//
+//    /**
+//     * @see org.eclipse.jface.text.ITextHover#getHoverRegion(org.eclipse.jface.text.ITextViewer, int)
+//     */
+//    public IRegion getHoverRegion( ITextViewer textViewer, int offset )
+//    {
+//        return new Region( offset, 1 );
+//    }
 
 }

Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DialogContentAssistant.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DialogContentAssistant.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DialogContentAssistant.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DialogContentAssistant.java Fri Aug 20 17:07:19 2010
@@ -21,24 +21,8 @@
 package org.apache.directory.studio.ldapbrowser.common.widgets;
 
 
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.jface.contentassist.ComboContentAssistSubjectAdapter;
-import org.eclipse.jface.contentassist.SubjectControlContentAssistant;
-import org.eclipse.jface.contentassist.TextContentAssistSubjectAdapter;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.IHandlerActivation;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
 
 
 /**
@@ -53,167 +37,167 @@ import org.eclipse.ui.texteditor.ITextEd
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class DialogContentAssistant extends SubjectControlContentAssistant implements FocusListener
-{
-
-    /** The control */
-    private Control control;
-
-    /** The handler activation. */
-    private IHandlerActivation handlerActivation;
-
-    /** The possible completions visible. */
-    private boolean possibleCompletionsVisible;
-
-
-    /**
-     * Creates a new instance of DialogContentAssistant.
-     */
-    public DialogContentAssistant()
-    {
-        this.possibleCompletionsVisible = false;
-    }
-
-
-    /**
-     * Installs content assist on the given text.
-     *
-     * @param text the text
-     */
-    public void install( Text text )
-    {
-        control = text;
-        control.addFocusListener( this );
-        super.install( new TextContentAssistSubjectAdapter( text ) );
-    }
-
-
-    /**
-     * Installs content assist on the given combo.
-     *
-     * @param combo the combo
-     */
-    public void install( Combo combo )
-    {
-        control = combo;
-        control.addFocusListener( this );
-        super.install( new ComboContentAssistSubjectAdapter( combo ) );
-    }
-
-
-    /**
-     * Installs content assist on the given text viewer.
-     *
-     * @param viewer the text viewer
-     */
-    public void install( ITextViewer viewer )
-    {
-        control = viewer.getTextWidget();
-        control.addFocusListener( this );
-
-        // stop traversal (ESC) if popup is shown
-        control.addTraverseListener( new TraverseListener()
-        {
-            public void keyTraversed( TraverseEvent e )
-            {
-                if ( possibleCompletionsVisible )
-                {
-                    e.doit = false;
-                }
-            }
-        } );
-
-        super.install( viewer );
-    }
-
-
-    /**
-     * Uninstalls content assist on the control.
-     */
-    public void uninstall()
-    {
-        if ( handlerActivation != null )
-        {
-            IHandlerService handlerService = ( IHandlerService ) PlatformUI.getWorkbench().getAdapter(
-                IHandlerService.class );
-            handlerService.deactivateHandler( handlerActivation );
-            handlerActivation = null;
-        }
-
-        if ( control != null )
-        {
-            control.removeFocusListener( this );
-        }
-
-        super.uninstall();
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    protected Point restoreCompletionProposalPopupSize()
-    {
-        possibleCompletionsVisible = true;
-        return super.restoreCompletionProposalPopupSize();
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public String showPossibleCompletions()
-    {
-        possibleCompletionsVisible = true;
-        return super.showPossibleCompletions();
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    protected void possibleCompletionsClosed()
-    {
-        possibleCompletionsVisible = false;
-        super.possibleCompletionsClosed();
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void focusGained( FocusEvent e )
-    {
-        IHandlerService handlerService = ( IHandlerService ) PlatformUI.getWorkbench().getAdapter(
-            IHandlerService.class );
-        if ( handlerService != null )
-        {
-            IHandler handler = new org.eclipse.core.commands.AbstractHandler()
-            {
-                public Object execute( ExecutionEvent event ) throws org.eclipse.core.commands.ExecutionException
-                {
-                    showPossibleCompletions();
-                    return null;
-                }
-            };
-            handlerActivation = handlerService.activateHandler(
-                ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, handler );
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void focusLost( FocusEvent e )
-    {
-        if ( handlerActivation != null )
-        {
-            IHandlerService handlerService = ( IHandlerService ) PlatformUI.getWorkbench().getAdapter(
-                IHandlerService.class );
-            handlerService.deactivateHandler( handlerActivation );
-            handlerActivation = null;
-        }
-    }
+public class DialogContentAssistant /*extends SubjectControlContentAssistant implements FocusListener
+*/{
+//
+//    /** The control */
+//    private Control control;
+//
+//    /** The handler activation. */
+//    private IHandlerActivation handlerActivation;
+//
+//    /** The possible completions visible. */
+//    private boolean possibleCompletionsVisible;
+//
+//
+//    /**
+//     * Creates a new instance of DialogContentAssistant.
+//     */
+//    public DialogContentAssistant()
+//    {
+//        this.possibleCompletionsVisible = false;
+//    }
+//
+//
+//    /**
+//     * Installs content assist on the given text.
+//     *
+//     * @param text the text
+//     */
+//    public void install( Text text )
+//    {
+//        control = text;
+//        control.addFocusListener( this );
+//        super.install( new TextContentAssistSubjectAdapter( text ) );
+//    }
+//
+//
+//    /**
+//     * Installs content assist on the given combo.
+//     *
+//     * @param combo the combo
+//     */
+//    public void install( Combo combo )
+//    {
+//        control = combo;
+//        control.addFocusListener( this );
+//        super.install( new ComboContentAssistSubjectAdapter( combo ) );
+//    }
+//
+//
+//    /**
+//     * Installs content assist on the given text viewer.
+//     *
+//     * @param viewer the text viewer
+//     */
+//    public void install( ITextViewer viewer )
+//    {
+//        control = viewer.getTextWidget();
+//        control.addFocusListener( this );
+//
+//        // stop traversal (ESC) if popup is shown
+//        control.addTraverseListener( new TraverseListener()
+//        {
+//            public void keyTraversed( TraverseEvent e )
+//            {
+//                if ( possibleCompletionsVisible )
+//                {
+//                    e.doit = false;
+//                }
+//            }
+//        } );
+//
+//        super.install( viewer );
+//    }
+//
+//
+//    /**
+//     * Uninstalls content assist on the control.
+//     */
+//    public void uninstall()
+//    {
+//        if ( handlerActivation != null )
+//        {
+//            IHandlerService handlerService = ( IHandlerService ) PlatformUI.getWorkbench().getAdapter(
+//                IHandlerService.class );
+//            handlerService.deactivateHandler( handlerActivation );
+//            handlerActivation = null;
+//        }
+//
+//        if ( control != null )
+//        {
+//            control.removeFocusListener( this );
+//        }
+//
+//        super.uninstall();
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     */
+//    protected Point restoreCompletionProposalPopupSize()
+//    {
+//        possibleCompletionsVisible = true;
+//        return super.restoreCompletionProposalPopupSize();
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     */
+//    public String showPossibleCompletions()
+//    {
+//        possibleCompletionsVisible = true;
+//        return super.showPossibleCompletions();
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     */
+//    protected void possibleCompletionsClosed()
+//    {
+//        possibleCompletionsVisible = false;
+//        super.possibleCompletionsClosed();
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     */
+//    public void focusGained( FocusEvent e )
+//    {
+//        IHandlerService handlerService = ( IHandlerService ) PlatformUI.getWorkbench().getAdapter(
+//            IHandlerService.class );
+//        if ( handlerService != null )
+//        {
+//            IHandler handler = new org.eclipse.core.commands.AbstractHandler()
+//            {
+//                public Object execute( ExecutionEvent event ) throws org.eclipse.core.commands.ExecutionException
+//                {
+//                    showPossibleCompletions();
+//                    return null;
+//                }
+//            };
+//            handlerActivation = handlerService.activateHandler(
+//                ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, handler );
+//        }
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     */
+//    public void focusLost( FocusEvent e )
+//    {
+//        if ( handlerActivation != null )
+//        {
+//            IHandlerService handlerService = ( IHandlerService ) PlatformUI.getWorkbench().getAdapter(
+//                IHandlerService.class );
+//            handlerService.deactivateHandler( handlerActivation );
+//            handlerActivation = null;
+//        }
+//    }
 
 }

Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java Fri Aug 20 17:07:19 2010
@@ -462,8 +462,8 @@ public class DnBuilderWidget extends Bro
         GridData gd = new GridData();
         gd.widthHint = 180;
         rdnLine.rdnTypeCombo.setLayoutData( gd );
-        rdnLine.rdnNameCPA = new ExtendedContentAssistCommandAdapter( rdnLine.rdnTypeCombo, new ComboContentAdapter(),
-            new ListContentProposalProvider( attributeNames ), null, null, true );
+//        rdnLine.rdnNameCPA = new ExtendedContentAssistCommandAdapter( rdnLine.rdnTypeCombo, new ComboContentAdapter(),
+//            new ListContentProposalProvider( attributeNames ), null, null, true );
 
         rdnLine.rdnEqualsLabel = new Label( rdnComposite, SWT.NONE );
         rdnLine.rdnEqualsLabel.setText( "=" ); //$NON-NLS-1$

Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/FileBrowserWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/FileBrowserWidget.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/FileBrowserWidget.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/FileBrowserWidget.java Fri Aug 20 17:07:19 2010
@@ -21,10 +21,7 @@
 package org.apache.directory.studio.ldapbrowser.common.widgets;
 
 
-import java.io.File;
-
 import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
-import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
@@ -34,7 +31,6 @@ import org.eclipse.swt.events.SelectionE
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.FileDialog;
 
 
 /**
@@ -107,35 +103,35 @@ public class FileBrowserWidget extends B
         {
             public void widgetSelected( SelectionEvent event )
             {
-                FileDialog fileDialog = new FileDialog( parent.getShell(), type );
-                fileDialog.setText( title );
-
-                fileDialog.setFilterExtensions( extensions );
-
-                File file = new File( fileCombo.getText() );
-                if ( file.isFile() )
-                {
-                    fileDialog.setFilterPath( file.getParent() );
-                    fileDialog.setFileName( file.getName() );
-                }
-                else if ( file.isDirectory() )
-                {
-                    fileDialog.setFilterPath( file.getPath() );
-                }
-                else
-                {
-                    fileDialog.setFilterPath( BrowserCommonActivator.getDefault().getDialogSettings().get(
-                        BrowserCommonConstants.DIALOGSETTING_KEY_RECENT_FILE_PATH ) );
-                }
-
-                String returnedFileName = fileDialog.open();
-                if ( returnedFileName != null )
-                {
-                    fileCombo.setText( returnedFileName );
-                    File file2 = new File( returnedFileName );
-                    BrowserCommonActivator.getDefault().getDialogSettings().put(
-                        BrowserCommonConstants.DIALOGSETTING_KEY_RECENT_FILE_PATH, file2.getParent() );
-                }
+//                FileDialog fileDialog = new FileDialog( parent.getShell(), type );
+//                fileDialog.setText( title );
+//
+//                fileDialog.setFilterExtensions( extensions );
+//
+//                File file = new File( fileCombo.getText() );
+//                if ( file.isFile() )
+//                {
+//                    fileDialog.setFilterPath( file.getParent() );
+//                    fileDialog.setFileName( file.getName() );
+//                }
+//                else if ( file.isDirectory() )
+//                {
+//                    fileDialog.setFilterPath( file.getPath() );
+//                }
+//                else
+//                {
+//                    fileDialog.setFilterPath( BrowserCommonActivator.getDefault().getDialogSettings().get(
+//                        BrowserCommonConstants.DIALOGSETTING_KEY_RECENT_FILE_PATH ) );
+//                }
+//
+//                String returnedFileName = fileDialog.open();
+//                if ( returnedFileName != null )
+//                {
+//                    fileCombo.setText( returnedFileName );
+//                    File file2 = new File( returnedFileName );
+//                    BrowserCommonActivator.getDefault().getDialogSettings().put(
+//                        BrowserCommonConstants.DIALOGSETTING_KEY_RECENT_FILE_PATH, file2.getParent() );
+//                }
             }
         } );
 

Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/ModWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/ModWidget.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/ModWidget.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/ModWidget.java Fri Aug 20 17:07:19 2010
@@ -247,8 +247,8 @@ public class ModWidget extends BrowserWi
 
         // attribute combo with field decoration and content proposal
         modSpec.modAttributeCombo = BaseWidgetUtils.createCombo( modSpecComposite, new String[0], -1, 1 );
-        new ExtendedContentAssistCommandAdapter( modSpec.modAttributeCombo, new ComboContentAdapter(),
-            new ListContentProposalProvider( attributeDescriptions ), null, null, true );
+//        new ExtendedContentAssistCommandAdapter( modSpec.modAttributeCombo, new ComboContentAdapter(),
+//            new ListContentProposalProvider( attributeDescriptions ), null, null, true );
 
         // add button with listener
         modSpec.modAddButton = new Button( modComposite, SWT.PUSH );

Modified: directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java?rev=987577&r1=987576&r2=987577&view=diff
==============================================================================
--- directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java (original)
+++ directory/studio/branches/studio-rap/plugins/ldapbrowser.common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserActionGroup.java Fri Aug 20 17:07:19 2010
@@ -237,30 +237,30 @@ public class BrowserActionGroup implemen
      */
     public void activateGlobalActionHandlers()
     {
-        if ( actionBars != null )
-        {
-            actionBars.setGlobalActionHandler( ActionFactory.REFRESH.getId(), ( IAction ) browserActionMap
-                .get( refreshAction ) );
-            actionBars.setGlobalActionHandler( ActionFactory.PROPERTIES.getId(), ( IAction ) browserActionMap
-                .get( propertyDialogAction ) );
-            actionBars.setGlobalActionHandler( ActionFactory.FIND.getId(), showQuickSearchAction ); // IWorkbenchActionDefinitionIds.FIND_REPLACE
-            actionBars.updateActionBars();
-        }
-        else
-        {
-            IAction pda = browserActionMap.get( propertyDialogAction );
-            pda.setActionDefinitionId( BrowserCommonConstants.CMD_PROPERTIES );
-            ActionUtils.activateActionHandler( pda );
-
-            IAction ra = browserActionMap.get( refreshAction );
-            ActionUtils.activateActionHandler( ra );
-
-            showQuickSearchAction.setActionDefinitionId( BrowserCommonConstants.CMD_FIND );
-            ActionUtils.activateActionHandler( showQuickSearchAction );
-        }
-
-        IAction ua = browserActionMap.get( upAction );
-        ActionUtils.activateActionHandler( ua );
+//        if ( actionBars != null )
+//        {
+//            actionBars.setGlobalActionHandler( ActionFactory.REFRESH.getId(), ( IAction ) browserActionMap
+//                .get( refreshAction ) );
+//            actionBars.setGlobalActionHandler( ActionFactory.PROPERTIES.getId(), ( IAction ) browserActionMap
+//                .get( propertyDialogAction ) );
+//            actionBars.setGlobalActionHandler( ActionFactory.FIND.getId(), showQuickSearchAction ); // IWorkbenchActionDefinitionIds.FIND_REPLACE
+//            actionBars.updateActionBars();
+//        }
+//        else
+//        {
+//            IAction pda = browserActionMap.get( propertyDialogAction );
+//            pda.setActionDefinitionId( BrowserCommonConstants.CMD_PROPERTIES );
+//            ActionUtils.activateActionHandler( pda );
+//
+//            IAction ra = browserActionMap.get( refreshAction );
+//            ActionUtils.activateActionHandler( ra );
+//
+//            showQuickSearchAction.setActionDefinitionId( BrowserCommonConstants.CMD_FIND );
+//            ActionUtils.activateActionHandler( showQuickSearchAction );
+//        }
+//
+//        IAction ua = browserActionMap.get( upAction );
+//        ActionUtils.activateActionHandler( ua );
     }
 
 



Mime
View raw message