--- a/csl.api/nbproject/project.xml Thu Sep 03 12:27:01 2009 +0200 +++ a/csl.api/nbproject/project.xml Tue Nov 10 12:50:56 2009 +0100 @@ -348,6 +348,10 @@ unit + org.netbeans.libs.junit4 + + + org.netbeans.modules.editor.bracesmatching @@ -362,6 +366,11 @@ + org.netbeans.modules.nbjunit + + + + org.openide.util --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ 77b785fb9961 Tue Nov 10 12:50:56 2009 +0100 @@ -0,0 +1,247 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2009 Sun Microsystems, Inc. + */ + +package org.netbeans.modules.csl.impl; + +import java.util.Set; +import javax.annotation.processing.Processor; +import javax.annotation.processing.RoundEnvironment; +import javax.annotation.processing.SupportedAnnotationTypes; +import javax.annotation.processing.SupportedSourceVersion; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.Element; +import javax.lang.model.element.TypeElement; +import javax.lang.model.util.Elements; +import org.netbeans.modules.csl.spi.LanguageRegistration; +import org.openide.filesystems.annotations.LayerBuilder.File; +import org.openide.filesystems.annotations.LayerGeneratingProcessor; +import org.openide.filesystems.annotations.LayerGenerationException; +import org.openide.util.lookup.ServiceProvider; + +/** + * + * @author mslama + */ +@ServiceProvider(service=Processor.class) +@SupportedAnnotationTypes("org.netbeans.modules.csl.spi.LanguageRegistration") +@SupportedSourceVersion(SourceVersion.RELEASE_6) +public class LanguageProcessor extends LayerGeneratingProcessor { + + @Override + protected boolean handleProcess(Set annotations, RoundEnvironment roundEnv) throws LayerGenerationException { + Elements elements = processingEnv.getElementUtils(); + + for (Element e : roundEnv.getElementsAnnotatedWith(LanguageRegistration.class)) { + LanguageRegistration l = e.getAnnotation(LanguageRegistration.class); + + TypeElement te = (TypeElement)e.getEnclosingElement(); + String teName = elements.getBinaryName(te).toString(); + boolean hasDeclarationFinder = l.declarationFinder() != NoDeclarationFinder.class; + //boolean hasDeclarationFinder = true; + boolean hasStructureScanner = true; + registerEditorServices(e,"marek",teName,l.lineCommentPrefix(),l.displayName(),hasStructureScanner,hasDeclarationFinder); + } + return true; + } + + private void registerEditorServices(Element el, String mimeType, String gsfLanguageClass, String linePrefix, String displayName, boolean hasStructureScanner, boolean hasDeclarationFinder) { + //Element mimeFolder = mkdirs(doc, "Editors/" + mimeType); // NOI18N + // Hyperlinks + File f; + + if (hasDeclarationFinder) { + f = layer(el).file("Editors/" + mimeType + "/HyperlinkProviders/GsfHyperlinkProvider.instance"); + f.stringvalue("instanceClass", "org.netbeans.modules.csl.editor.hyperlink.GsfHyperlinkProvider"); + f.stringvalue("instanceOf", "org.netbeans.lib.editor.hyperlink.spi.HyperlinkProviderExt"); + f.write(); + } + /* + // Code Completion + Element completionFolder = mkdirs(doc, "Editors/" + mimeType + "/CompletionProviders"); // NOI18N + createFile(doc, completionFolder, "org-netbeans-lib-editor-codetemplates-CodeTemplateCompletionProvider.instance"); // NOI18N + createFile(doc, completionFolder, "org-netbeans-modules-csl-editor-completion-GsfCompletionProvider.instance"); // NOI18N*/ + f = layer(el).file("Editors/" + mimeType + + "/CompletionProviders/org-netbeans-lib-editor-codetemplates-CodeTemplateCompletionProvider.instance"); + f.write(); + f = layer(el).file("Editors/" + mimeType + + "/CompletionProviders/org-netbeans-modules-csl-editor-completion-GsfCompletionProvider.instance"); + f.write(); + + // Context menu + /*Element popupFolder = mkdirs(doc, "Editors/" + mimeType + "/Popup"); // NOI18N + + Element renameFile = createFile(doc, popupFolder, "in-place-refactoring"); // NOI18N + setFileAttribute(doc, renameFile, "position", INTVALUE, "680"); // NOI18N*/ + + f = layer(el).file("Editors/" + mimeType + "/Popup/in-place-refactoring"); + f.position(680); + f.write(); + + /*boolean alreadyLocalized = false; + boolean alreadyPositioned = false; + List gotoAttributes = getAttributeElements(doc, "Editors/" + mimeType + "/Popup/goto"); // NOI18N + for (Element gotoAttribute : gotoAttributes) { + if (gotoAttribute.getAttribute(FILENAME).equals("SystemFileSystem.localizingBundle") || //NOI18N + gotoAttribute.getAttribute(FILENAME).equals("displayName") //NOI18N + ) { + alreadyLocalized = true; + } + if (gotoAttribute.getAttribute(FILENAME).equals("position")) { // NOI18N + alreadyPositioned = true; + } + } + + Element gotoFolder = findPath(mimeFolder, "Popup/goto"); + if (gotoFolder == null) { + gotoFolder = mkdirs(mimeFolder, "Popup/goto"); // NOI18N + } + if (!alreadyPositioned) { + setFileAttribute(doc, gotoFolder, "position", INTVALUE, "500"); // NOI18N + } + + if (!alreadyLocalized) { + setFileAttribute(doc, gotoFolder, "displayName", BUNDLEVALUE, "org.netbeans.modules.csl.core.Bundle#generate-goto-popup"); + }*/ + + f = layer(el).file("Editors/" + mimeType + "/Popup/goto"); + f.position(500); + try { + f.bundlevalue("displayName", "org.netbeans.modules.csl.core.Bundle#generate-goto-popup"); + } catch (LayerGenerationException ex) { + ex.printStackTrace(); + } + f.write(); + + /*Element item; + if (hasDeclarationFinder) { + item = createFile(doc, gotoFolder, "goto-declaration"); // NOI18N + setFileAttribute(doc, item, "position", INTVALUE, "500"); // NOI18N + } + + // Goto by linenumber + item = createFile(doc, gotoFolder, "goto"); // NOI18N + setFileAttribute(doc, item, "position", INTVALUE, "600"); // NOI18N*/ + + if (hasDeclarationFinder) { + f = layer(el).file("Editors/" + mimeType + "/Popup/goto/goto-declaration"); + f.position(500); + f.write(); + } + + // Goto by linenumber + f = layer(el).file("Editors/" + mimeType + "/Popup/goto/goto"); + f.position(600); + f.write(); + + // What about goto-source etc? + // TODO: Goto Type (integrate with Java's GotoType) + // popupFolder = "Editors/" + mimeType + "/Popup" + + /*item = createFile(doc, popupFolder, "SeparatorBeforeCut.instance"); // NOI18N + setFileAttribute(doc, item, "position", INTVALUE, "1200"); // NOI18N + setFileAttribute(doc, item, "instanceClass", STRINGVALUE, "javax.swing.JSeparator"); // NOI18N*/ + + f = layer(el).file("Editors/" + mimeType + "/Popup/SeparatorBeforeCut.instance"); + f.position(1200); + f.stringvalue("instanceClass", "javax.swing.JSeparator"); + f.write(); + + /*item = createFile(doc, popupFolder, "format"); // NOI18N + setFileAttribute(doc, item, "position", INTVALUE, "750"); // NOI18N + + item = createFile(doc, popupFolder, "SeparatorAfterFormat.instance"); // NOI18N + // Should be between org-openide-actions-PasteAction.instance and format + setFileAttribute(doc, item, "position", INTVALUE, "780"); // NOI18N + setFileAttribute(doc, item, "instanceClass", STRINGVALUE, "javax.swing.JSeparator"); // NOI18N + + // UpToDateStatusProviders + Element upToDateFolder = mkdirs(doc, "Editors/" + mimeType + "/UpToDateStatusProvider"); // NOI18N + item = createFile(doc, upToDateFolder, "org-netbeans-modules-csl-hints-GsfUpToDateStateProviderFactory.instance"); // NOI18N + item = createFile(doc, upToDateFolder, "org-netbeans-modules-csl-editor-semantic-OccurrencesMarkProviderCreator.instance"); // NOI18N + + // Code Folding + if (hasStructureScanner) { + Element sideBarFolder = mkdirs(doc, "Editors/" + mimeType + "/SideBar"); // NOI18N + Element sidebarFile = createFile(doc, sideBarFolder, "org-netbeans-modules-csl-editor-GsfCodeFoldingSideBarFactory.instance"); // NOI18N + setFileAttribute(doc, sidebarFile, "position", INTVALUE, "1200"); // NOI18N + + Element foldingFolder = mkdirs(doc, "Editors/" + mimeType + "/FoldManager"); // NOI18N + createFile(doc, foldingFolder, "org-netbeans-modules-csl-editor-fold-GsfFoldManagerFactory.instance"); // NOI18N + } + + // Highlighting Factories + item = createFile(doc, mimeFolder, "org-netbeans-modules-csl-editor-semantic-HighlightsLayerFactoryImpl.instance"); // NOI18N + + // Toolbar + if (linePrefix != null && linePrefix.length() > 0) { + // Yes, found line comment prefix - register comment/uncomment toolbar buttons! + Element toolbarFolder = mkdirs(mimeFolder, "Toolbars/Default"); // NOI18N + + item = createFile(doc, toolbarFolder, "Separator-before-comment.instance"); // NOI18N + setFileAttribute(doc, item, "instanceClass", STRINGVALUE, "javax.swing.JSeparator"); // NOI18N + setFileAttribute(doc, item, "position", INTVALUE, "30000"); // NOI18N + + item = createFile(doc, toolbarFolder, "comment"); // NOI18N + setFileAttribute(doc, item, "position", INTVALUE, "30100"); // NOI18N + + item = createFile(doc, toolbarFolder, "uncomment"); // NOI18N + setFileAttribute(doc, item, "position", INTVALUE, "30200"); // NOI18N + } + + // Code Templates + Element codeProcessorFolder = mkdirs(mimeFolder, "CodeTemplateProcessorFactories"); // NOI18N + item = createFile(doc, codeProcessorFolder, "org-netbeans-modules-csl-editor-codetemplates-GsfCodeTemplateProcessor$Factory.instance"); // NOI18N + + // Code Template Filters + Element codeFilter = mkdirs(mimeFolder, "CodeTemplateFilterFactories"); // NOI18N + item = createFile(doc, codeFilter, "org-netbeans-modules-csl-editor-codetemplates-GsfCodeTemplateFilter$Factory.instance"); // NOI18N + + // Parser factory + item = createFile(doc, mimeFolder, "org-netbeans-modules-csl-core-GsfParserFactory.instance"); // NOI18N + setFileAttribute(doc, item, "instanceCreate", METHODVALUE, "org.netbeans.modules.csl.core.GsfParserFactory.create"); //NOI18N + setFileAttribute(doc, item, "instanceOf", STRINGVALUE, "org.netbeans.modules.parsing.spi.ParserFactory"); //NOI18N + + // Indexer factory + item = createFile(doc, mimeFolder, "org-netbeans-modules-csl-core-EmbeddingIndexerFactoryImpl.instance"); // NOI18N + setFileAttribute(doc, item, "instanceCreate", METHODVALUE, "org.netbeans.modules.csl.core.EmbeddingIndexerFactoryImpl.create"); //NOI18N + setFileAttribute(doc, item, "instanceOf", STRINGVALUE, "org.netbeans.modules.parsing.spi.indexing.EmbeddingIndexerFactory"); //NOI18N*/ + } + + +} --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ 77b785fb9961 Tue Nov 10 12:50:56 2009 +0100 @@ -0,0 +1,62 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2009 Sun Microsystems, Inc. + */ + +package org.netbeans.modules.csl.impl; + +import javax.swing.text.Document; +import org.netbeans.modules.csl.api.DeclarationFinder; +import org.netbeans.modules.csl.api.OffsetRange; +import org.netbeans.modules.csl.spi.ParserResult; + +/** + * + * @author mslama + */ +public class NoDeclarationFinder implements DeclarationFinder { + //public static final Class NONE = NoDeclarationFinder.class; + + public DeclarationLocation findDeclaration(ParserResult info, int caretOffset) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public OffsetRange getReferenceSpan(Document doc, int caretOffset) { + throw new UnsupportedOperationException("Not supported yet."); + } + +} --- a/csl.api/src/org/netbeans/modules/csl/spi/DefaultLanguageConfig.java Thu Sep 03 12:27:01 2009 +0200 +++ a/csl.api/src/org/netbeans/modules/csl/spi/DefaultLanguageConfig.java Tue Nov 10 12:50:56 2009 +0100 @@ -83,7 +83,9 @@ public abstract Language getLexerLanguage(); - public abstract String getDisplayName(); + public String getDisplayName() { + return null; + } public String getPreferredExtension() { return null; --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ 77b785fb9961 Tue Nov 10 12:50:56 2009 +0100 @@ -0,0 +1,190 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2008 Sun Microsystems, Inc. + */ + +package org.netbeans.modules.csl.spi; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.util.Set; +import org.netbeans.api.annotations.common.CheckForNull; +import org.netbeans.api.lexer.Language; +import org.netbeans.modules.csl.api.CodeCompletionHandler; +import org.netbeans.modules.csl.api.DeclarationFinder; +import org.netbeans.modules.csl.api.Formatter; +import org.netbeans.modules.csl.api.GsfLanguage; +import org.netbeans.modules.csl.api.HintsProvider; +import org.netbeans.modules.csl.api.InstantRenamer; +import org.netbeans.modules.csl.api.KeystrokeHandler; +import org.netbeans.modules.csl.api.OccurrencesFinder; +import org.netbeans.modules.csl.api.SemanticAnalyzer; +import org.netbeans.modules.csl.api.StructureScanner; +import org.netbeans.modules.csl.api.IndexSearcher; +import org.netbeans.modules.csl.impl.NoDeclarationFinder; +import org.netbeans.modules.parsing.spi.Parser; +import org.netbeans.modules.parsing.spi.indexing.EmbeddingIndexerFactory; + +/** + * Default implementation of the LanguageConfig class. Descendants of this + * class also get some extra support; instead of registering services in the + * layer you can just override the service creation methods below. + * + */ +@Retention(RetentionPolicy.SOURCE) +@Target(ElementType.TYPE) +public @interface LanguageRegistration { + + //the method is not added to the GsfLanguage interface so far + //so compatibility is preserved + //public Class commentHandler(); + + public String lineCommentPrefix() default ""; + + //public Class lexerLanguage(); + //public abstract Language getLexerLanguage(); + + public String displayName(); + + public String preferredExtension(); + + public String [] binaryLibraryPathIds() default {}; + + public String [] libraryPathIds() default {}; + + public String [] sourcePathIds() default {}; + + /** + * Get a Parser to use for this language, or null if none is available + * @return a parser instance + */ + //public Class parser(); + + /** + * HACK: Some language supports may want to use their own editor kit + * implementation (such as Schliemann) for some services. By returning + * true here GSF will not register its own editing services for this mime type. + *

+ * If you set this flag, you may need to register additional services on your + * own. For example, if you still want GSF "Go To Declaration" functionality, + * you need to register the GsfHyperlinkProvider. + * The ruby.rhtml/ module provides an example of this. + *

+ * NOTE: Code folding doesn't work until you enable code folding for your + * editor kit; see GsfEditorKitFactory's reference to CODE_FOLDING_ENABLE for + * an example. + * @wasdeprecated This function is not called anymore. You + * MUST register the custom editor kit attribute via the layer! That's because + * currently, finding out whether a module has supplies a custom editor + * kit must be done early during startup (in the file type recognition code, + * to decide if a given module mime type should be owned by GSF) + * and we don't want to force loading all language configurations + * (including classes they reference) at startup. Hopefully a + * better solution will be provided soon. + */ + public boolean useCustomEditorKit() default false; + + /** + * Get a CodeCompletionHandler for this language, or null if none is available + * @return a CodeCompletionHandler + */ + //public Class completionHandler(); + + /** + * Get an InstantRenamer for this language, or null if none is available + * @return a renamer + */ + //public Class instantRenamer(); + + /** + * A DeclarationFinder for this language, or null if none is available + * @return a declaration finder + */ + //public Class declarationFinder() default NoDeclarationFinder.class; + public Class declarationFinder(); + + /** + * A Formatter for this language, or null if none is available + * @return the formatter + */ + //public Class formatter(); + + /** + * A KeystrokeHandler for this language, or null if none is available + * @return the keystroke handler + */ + //public Class keystrokeHandler(); + + /** + * A Indexer for this language, or null if none is available + * @return the indexer + */ + //public Class indexerFactory(); + + /** + * A StructureScanner for this language, or null if none is available + * @return the structure scanner + */ + //public Class structureScanner(); + + /** + * A HintsProvider for this language, or null if none is available + * @return the hints provider + */ + //public Class hintsProvider(); + + /** + * A OccurrencesFinder for this language, or null if none is available + * @return the occurrences finder + */ + //public Class occurrencesFinder(); + + /** + * A SemanticAnalyzer for this language, or null if none is available + * @return the semantic analyzer + */ + //public Class semanticAnalyzer(); + + /** + * An IndexSearcher which can help with the Open Type, Open Symbol etc features. + * + * @return the index searcher + */ + //public Class indexSearcher(); +} --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ 77b785fb9961 Tue Nov 10 12:50:56 2009 +0100 @@ -0,0 +1,75 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2009 Sun Microsystems, Inc. + */ + +package org.netbeans.modules.csl.spi; + +import org.netbeans.api.lexer.Language; +import org.netbeans.junit.NbTestCase; +import org.netbeans.modules.csl.impl.NoDeclarationFinder; +import org.openide.filesystems.FileObject; +import org.openide.filesystems.FileUtil; + +/** + * + * @author mslama + */ +public class LanguageRegistrationTest extends NbTestCase { + + public LanguageRegistrationTest(String name) { + super(name); + } + + public void testAnnotation() { + FileObject f = FileUtil.getConfigFile("Editors/" + "marek" + "/HyperlinkProviders/GsfHyperlinkProvider.instance"); + assertNotNull(f); + assertNotNull(f.getAttribute("instanceOf")); + } + + //@LanguageRegistration(displayName="marek",preferredExtension="mrk",declarationFinder=NoDeclarationFinder.class) + @LanguageRegistration(displayName="marek",preferredExtension="mrk",declarationFinder=NoDeclarationFinder.class) + public static class Marek extends DefaultLanguageConfig { + + @Override + public Language getLexerLanguage() { + throw new UnsupportedOperationException("Not supported yet."); + } + + + } +} --- a/html.editor/src/org/netbeans/modules/html/editor/gsf/HtmlLanguage.java Thu Sep 03 12:27:01 2009 +0200 +++ a/html.editor/src/org/netbeans/modules/html/editor/gsf/HtmlLanguage.java Tue Nov 10 12:50:56 2009 +0100 @@ -50,8 +50,12 @@ import org.netbeans.modules.csl.api.StructureScanner; import org.netbeans.modules.csl.spi.CommentHandler; import org.netbeans.modules.csl.spi.DefaultLanguageConfig; +import org.netbeans.modules.csl.spi.LanguageRegistration; import org.netbeans.modules.parsing.spi.Parser; +@LanguageRegistration(displayName="HTML", +preferredExtension="html", +useCustomEditorKit=true) public class HtmlLanguage extends DefaultLanguageConfig { public HtmlLanguage() { @@ -73,23 +77,6 @@ } @Override - public String getDisplayName() { - return "HTML"; - } - - @Override - public String getPreferredExtension() { - return "html"; // NOI18N - } - - // Service registrations - - @Override - public boolean isUsingCustomEditorKit() { - return true; - } - - @Override public Parser getParser() { return new HtmlGSFParser(); }