This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 169991
Collapse All | Expand All

(-)a/csl.api/nbproject/project.xml (+9 lines)
Lines 348-353 Link Here
348
                <test-type>
348
                <test-type>
349
                    <name>unit</name>
349
                    <name>unit</name>
350
                    <test-dependency>
350
                    <test-dependency>
351
                        <code-name-base>org.netbeans.libs.junit4</code-name-base>
352
                        <compile-dependency/>
353
                    </test-dependency>
354
                    <test-dependency>
351
                        <code-name-base>org.netbeans.modules.editor.bracesmatching</code-name-base>
355
                        <code-name-base>org.netbeans.modules.editor.bracesmatching</code-name-base>
352
                        <compile-dependency/>
356
                        <compile-dependency/>
353
                        <test/>
357
                        <test/>
Lines 362-367 Link Here
362
                        <compile-dependency/>
366
                        <compile-dependency/>
363
                    </test-dependency>
367
                    </test-dependency>
364
                    <test-dependency>
368
                    <test-dependency>
369
                        <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
370
                        <recursive/>
371
                        <compile-dependency/>
372
                    </test-dependency>
373
                    <test-dependency>
365
                        <code-name-base>org.openide.util</code-name-base>
374
                        <code-name-base>org.openide.util</code-name-base>
366
                        <compile-dependency/>
375
                        <compile-dependency/>
367
                        <test/>
376
                        <test/>
