KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > schema > completion > spi > CompletionContext


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.xml.schema.completion.spi;
20
21 import java.net.URI JavaDoc;
22 import java.util.HashMap JavaDoc;
23 import java.util.List JavaDoc;
24 import javax.xml.namespace.QName JavaDoc;
25 import org.netbeans.editor.BaseDocument;
26 import org.openide.filesystems.FileObject;
27
28 /**
29  * Represents code completion context at the current cursor location.
30  *
31  * @author Samaresh (Samaresh.Panda@Sun.Com)
32  */

33 public abstract class CompletionContext {
34     
35     /**
36      * Returns true if schemaLocation attribute is specified
37      * in the root element, false otherwise.
38      */

39     public abstract boolean isSchemaAwareCompletion();
40     
41     /**
42      * Returns the list of schemas as specified in the schemaLocation
43      * attribute of the root element. Null if the attribute is not specified.
44      */

45     public abstract List JavaDoc<URI JavaDoc> getSchemas();
46
47     /**
48      * Returns the default namespace for the document.
49      */

50     public abstract String JavaDoc getDefaultNamespace();
51     
52     /**
53      * Returns the type of completion.
54      */

55     public abstract CompletionType getCompletionType();
56         
57     /**
58      * Returns the path from root element to the cursor location.
59      */

60     public abstract List JavaDoc<QName JavaDoc> getPathFromRoot();
61     
62     /**
63      * Returns the FileObject for the document.
64      */

65     public abstract FileObject getPrimaryFile();
66     
67     /**
68      * Returns the BaseDocument for the document.
69      */

70     public abstract BaseDocument getBaseDocument();
71     
72     /**
73      * Returns all the namespaces declared in the document as a HashMap.
74      */

75     public abstract HashMap JavaDoc<String JavaDoc, String JavaDoc> getDeclaredNamespaces();
76     
77     /**
78      * Returns the typed characters during completion.
79      */

80     public abstract String JavaDoc getTypedChars();
81             
82     /**
83      * CompletionType.
84      */

85     public static enum CompletionType {
86         COMPLETION_TYPE_UNKNOWN,
87         COMPLETION_TYPE_ATTRIBUTE,
88         COMPLETION_TYPE_VALUE,
89         COMPLETION_TYPE_ELEMENT,
90         COMPLETION_TYPE_ENTITY,
91         COMPLETION_TYPE_NOTATION,
92         COMPLETION_TYPE_DTD
93     }
94 }
95
Popular Tags