001    /*
002      Copyright (C) 2003 Renaud Pawlak <renaud@aopsys.com>
003      
004      This program is free software; you can redistribute it and/or modify
005      it under the terms of the GNU Lesser General Public License as
006      published by the Free Software Foundation; either version 2 of the
007      License, or (at your option) any later version.
008    
009      This program is distributed in the hope that it will be useful, but
010      WITHOUT ANY WARRANTY; without even the implied warranty of
011      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012      Lesser General Public License for more details.
013    
014      You should have received a copy of the GNU Lesser General Public
015      License along with this program; if not, write to the Free Software
016      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
017      USA */
018    
019    package org.objectweb.jac.aspects.gui.swing;
020    
021    import java.util.List;
022    
023    /**
024     * This class implements a default completion engines for editors. It
025     * is non contextual (i.e. the proposed completions are always the
026     * same and are the ones defined by <code>addBaseWord</code>. */
027    
028    public class DefaultCompletionEngine extends CompletionEngine {
029    
030       /**
031        * In the default completion engine, this method only returns base
032        * words (i.e. non-contextual words).
033        * 
034        * @param text the editor's full text
035        * @param position the cursor position
036        * @param writtenText the already written text */
037    
038       public List getContextualChoices(String text, int position, 
039                                        String writtenText) {
040          return baseWords;
041       }
042    
043       /**
044        * This method always returns false (no automatic completion is
045        * supported). */
046    
047       public boolean isAutomaticCompletionChar(char c) {
048          return false;
049       }
050       
051       /**
052        * Do nothing (anyway it is never called because
053        * <code>isAutomaticCompletionChar</code> always returns
054        * false). */
055       
056       public void runAutomaticCompletion(SHEditor editor,
057                                          String text, 
058                                          int position,
059                                          char c) {}
060       
061    }