KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > aspects > gui > swing > DefaultCompletionEngine


1 /*
2   Copyright (C) 2003 Renaud Pawlak <renaud@aopsys.com>
3   
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU Lesser General Public License as
6   published by the Free Software Foundation; either version 2 of the
7   License, or (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful, but
10   WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12   Lesser General Public License for more details.
13
14   You should have received a copy of the GNU Lesser General Public
15   License along with this program; if not, write to the Free Software
16   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17   USA */

18
19 package org.objectweb.jac.aspects.gui.swing;
20
21 import java.util.List JavaDoc;
22
23 /**
24  * This class implements a default completion engines for editors. It
25  * is non contextual (i.e. the proposed completions are always the
26  * same and are the ones defined by <code>addBaseWord</code>. */

27
28 public class DefaultCompletionEngine extends CompletionEngine {
29
30    /**
31     * In the default completion engine, this method only returns base
32     * words (i.e. non-contextual words).
33     *
34     * @param text the editor's full text
35     * @param position the cursor position
36     * @param writtenText the already written text */

37
38    public List getContextualChoices(String JavaDoc text, int position,
39                                     String JavaDoc writtenText) {
40       return baseWords;
41    }
42
43    /**
44     * This method always returns false (no automatic completion is
45     * supported). */

46
47    public boolean isAutomaticCompletionChar(char c) {
48       return false;
49    }
50    
51    /**
52     * Do nothing (anyway it is never called because
53     * <code>isAutomaticCompletionChar</code> always returns
54     * false). */

55    
56    public void runAutomaticCompletion(SHEditor editor,
57                                       String JavaDoc text,
58                                       int position,
59                                       char c) {}
60    
61 }
62
Popular Tags