(-)77b785fb9961 (+247 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
38
 */
39
40
package org.netbeans.modules.csl.impl;
41
42
import java.util.Set;
43
import javax.annotation.processing.Processor;
44
import javax.annotation.processing.RoundEnvironment;
45
import javax.annotation.processing.SupportedAnnotationTypes;
46
import javax.annotation.processing.SupportedSourceVersion;
47
import javax.lang.model.SourceVersion;
48
import javax.lang.model.element.Element;
49
import javax.lang.model.element.TypeElement;
50
import javax.lang.model.util.Elements;
51
import org.netbeans.modules.csl.spi.LanguageRegistration;
52
import org.openide.filesystems.annotations.LayerBuilder.File;
53
import org.openide.filesystems.annotations.LayerGeneratingProcessor;
54
import org.openide.filesystems.annotations.LayerGenerationException;
55
import org.openide.util.lookup.ServiceProvider;
56
57
/**
58
 *
59
 * @author mslama
60
 */
61
@ServiceProvider(service=Processor.class)
62
@SupportedAnnotationTypes("org.netbeans.modules.csl.spi.LanguageRegistration")
63
@SupportedSourceVersion(SourceVersion.RELEASE_6)
64
public class LanguageProcessor extends LayerGeneratingProcessor {
65
66
    @Override
67
    protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
68
        Elements elements = processingEnv.getElementUtils();
69
70
        for (Element e : roundEnv.getElementsAnnotatedWith(LanguageRegistration.class)) {
71
            LanguageRegistration l = e.getAnnotation(LanguageRegistration.class);
72
73
            TypeElement te = (TypeElement)e.getEnclosingElement();
74
            String teName = elements.getBinaryName(te).toString();
75
            boolean hasDeclarationFinder = l.declarationFinder() != NoDeclarationFinder.class;
76
            //boolean hasDeclarationFinder = true;
77
            boolean hasStructureScanner = true;
78
            registerEditorServices(e,"marek",teName,l.lineCommentPrefix(),l.displayName(),hasStructureScanner,hasDeclarationFinder);
79
        }
80
        return true;
81
    }
82
83
    private void registerEditorServices(Element el, String mimeType, String gsfLanguageClass, String linePrefix, String displayName, boolean hasStructureScanner, boolean hasDeclarationFinder) {
84
        //Element mimeFolder = mkdirs(doc, "Editors/" + mimeType); // NOI18N
85
        // Hyperlinks
86
        File f;
87
88
        if (hasDeclarationFinder) {
89
            f = layer(el).file("Editors/" + mimeType + "/HyperlinkProviders/GsfHyperlinkProvider.instance");
90
            f.stringvalue("instanceClass", "org.netbeans.modules.csl.editor.hyperlink.GsfHyperlinkProvider");
91
            f.stringvalue("instanceOf", "org.netbeans.lib.editor.hyperlink.spi.HyperlinkProviderExt");
92
            f.write();
93
        }
94
        /*
95
        // Code Completion
96
        Element completionFolder = mkdirs(doc, "Editors/" + mimeType + "/CompletionProviders"); // NOI18N
97
        createFile(doc, completionFolder, "org-netbeans-lib-editor-codetemplates-CodeTemplateCompletionProvider.instance"); // NOI18N
98
        createFile(doc, completionFolder, "org-netbeans-modules-csl-editor-completion-GsfCompletionProvider.instance"); // NOI18N*/
99
        f = layer(el).file("Editors/" + mimeType
100
        + "/CompletionProviders/org-netbeans-lib-editor-codetemplates-CodeTemplateCompletionProvider.instance");
101
        f.write();
102
        f = layer(el).file("Editors/" + mimeType
103
        + "/CompletionProviders/org-netbeans-modules-csl-editor-completion-GsfCompletionProvider.instance");
104
        f.write();
105
106
        // Context menu
107
        /*Element popupFolder = mkdirs(doc, "Editors/" + mimeType + "/Popup"); // NOI18N
108
109
        Element renameFile = createFile(doc, popupFolder, "in-place-refactoring"); // NOI18N
110
        setFileAttribute(doc, renameFile, "position", INTVALUE, "680"); // NOI18N*/
111
112
        f = layer(el).file("Editors/" + mimeType + "/Popup/in-place-refactoring");
113
        f.position(680);
114
        f.write();
115
116
        /*boolean alreadyLocalized = false;
117
        boolean alreadyPositioned = false;
118
        List<Element> gotoAttributes = getAttributeElements(doc, "Editors/" + mimeType + "/Popup/goto"); // NOI18N
119
        for (Element gotoAttribute : gotoAttributes) {
120
            if (gotoAttribute.getAttribute(FILENAME).equals("SystemFileSystem.localizingBundle") || //NOI18N
121
                gotoAttribute.getAttribute(FILENAME).equals("displayName") //NOI18N
122
            ) {
123
                alreadyLocalized = true;
124
            }
125
            if (gotoAttribute.getAttribute(FILENAME).equals("position")) { // NOI18N
126
                alreadyPositioned = true;
127
            }
128
        }
129
130
        Element gotoFolder = findPath(mimeFolder, "Popup/goto");
131
        if (gotoFolder == null) {
132
            gotoFolder = mkdirs(mimeFolder, "Popup/goto"); // NOI18N
133
        }
134
        if (!alreadyPositioned) {
135
            setFileAttribute(doc, gotoFolder, "position", INTVALUE, "500"); // NOI18N
136
        }
137
138
        if (!alreadyLocalized) {
139
            setFileAttribute(doc, gotoFolder, "displayName", BUNDLEVALUE, "org.netbeans.modules.csl.core.Bundle#generate-goto-popup");
140
        }*/
141
        
142
        f = layer(el).file("Editors/" + mimeType + "/Popup/goto");
143
        f.position(500);
144
        try {
145
            f.bundlevalue("displayName", "org.netbeans.modules.csl.core.Bundle#generate-goto-popup");
146
        } catch (LayerGenerationException ex) {
147
            ex.printStackTrace();
148
        }
149
        f.write();
150
        
151
        /*Element item;
152
        if (hasDeclarationFinder) {
153
            item = createFile(doc, gotoFolder, "goto-declaration"); // NOI18N
154
            setFileAttribute(doc, item, "position", INTVALUE, "500"); // NOI18N
155
        }
156
157
        // Goto by linenumber
158
        item = createFile(doc, gotoFolder, "goto");  // NOI18N
159
        setFileAttribute(doc, item, "position", INTVALUE, "600"); // NOI18N*/
160
161
        if (hasDeclarationFinder) {
162
            f = layer(el).file("Editors/" + mimeType + "/Popup/goto/goto-declaration");
163
            f.position(500);
164
            f.write();
165
        }
166
167
        // Goto by linenumber
168
        f = layer(el).file("Editors/" + mimeType + "/Popup/goto/goto");
169
        f.position(600);
170
        f.write();
171
172
        // What about goto-source etc?
173
        // TODO: Goto Type (integrate with Java's GotoType)
174
        // popupFolder = "Editors/" + mimeType + "/Popup"
175
176
        /*item = createFile(doc, popupFolder, "SeparatorBeforeCut.instance"); // NOI18N
177
        setFileAttribute(doc, item, "position", INTVALUE, "1200"); // NOI18N
178
        setFileAttribute(doc, item, "instanceClass", STRINGVALUE, "javax.swing.JSeparator"); // NOI18N*/
179
        
180
        f = layer(el).file("Editors/" + mimeType + "/Popup/SeparatorBeforeCut.instance");
181
        f.position(1200);
182
        f.stringvalue("instanceClass", "javax.swing.JSeparator");
183
        f.write();
184
185
        /*item = createFile(doc, popupFolder, "format"); // NOI18N
186
        setFileAttribute(doc, item, "position", INTVALUE, "750"); // NOI18N
187
188
        item = createFile(doc, popupFolder, "SeparatorAfterFormat.instance"); // NOI18N
189
        // Should be between org-openide-actions-PasteAction.instance and format
190
        setFileAttribute(doc, item, "position", INTVALUE, "780"); // NOI18N
191
        setFileAttribute(doc, item, "instanceClass", STRINGVALUE, "javax.swing.JSeparator"); // NOI18N
192
193
        // UpToDateStatusProviders
194
        Element upToDateFolder = mkdirs(doc, "Editors/" + mimeType + "/UpToDateStatusProvider"); // NOI18N
195
        item = createFile(doc, upToDateFolder, "org-netbeans-modules-csl-hints-GsfUpToDateStateProviderFactory.instance"); // NOI18N
196
        item = createFile(doc, upToDateFolder, "org-netbeans-modules-csl-editor-semantic-OccurrencesMarkProviderCreator.instance"); // NOI18N
197
198
        // Code Folding
199
        if (hasStructureScanner) {
200
            Element sideBarFolder = mkdirs(doc, "Editors/" + mimeType + "/SideBar"); // NOI18N
201
            Element sidebarFile = createFile(doc, sideBarFolder, "org-netbeans-modules-csl-editor-GsfCodeFoldingSideBarFactory.instance"); // NOI18N
202
            setFileAttribute(doc, sidebarFile, "position", INTVALUE, "1200"); // NOI18N
203
204
            Element foldingFolder = mkdirs(doc, "Editors/" + mimeType + "/FoldManager"); // NOI18N
205
            createFile(doc, foldingFolder, "org-netbeans-modules-csl-editor-fold-GsfFoldManagerFactory.instance"); // NOI18N
206
        }
207
208
        // Highlighting Factories
209
        item = createFile(doc, mimeFolder, "org-netbeans-modules-csl-editor-semantic-HighlightsLayerFactoryImpl.instance"); // NOI18N
210
211
        // Toolbar
212
        if (linePrefix != null && linePrefix.length() > 0) {
213
            // Yes, found line comment prefix - register comment/uncomment toolbar buttons!
214
            Element toolbarFolder = mkdirs(mimeFolder, "Toolbars/Default"); // NOI18N
215
216
            item = createFile(doc, toolbarFolder, "Separator-before-comment.instance"); // NOI18N
217
            setFileAttribute(doc, item, "instanceClass", STRINGVALUE, "javax.swing.JSeparator"); // NOI18N
218
            setFileAttribute(doc, item, "position", INTVALUE, "30000"); // NOI18N
219
220
            item = createFile(doc, toolbarFolder, "comment"); // NOI18N
221
            setFileAttribute(doc, item, "position", INTVALUE, "30100"); // NOI18N
222
223
            item = createFile(doc, toolbarFolder, "uncomment"); // NOI18N
224
            setFileAttribute(doc, item, "position", INTVALUE, "30200"); // NOI18N
225
        }
226
227
        // Code Templates
228
        Element codeProcessorFolder = mkdirs(mimeFolder, "CodeTemplateProcessorFactories"); // NOI18N
229
        item = createFile(doc, codeProcessorFolder, "org-netbeans-modules-csl-editor-codetemplates-GsfCodeTemplateProcessor$Factory.instance"); // NOI18N
230
231
        // Code Template Filters
232
        Element codeFilter = mkdirs(mimeFolder, "CodeTemplateFilterFactories"); // NOI18N
233
        item = createFile(doc, codeFilter, "org-netbeans-modules-csl-editor-codetemplates-GsfCodeTemplateFilter$Factory.instance"); // NOI18N
234
235
        // Parser factory
236
        item = createFile(doc, mimeFolder, "org-netbeans-modules-csl-core-GsfParserFactory.instance"); // NOI18N
237
        setFileAttribute(doc, item, "instanceCreate", METHODVALUE, "org.netbeans.modules.csl.core.GsfParserFactory.create"); //NOI18N
238
        setFileAttribute(doc, item, "instanceOf", STRINGVALUE, "org.netbeans.modules.parsing.spi.ParserFactory"); //NOI18N
239
240
        // Indexer factory
241
        item = createFile(doc, mimeFolder, "org-netbeans-modules-csl-core-EmbeddingIndexerFactoryImpl.instance"); // NOI18N
242
        setFileAttribute(doc, item, "instanceCreate", METHODVALUE, "org.netbeans.modules.csl.core.EmbeddingIndexerFactoryImpl.create"); //NOI18N
243
        setFileAttribute(doc, item, "instanceOf", STRINGVALUE, "org.netbeans.modules.parsing.spi.indexing.EmbeddingIndexerFactory"); //NOI18N*/
244
    }
245
246
247
}
(-)77b785fb9961 (+62 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
38
 */
39
40
package org.netbeans.modules.csl.impl;
41
42
import javax.swing.text.Document;
43
import org.netbeans.modules.csl.api.DeclarationFinder;
44
import org.netbeans.modules.csl.api.OffsetRange;
45
import org.netbeans.modules.csl.spi.ParserResult;
46
47
/**
48
 *
49
 * @author mslama
50
 */
51
public class NoDeclarationFinder implements DeclarationFinder {
52
    //public static final Class<? extends DeclarationFinder> NONE = NoDeclarationFinder.class;
53
54
    public DeclarationLocation findDeclaration(ParserResult info, int caretOffset) {
55
        throw new UnsupportedOperationException("Not supported yet.");
56
    }
57
58
    public OffsetRange getReferenceSpan(Document doc, int caretOffset) {
59
        throw new UnsupportedOperationException("Not supported yet.");
60
    }
61
62
}
(-)a/csl.api/src/org/netbeans/modules/csl/spi/DefaultLanguageConfig.java (-1 / +3 lines)
Lines 83-89 Link Here
83
83
84
    public abstract Language getLexerLanguage();
84
    public abstract Language getLexerLanguage();
85
85
86
    public abstract String getDisplayName();
86
    public String getDisplayName() {
87
        return null;
88
    }
87
89
88
    public String getPreferredExtension() {
90
    public String getPreferredExtension() {
89
        return null;
91
        return null;
(-)77b785fb9961 (+190 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
4
 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
5
 * 
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 * 
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 * 
35
 * Contributor(s):
36
 * 
37
 * Portions Copyrighted 2008 Sun Microsystems, Inc.
38
 */
39
40
package org.netbeans.modules.csl.spi;
41
42
import java.lang.annotation.ElementType;
43
import java.lang.annotation.Retention;
44
import java.lang.annotation.RetentionPolicy;
45
import java.lang.annotation.Target;
46
import java.util.Set;
47
import org.netbeans.api.annotations.common.CheckForNull;
48
import org.netbeans.api.lexer.Language;
49
import org.netbeans.modules.csl.api.CodeCompletionHandler;
50
import org.netbeans.modules.csl.api.DeclarationFinder;
51
import org.netbeans.modules.csl.api.Formatter;
52
import org.netbeans.modules.csl.api.GsfLanguage;
53
import org.netbeans.modules.csl.api.HintsProvider;
54
import org.netbeans.modules.csl.api.InstantRenamer;
55
import org.netbeans.modules.csl.api.KeystrokeHandler;
56
import org.netbeans.modules.csl.api.OccurrencesFinder;
57
import org.netbeans.modules.csl.api.SemanticAnalyzer;
58
import org.netbeans.modules.csl.api.StructureScanner;
59
import org.netbeans.modules.csl.api.IndexSearcher;
60
import org.netbeans.modules.csl.impl.NoDeclarationFinder;
61
import org.netbeans.modules.parsing.spi.Parser;
62
import org.netbeans.modules.parsing.spi.indexing.EmbeddingIndexerFactory;
63
64
/**
65
 * Default implementation of the LanguageConfig class. Descendants of this
66
 * class also get some extra support; instead of registering services in the
67
 * layer you can just override the service creation methods below.
68
 * 
69
 */
70
@Retention(RetentionPolicy.SOURCE)
71
@Target(ElementType.TYPE)
72
public @interface LanguageRegistration {
73
74
    //the method is not added to the GsfLanguage interface so far
75
    //so compatibility is preserved
76
    //public Class<? extends CommentHandler> commentHandler();
77
78
    public String lineCommentPrefix() default "";
79
80
    //public Class<? extends Language> lexerLanguage();
81
    //public abstract Language getLexerLanguage();
82
83
    public String displayName();
84
85
    public String preferredExtension();
86
87
    public String [] binaryLibraryPathIds() default {};
88
89
    public String [] libraryPathIds() default {};
90
91
    public String [] sourcePathIds() default {};
92
93
    /** 
94
     * Get a Parser to use for this language, or null if none is available
95
     * @return a parser instance
96
     */
97
    //public Class<? extends Parser> parser();
98
    
99
    /** 
100
     * HACK: Some language supports may want to use their own editor kit
101
     * implementation (such as Schliemann) for some services. By returning
102
     * true here GSF will not register its own editing services for this mime type.
103
     * <p>
104
     * If you set this flag, you may need to register additional services on your
105
     * own. For example, if you still want GSF "Go To Declaration" functionality,
106
     * you need to register the GsfHyperlinkProvider.
107
     * The ruby.rhtml/ module provides an example of this.
108
     * <p>
109
     * NOTE: Code folding doesn't work until you enable code folding for your
110
     * editor kit; see GsfEditorKitFactory's reference to CODE_FOLDING_ENABLE for
111
     * an example.
112
     * @wasdeprecated This function is not called anymore. You
113
     *  MUST register the custom editor kit attribute via the layer! That's because
114
     *  currently, finding out whether a module has supplies a custom editor
115
     *  kit must be done early during startup (in the file type recognition code,
116
     *  to decide if a given module mime type should be owned by GSF)
117
     *  and we don't want to force loading all language configurations
118
     *  (including classes they reference) at startup. Hopefully a
119
     *  better solution will be provided soon.
120
     */
121
    public boolean useCustomEditorKit() default false;
122
    
123
    /**
124
     * Get a CodeCompletionHandler for this language, or null if none is available
125
     * @return a CodeCompletionHandler
126
     */
127
    //public Class<? extends CodeCompletionHandler> completionHandler();
128
129
    /**
130
     * Get an InstantRenamer for this language, or null if none is available
131
     * @return a renamer
132
     */
133
    //public Class<? extends InstantRenamer> instantRenamer();
134
135
    /**
136
     * A DeclarationFinder for this language, or null if none is available
137
     * @return a declaration finder
138
     */
139
    //public Class<? extends DeclarationFinder> declarationFinder() default NoDeclarationFinder.class;
140
    public Class<? extends DeclarationFinder> declarationFinder();
141
142
    /**
143
     * A Formatter for this language, or null if none is available
144
     * @return the formatter
145
     */
146
    //public Class<? extends Formatter> formatter();
147
148
    /**
149
     * A KeystrokeHandler for this language, or null if none is available
150
     * @return the keystroke handler
151
     */
152
    //public Class<? extends KeystrokeHandler> keystrokeHandler();
153
154
    /**
155
     * A Indexer for this language, or null if none is available
156
     * @return the indexer
157
     */
158
    //public Class<? extends EmbeddingIndexerFactory> indexerFactory();
159
    
160
    /**
161
     * A StructureScanner for this language, or null if none is available
162
     * @return the structure scanner
163
     */
164
    //public Class<? extends StructureScanner> structureScanner();
165
    
166
    /**
167
     * A HintsProvider for this language, or null if none is available
168
     * @return the hints provider
169
     */
170
    //public Class<? extends HintsProvider> hintsProvider();
171
172
    /**
173
     * A OccurrencesFinder for this language, or null if none is available
174
     * @return the occurrences finder
175
     */
176
    //public Class<? extends OccurrencesFinder> occurrencesFinder();
177
178
    /**
179
     * A SemanticAnalyzer for this language, or null if none is available
180
     * @return the semantic analyzer
181
     */
182
    //public Class<? extends SemanticAnalyzer> semanticAnalyzer();
183
184
    /**
185
     * An IndexSearcher which can help with the Open Type, Open Symbol etc features.
186
     *
187
     * @return the index searcher
188
     */
189
    //public Class<? extends IndexSearcher> indexSearcher();
190
}
(-)77b785fb9961 (+75 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
8
 * Development and Distribution License("CDDL") (collectively, the
9
 * "License"). You may not use this file except in compliance with the
10
 * License. You can obtain a copy of the License at
11
 * http://www.netbeans.org/cddl-gplv2.html
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13
 * specific language governing permissions and limitations under the
14
 * License.  When distributing the software, include this License Header
15
 * Notice in each file and include the License file at
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
17
 * particular file as subject to the "Classpath" exception as provided
18
 * by Sun in the GPL Version 2 section of the License file that
19
 * accompanied this code. If applicable, add the following below the
20
 * License Header, with the fields enclosed by brackets [] replaced by
21
 * your own identifying information:
22
 * "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL
25
 * or only the GPL Version 2, indicate your decision by adding
26
 * "[Contributor] elects to include this software in this distribution
27
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
28
 * single choice of license, a recipient has the option to distribute
29
 * your version of this file under either the CDDL, the GPL Version 2 or
30
 * to extend the choice of license to its licensees as provided above.
31
 * However, if you add GPL Version 2 code and therefore, elected the GPL
32
 * Version 2 license, then the option applies only if the new code is
33
 * made subject to such option by the copyright holder.
34
 *
35
 * Contributor(s):
36
 *
37
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
38
 */
39
40
package org.netbeans.modules.csl.spi;
41
42
import org.netbeans.api.lexer.Language;
43
import org.netbeans.junit.NbTestCase;
44
import org.netbeans.modules.csl.impl.NoDeclarationFinder;
45
import org.openide.filesystems.FileObject;
46
import org.openide.filesystems.FileUtil;
47
48
/**
49
 *
50
 * @author mslama
51
 */
52
public class LanguageRegistrationTest extends NbTestCase {
53
54
    public LanguageRegistrationTest(String name) {
55
        super(name);
56
    }
57
58
    public void testAnnotation() {
59
        FileObject f = FileUtil.getConfigFile("Editors/" + "marek" + "/HyperlinkProviders/GsfHyperlinkProvider.instance");
60
        assertNotNull(f);
61
        assertNotNull(f.getAttribute("instanceOf"));
62
    }
63
64
    //@LanguageRegistration(displayName="marek",preferredExtension="mrk",declarationFinder=NoDeclarationFinder.class)
65
    @LanguageRegistration(displayName="marek",preferredExtension="mrk",declarationFinder=NoDeclarationFinder.class)
66
    public static class Marek extends DefaultLanguageConfig {
67
68
        @Override
69
        public Language getLexerLanguage() {
70
            throw new UnsupportedOperationException("Not supported yet.");
71
        }
72
73
74
    }
75
}
(-)a/html.editor/src/org/netbeans/modules/html/editor/gsf/HtmlLanguage.java (-17 / +4 lines)
Lines 50-57 Link Here
50
import org.netbeans.modules.csl.api.StructureScanner;
50
import org.netbeans.modules.csl.api.StructureScanner;
51
import org.netbeans.modules.csl.spi.CommentHandler;
51
import org.netbeans.modules.csl.spi.CommentHandler;
52
import org.netbeans.modules.csl.spi.DefaultLanguageConfig;
52
import org.netbeans.modules.csl.spi.DefaultLanguageConfig;
53
import org.netbeans.modules.csl.spi.LanguageRegistration;
53
import org.netbeans.modules.parsing.spi.Parser;
54
import org.netbeans.modules.parsing.spi.Parser;
54
55
56
@LanguageRegistration(displayName="HTML",
57
preferredExtension="html",
58
useCustomEditorKit=true)
55
public class HtmlLanguage extends DefaultLanguageConfig {
59
public class HtmlLanguage extends DefaultLanguageConfig {
56
    
60
    
57
    public HtmlLanguage() {
61
    public HtmlLanguage() {
Lines 73-95 Link Here
73
    }
77
    }
74
78
75
    @Override
79
    @Override
76
    public String getDisplayName() {
77
        return "HTML";
78
    }
79
    
80
    @Override
81
    public String getPreferredExtension() {
82
        return "html"; // NOI18N
83
    }
84
85
    // Service registrations
86
    
87
    @Override
88
    public boolean isUsingCustomEditorKit() {
89
        return true;
90
    }
91
92
    @Override
93
    public Parser getParser() {
80
    public Parser getParser() {
94
        return new HtmlGSFParser();
81
        return new HtmlGSFParser();
95
    }
82
    }

Return to bug 169991