diff --git a/groovy.grailsproject/nbproject/project.properties b/groovy.grailsproject/nbproject/project.properties --- a/groovy.grailsproject/nbproject/project.properties +++ b/groovy.grailsproject/nbproject/project.properties @@ -36,7 +36,7 @@ # # Contributor(s): javac.compilerargs=-Xlint -Xlint:-serial -javac.source=1.7 +javac.source=1.8 javadoc.arch=${basedir}/arch.xml nbm.homepage=http://wiki.netbeans.org/groovy nbm.module.author=Martin Adamek, Matthias Schmidt diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/GrailsProject.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/GrailsProject.java --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/GrailsProject.java +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/GrailsProject.java @@ -93,6 +93,7 @@ private final ClassPathProviderImpl cpProvider; private final GrailsCommandSupport commandSupport; private final BuildConfig buildConfig; + private final SourceCategoriesFactory sourceCategoriesFactory; private SourceRoots sourceRoots; private SourceRoots testRoots; private Lookup lookup; @@ -105,6 +106,7 @@ this.cpProvider = new ClassPathProviderImpl(getSourceRoots(), getTestSourceRoots(), this); this.commandSupport = new GrailsCommandSupport(this); this.buildConfig = new BuildConfig(this); + this.sourceCategoriesFactory = new SourceCategoriesFactory(); } @Override @@ -123,6 +125,10 @@ public BuildConfig getBuildConfig() { return buildConfig; } + + public SourceCategoriesFactory getSourceCategoriesFactory() { + return sourceCategoriesFactory; + } @Override public Lookup getLookup() { diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/GrailsSources.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/GrailsSources.java --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/GrailsSources.java +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/GrailsSources.java @@ -143,24 +143,24 @@ if (Sources.TYPE_GENERIC.equals(type)) { addGroup(projectDir, projectDir.getName(), result); } else if (JavaProjectConstants.SOURCES_TYPE_JAVA.equals(type)) { - addGroup(SourceCategory.SRC_JAVA, "LBL_SrcJava", result); + addGroup(SourceCategoryType.SRC_JAVA, "LBL_SrcJava", result); } else if (GroovySources.SOURCES_TYPE_GROOVY.equals(type)) { - addGroup(SourceCategory.GRAILSAPP_CONF, "LBL_grails-app_conf", result); - addGroup(SourceCategory.GRAILSAPP_CONTROLLERS, "LBL_grails-app_controllers", result); - addGroup(SourceCategory.GRAILSAPP_DOMAIN, "LBL_grails-app_domain", result); - addGroup(SourceCategory.GRAILSAPP_SERVICES, "LBL_grails-app_services", result); - addGroup(SourceCategory.GRAILSAPP_TAGLIB, "LBL_grails-app_taglib", result); - addGroup(SourceCategory.GRAILSAPP_UTILS, "LBL_grails-app_utils", result); - addGroup(SourceCategory.SCRIPTS, "LBL_scripts", result); - addGroup(SourceCategory.SRC_GROOVY, "LBL_SrcGroovy", result); - addGroup(SourceCategory.TEST_INTEGRATION, "LBL_IntegrationTests", result); - addGroup(SourceCategory.TEST_UNIT, "LBL_UnitTests", result); + addGroup(SourceCategoryType.GRAILSAPP_CONF, "LBL_grails-app_conf", result); + addGroup(SourceCategoryType.GRAILSAPP_CONTROLLERS, "LBL_grails-app_controllers", result); + addGroup(SourceCategoryType.GRAILSAPP_DOMAIN, "LBL_grails-app_domain", result); + addGroup(SourceCategoryType.GRAILSAPP_SERVICES, "LBL_grails-app_services", result); + addGroup(SourceCategoryType.GRAILSAPP_TAGLIB, "LBL_grails-app_taglib", result); + addGroup(SourceCategoryType.GRAILSAPP_UTILS, "LBL_grails-app_utils", result); + addGroup(SourceCategoryType.SCRIPTS, "LBL_scripts", result); + addGroup(SourceCategoryType.SRC_GROOVY, "LBL_SrcGroovy", result); + addGroup(SourceCategoryType.TEST_INTEGRATION, "LBL_IntegrationTests", result); + addGroup(SourceCategoryType.TEST_UNIT, "LBL_UnitTests", result); } else if (GroovySources.SOURCES_TYPE_GRAILS.equals(type)) { - addGroup(SourceCategory.LIB, "LBL_lib", result); - addGroup(SourceCategory.GRAILSAPP_I18N, "LBL_grails-app_i18n", result); - addGroup(SourceCategory.WEBAPP, "LBL_web-app", result); - addGroup(SourceCategory.GRAILSAPP_VIEWS, "LBL_grails-app_views", result); - addGroup(SourceCategory.TEMPLATES, "LBL_grails-templates", result); + addGroup(SourceCategoryType.LIB, "LBL_lib", result); + addGroup(SourceCategoryType.GRAILSAPP_I18N, "LBL_grails-app_i18n", result); + addGroup(SourceCategoryType.WEBAPP, "LBL_web-app", result); + addGroup(SourceCategoryType.GRAILSAPP_VIEWS, "LBL_grails-app_views", result); + addGroup(SourceCategoryType.TEMPLATES, "LBL_grails-templates", result); } else if (GroovySources.SOURCES_TYPE_GRAILS_UNKNOWN.equals(type)) { // plugins may reside in project dir File pluginsDirFile = project.getBuildConfig().getProjectPluginsDir(); @@ -182,7 +182,7 @@ } } - addGroup(SourceCategory.SRC_GWT, "LBL_SrcGwt", result); + addGroup(SourceCategoryType.SRC_GWT, "LBL_SrcGwt", result); addUnknownGroups(KNOWN_FOLDERS_IN_GRAILS_APP, result, "grails-app", null); addUnknownGroups(KNOWN_OR_IGNORED_FOLDERS_IN_TEST, result, "test", "LBL_SomeTests"); } @@ -238,8 +238,10 @@ } } - private void addGroup(SourceCategory sourceCategory, String bundleLabel, List list) { - FileObject fileObject = projectDir.getFileObject(sourceCategory.getRelativePath()); + private void addGroup(SourceCategoryType sourceCategory, String bundleLabel, List list) { + FileObject fileObject = projectDir.getFileObject( + project.getSourceCategoriesFactory().getSourceCategory(sourceCategory).getRelativePath() + ); if (fileObject != null) { list.add(new Group(fileObject, NbBundle.getMessage(GrailsSources.class, bundleLabel))); } diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategory.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategoriesFactory.java copy from groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategory.java copy to groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategoriesFactory.java --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategory.java +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategoriesFactory.java @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. + * Copyright 2016 Oracle and/or its affiliates. All rights reserved. * * Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners. @@ -23,61 +23,60 @@ * 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 2007 Sun Microsystems, Inc. + * + * Portions Copyrighted 2016 Sun Microsystems, Inc. */ package org.netbeans.modules.groovy.grailsproject; +import java.util.Collections; +import java.util.Map; +import java.util.TreeMap; +import org.netbeans.modules.groovy.grails.api.GrailsPlatform; +import org.netbeans.modules.groovy.grails.api.GrailsPlatform.Version; + /** * - * @author schmidtm - * @author Martin Adamek + * @author Bruno Flavio */ -public enum SourceCategory { - - GRAILSAPP_CONF("grails-app/conf", null, null), - GRAILSAPP_CONTROLLERS("grails-app/controllers", "create-controller", "Controller.groovy"), - GRAILSAPP_DOMAIN("grails-app/domain", "create-domain-class", null), - GRAILSAPP_I18N("grails-app/i18n", null, null), - GRAILSAPP_SERVICES("grails-app/services", "create-service", "Service.groovy"), - GRAILSAPP_TAGLIB("grails-app/taglib", "create-tag-lib", "TagLib.groovy"), - GRAILSAPP_UTILS("grails-app/utils", null, null), - GRAILSAPP_VIEWS("grails-app/views", null, null), - PLUGINS("plugins", null, null), - TEST_INTEGRATION("test/integration", "create-integration-test", "Tests.groovy"), - TEST_UNIT("test/unit", "create-unit-test", "Tests.groovy"), - SCRIPTS("scripts", "create-script", null), - SRC_JAVA("src/java", null, null), - SRC_GWT("src/gwt", null, null), - SRC_GROOVY("src/groovy", null, null), - TEMPLATES("src/templates", "install-templates", null), - WEBAPP("web-app", null, null), - LIB("lib", null, null); - - private final String relativePath; +public class SourceCategoriesFactory { - private final String command; - - private final String suffix; - - SourceCategory(String relativePath, String command, String suffix) { - this.relativePath = relativePath; - this.command = command; - this.suffix = suffix; + private static final Map versions = + new TreeMap<>(Collections.reverseOrder()); + + static { + versions.put(SourceCategoriesGrails11.MIN_VERSION, new SourceCategoriesGrails11()); + versions.put(SourceCategoriesGrails301.MIN_VERSION, new SourceCategoriesGrails301()); + } + + private SourceCategoriesInterface categories; + + public SourceCategoriesFactory() { + this(GrailsPlatform.getDefault().getVersion()); + } + + public SourceCategoriesFactory(GrailsPlatform.Version version) { + this.categories = SourceCategoriesFactory.versions.entrySet().stream() + .filter(map -> version.compareTo(map.getKey()) >= 0) + .map( map -> map.getValue() ) + .findFirst() + .orElse(new SourceCategoriesGrails11()); + } + + public SourceCategory getSourceCategory(SourceCategoryType type) { + return categories.getSourceCategory(type); } - public String getRelativePath() { - return relativePath; - } - - public String getCommand() { - return command; - } - - public String getSuffix() { - return suffix; - } - -} +} \ No newline at end of file diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategoriesGrails11.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategoriesGrails11.java new file mode 100644 --- /dev/null +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategoriesGrails11.java @@ -0,0 +1,74 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle 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]" + * + * Contributor(s): + * + * Portions Copyrighted 2007 Sun Microsystems, Inc. + */ +package org.netbeans.modules.groovy.grailsproject; + +import java.util.HashMap; +import java.util.Map; +import org.netbeans.modules.groovy.grails.api.GrailsPlatform; + +/** + * + * @author schmidtm + * @author Martin Adamek + */ +public class SourceCategoriesGrails11 implements SourceCategoriesInterface { + + static public final GrailsPlatform.Version MIN_VERSION = GrailsPlatform.Version.VERSION_DEFAULT; + static private final Map SOURCE_CATEGORIES + = new HashMap<>(); + + static { + SOURCE_CATEGORIES.put(SourceCategoryType.GRAILSAPP_CONF, new SourceCategory("grails-app/conf", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.GRAILSAPP_CONTROLLERS, new SourceCategory("grails-app/controllers", "create-controller", "Controller.groovy")); + SOURCE_CATEGORIES.put(SourceCategoryType.GRAILSAPP_DOMAIN, new SourceCategory("grails-app/domain", "create-domain-class", null)); + SOURCE_CATEGORIES.put(SourceCategoryType.GRAILSAPP_I18N, new SourceCategory("grails-app/i18n", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.GRAILSAPP_SERVICES, new SourceCategory("grails-app/services", "create-service", "Service.groovy")); + SOURCE_CATEGORIES.put(SourceCategoryType.GRAILSAPP_TAGLIB, new SourceCategory("grails-app/taglib", "create-tag-lib", "TagLib.groovy")); + SOURCE_CATEGORIES.put(SourceCategoryType.GRAILSAPP_UTILS, new SourceCategory("grails-app/utils", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.GRAILSAPP_VIEWS, new SourceCategory("grails-app/views", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.PLUGINS, new SourceCategory("plugins", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.TEST_INTEGRATION, new SourceCategory("test/integration", "create-integration-test", "Tests.groovy")); + SOURCE_CATEGORIES.put(SourceCategoryType.TEST_UNIT, new SourceCategory("test/unit", "create-unit-test", "Tests.groovy")); + SOURCE_CATEGORIES.put(SourceCategoryType.SCRIPTS, new SourceCategory("scripts", "create-script", null)); + SOURCE_CATEGORIES.put(SourceCategoryType.SRC_JAVA, new SourceCategory("src/java", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.SRC_GWT, new SourceCategory("src/gwt", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.SRC_GROOVY, new SourceCategory("src/groovy", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.TEMPLATES, new SourceCategory("src/templates", "install-templates", null)); + SOURCE_CATEGORIES.put(SourceCategoryType.WEBAPP, new SourceCategory("web-app", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.LIB, new SourceCategory("lib", null, null)); + } + + @Override + public SourceCategory getSourceCategory(SourceCategoryType type) { + return SourceCategoriesGrails11.SOURCE_CATEGORIES.get(type); + } + +} diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategoriesGrails301.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategoriesGrails301.java new file mode 100644 --- /dev/null +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategoriesGrails301.java @@ -0,0 +1,75 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle 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]" + * + * Contributor(s): + * + * Portions Copyrighted 2007 Sun Microsystems, Inc. + */ +package org.netbeans.modules.groovy.grailsproject; + +import java.util.HashMap; +import java.util.Map; +import org.netbeans.modules.groovy.grails.api.GrailsPlatform; + +/** + * + * @author schmidtm + * @author Martin Adamek + */ +public class SourceCategoriesGrails301 implements SourceCategoriesInterface { + + static public final GrailsPlatform.Version MIN_VERSION = GrailsPlatform.Version.valueOf("3.0.1"); + + static private final Map SOURCE_CATEGORIES + = new HashMap<>(); + + static { + SOURCE_CATEGORIES.put(SourceCategoryType.GRAILSAPP_CONF, new SourceCategory("grails-app/conf", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.GRAILSAPP_CONTROLLERS, new SourceCategory("grails-app/controllers", "create-controller", "Controller.groovy")); + SOURCE_CATEGORIES.put(SourceCategoryType.GRAILSAPP_DOMAIN, new SourceCategory("grails-app/domain", "create-domain-class", null)); + SOURCE_CATEGORIES.put(SourceCategoryType.GRAILSAPP_I18N, new SourceCategory("grails-app/i18n", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.GRAILSAPP_SERVICES, new SourceCategory("grails-app/services", "create-service", "Service.groovy")); + SOURCE_CATEGORIES.put(SourceCategoryType.GRAILSAPP_TAGLIB, new SourceCategory("grails-app/taglib", "create-taglib", "TagLib.groovy")); + SOURCE_CATEGORIES.put(SourceCategoryType.GRAILSAPP_UTILS, new SourceCategory("grails-app/utils", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.GRAILSAPP_VIEWS, new SourceCategory("grails-app/views", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.PLUGINS, new SourceCategory("plugins", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.TEST_INTEGRATION, new SourceCategory("test/integration", "create-integration-test", "Tests.groovy")); + SOURCE_CATEGORIES.put(SourceCategoryType.TEST_UNIT, new SourceCategory("test/unit", "create-unit-test", "Tests.groovy")); + SOURCE_CATEGORIES.put(SourceCategoryType.SCRIPTS, new SourceCategory("scripts", "create-script", null)); + SOURCE_CATEGORIES.put(SourceCategoryType.SRC_JAVA, new SourceCategory("src/java", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.SRC_GWT, new SourceCategory("src/gwt", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.SRC_GROOVY, new SourceCategory("src/groovy", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.TEMPLATES, new SourceCategory("src/templates", "install-templates", null)); + SOURCE_CATEGORIES.put(SourceCategoryType.WEBAPP, new SourceCategory("web-app", null, null)); + SOURCE_CATEGORIES.put(SourceCategoryType.LIB, new SourceCategory("lib", null, null)); + } + + @Override + public SourceCategory getSourceCategory(SourceCategoryType type) { + return SourceCategoriesGrails301.SOURCE_CATEGORIES.get(type); + } + +} diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategoriesInterface.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategoriesInterface.java new file mode 100644 --- /dev/null +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategoriesInterface.java @@ -0,0 +1,52 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2016 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle 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 2016 Sun Microsystems, Inc. + */ +package org.netbeans.modules.groovy.grailsproject; + +/** + * + * @author Bruno Flavio + */ +public interface SourceCategoriesInterface { + + SourceCategory getSourceCategory(SourceCategoryType type); + +} diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategory.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategory.java --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategory.java +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategory.java @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. + * Copyright 2016 Oracle and/or its affiliates. All rights reserved. * * Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners. @@ -23,41 +23,32 @@ * 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 2007 Sun Microsystems, Inc. + * + * Portions Copyrighted 2016 Sun Microsystems, Inc. */ package org.netbeans.modules.groovy.grailsproject; /** * - * @author schmidtm - * @author Martin Adamek + * @author Bruno Flavio */ -public enum SourceCategory { - - GRAILSAPP_CONF("grails-app/conf", null, null), - GRAILSAPP_CONTROLLERS("grails-app/controllers", "create-controller", "Controller.groovy"), - GRAILSAPP_DOMAIN("grails-app/domain", "create-domain-class", null), - GRAILSAPP_I18N("grails-app/i18n", null, null), - GRAILSAPP_SERVICES("grails-app/services", "create-service", "Service.groovy"), - GRAILSAPP_TAGLIB("grails-app/taglib", "create-tag-lib", "TagLib.groovy"), - GRAILSAPP_UTILS("grails-app/utils", null, null), - GRAILSAPP_VIEWS("grails-app/views", null, null), - PLUGINS("plugins", null, null), - TEST_INTEGRATION("test/integration", "create-integration-test", "Tests.groovy"), - TEST_UNIT("test/unit", "create-unit-test", "Tests.groovy"), - SCRIPTS("scripts", "create-script", null), - SRC_JAVA("src/java", null, null), - SRC_GWT("src/gwt", null, null), - SRC_GROOVY("src/groovy", null, null), - TEMPLATES("src/templates", "install-templates", null), - WEBAPP("web-app", null, null), - LIB("lib", null, null); +public class SourceCategory { private final String relativePath; - + private final String command; private final String suffix; @@ -79,5 +70,4 @@ public String getSuffix() { return suffix; } - } diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategory.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategoryType.java copy from groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategory.java copy to groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategoryType.java --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategory.java +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/SourceCategoryType.java @@ -35,49 +35,23 @@ * @author schmidtm * @author Martin Adamek */ -public enum SourceCategory { - - GRAILSAPP_CONF("grails-app/conf", null, null), - GRAILSAPP_CONTROLLERS("grails-app/controllers", "create-controller", "Controller.groovy"), - GRAILSAPP_DOMAIN("grails-app/domain", "create-domain-class", null), - GRAILSAPP_I18N("grails-app/i18n", null, null), - GRAILSAPP_SERVICES("grails-app/services", "create-service", "Service.groovy"), - GRAILSAPP_TAGLIB("grails-app/taglib", "create-tag-lib", "TagLib.groovy"), - GRAILSAPP_UTILS("grails-app/utils", null, null), - GRAILSAPP_VIEWS("grails-app/views", null, null), - PLUGINS("plugins", null, null), - TEST_INTEGRATION("test/integration", "create-integration-test", "Tests.groovy"), - TEST_UNIT("test/unit", "create-unit-test", "Tests.groovy"), - SCRIPTS("scripts", "create-script", null), - SRC_JAVA("src/java", null, null), - SRC_GWT("src/gwt", null, null), - SRC_GROOVY("src/groovy", null, null), - TEMPLATES("src/templates", "install-templates", null), - WEBAPP("web-app", null, null), - LIB("lib", null, null); - - private final String relativePath; - - private final String command; - - private final String suffix; - - SourceCategory(String relativePath, String command, String suffix) { - this.relativePath = relativePath; - this.command = command; - this.suffix = suffix; - } - - public String getRelativePath() { - return relativePath; - } - - public String getCommand() { - return command; - } - - public String getSuffix() { - return suffix; - } - +public enum SourceCategoryType { + GRAILSAPP_CONF, + GRAILSAPP_CONTROLLERS, + GRAILSAPP_DOMAIN, + GRAILSAPP_I18N, + GRAILSAPP_SERVICES, + GRAILSAPP_TAGLIB, + GRAILSAPP_UTILS, + GRAILSAPP_VIEWS, + PLUGINS, + TEST_INTEGRATION, + TEST_UNIT, + SCRIPTS, + SRC_JAVA, + SRC_GWT, + SRC_GROOVY, + TEMPLATES, + WEBAPP, + LIB; } diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/classpath/ProjectClassPathImplementation.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/classpath/ProjectClassPathImplementation.java --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/classpath/ProjectClassPathImplementation.java +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/classpath/ProjectClassPathImplementation.java @@ -59,7 +59,8 @@ import org.netbeans.modules.groovy.grails.api.GrailsPlatform; import org.netbeans.modules.groovy.grails.api.GrailsProjectConfig; import org.netbeans.modules.groovy.grailsproject.GrailsProject; -import org.netbeans.modules.groovy.grailsproject.SourceCategory; +import org.netbeans.modules.groovy.grailsproject.SourceCategoriesFactory; +import org.netbeans.modules.groovy.grailsproject.SourceCategoryType; import org.netbeans.modules.groovy.grailsproject.config.BuildConfig; import org.netbeans.modules.groovy.grailsproject.plugins.GrailsPlugin; import org.netbeans.modules.groovy.grailsproject.plugins.GrailsPluginSupport; @@ -83,6 +84,7 @@ private final BuildConfigListener buildConfigListener = new BuildConfigListener(); private final GrailsProjectConfig projectConfig; private final File projectRoot; + private final SourceCategoriesFactory sourceCategoriesFactory; private List resources; private GrailsPlatform.Version version; @@ -95,6 +97,7 @@ this.projectConfig = projectConfig; this.projectRoot = FileUtil.toFile(projectConfig.getProject().getProjectDirectory()); this.version = projectConfig.getGrailsPlatform().getVersion(); + this.sourceCategoriesFactory = new SourceCategoriesFactory(); } public static ProjectClassPathImplementation forProject(Project project) { @@ -134,7 +137,7 @@ // http://grails.org/GWT+Plugin GrailsPluginSupport pluginSupport = GrailsPluginSupport.forProject(projectConfig.getProject()); if (pluginSupport != null && pluginSupport.usesPlugin("gwt")) { // NOI18N - File gwtDir = new File(new File(projectRoot, SourceCategory.LIB.getRelativePath()), "gwt"); // NOI18N + File gwtDir = new File(new File(projectRoot, sourceCategoriesFactory.getSourceCategory(SourceCategoryType.LIB).getRelativePath()), "gwt"); // NOI18N if (gwtDir.exists() && gwtDir.isDirectory()) { addJars(gwtDir, result, false); } @@ -242,7 +245,7 @@ return; } - File libDir = new File(root, SourceCategory.LIB.getRelativePath()); + File libDir = new File(root, sourceCategoriesFactory.getSourceCategory(SourceCategoryType.LIB).getRelativePath()); if (!libDir.exists() || !libDir.isDirectory()) { return; } diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/classpath/SourceRoots.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/classpath/SourceRoots.java --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/classpath/SourceRoots.java +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/classpath/SourceRoots.java @@ -54,6 +54,8 @@ import org.netbeans.modules.groovy.grailsproject.GrailsProject; import org.netbeans.modules.groovy.grailsproject.GrailsSources; import org.netbeans.modules.groovy.grailsproject.SourceCategory; +import org.netbeans.modules.groovy.grailsproject.SourceCategoriesFactory; +import org.netbeans.modules.groovy.grailsproject.SourceCategoryType; import org.netbeans.modules.groovy.grailsproject.plugins.GrailsPlugin; import org.netbeans.modules.groovy.grailsproject.plugins.GrailsPluginSupport; import org.openide.filesystems.FileObject; @@ -136,18 +138,19 @@ } private void addGrailsSourceRoots(FileObject projectRoot, List result) { - addRoot(projectRoot, SourceCategory.GRAILSAPP_CONF, result); - addRoot(projectRoot, SourceCategory.GRAILSAPP_CONTROLLERS, result); - addRoot(projectRoot, SourceCategory.GRAILSAPP_DOMAIN, result); - addRoot(projectRoot, SourceCategory.GRAILSAPP_SERVICES, result); - addRoot(projectRoot, SourceCategory.GRAILSAPP_TAGLIB, result); - addRoot(projectRoot, SourceCategory.GRAILSAPP_UTILS, result); - addRoot(projectRoot, SourceCategory.SCRIPTS, result); - addRoot(projectRoot, SourceCategory.SRC_GROOVY, result); - addRoot(projectRoot, SourceCategory.SRC_JAVA, result); - addRoot(projectRoot, SourceCategory.SRC_GWT, result); - addRoot(projectRoot, SourceCategory.TEST_INTEGRATION, result); - addRoot(projectRoot, SourceCategory.TEST_UNIT, result); + SourceCategoriesFactory sourceCategoriesFactory = project.getSourceCategoriesFactory(); + addRoot(projectRoot, sourceCategoriesFactory.getSourceCategory(SourceCategoryType.GRAILSAPP_CONF), result); + addRoot(projectRoot, sourceCategoriesFactory.getSourceCategory(SourceCategoryType.GRAILSAPP_CONTROLLERS), result); + addRoot(projectRoot, sourceCategoriesFactory.getSourceCategory(SourceCategoryType.GRAILSAPP_DOMAIN), result); + addRoot(projectRoot, sourceCategoriesFactory.getSourceCategory(SourceCategoryType.GRAILSAPP_SERVICES), result); + addRoot(projectRoot, sourceCategoriesFactory.getSourceCategory(SourceCategoryType.GRAILSAPP_TAGLIB), result); + addRoot(projectRoot, sourceCategoriesFactory.getSourceCategory(SourceCategoryType.GRAILSAPP_UTILS), result); + addRoot(projectRoot, sourceCategoriesFactory.getSourceCategory(SourceCategoryType.SCRIPTS), result); + addRoot(projectRoot, sourceCategoriesFactory.getSourceCategory(SourceCategoryType.SRC_GROOVY), result); + addRoot(projectRoot, sourceCategoriesFactory.getSourceCategory(SourceCategoryType.SRC_JAVA), result); + addRoot(projectRoot, sourceCategoriesFactory.getSourceCategory(SourceCategoryType.SRC_GWT), result); + addRoot(projectRoot, sourceCategoriesFactory.getSourceCategory(SourceCategoryType.TEST_INTEGRATION), result); + addRoot(projectRoot, sourceCategoriesFactory.getSourceCategory(SourceCategoryType.TEST_UNIT), result); File pluginsDirFile = project == null ? null : project.getBuildConfig().getProjectPluginsDir(); FileObject pluginsDir = pluginsDirFile == null ? null : FileUtil.toFileObject( diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/ui/TemplatesImpl.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/ui/TemplatesImpl.java --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/ui/TemplatesImpl.java +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/ui/TemplatesImpl.java @@ -44,7 +44,7 @@ import org.netbeans.api.project.SourceGroup; import org.netbeans.modules.groovy.grailsproject.GrailsProject; -import org.netbeans.modules.groovy.grailsproject.SourceCategory; +import org.netbeans.modules.groovy.grailsproject.SourceCategoryType; import org.netbeans.modules.groovy.grailsproject.ui.wizards.impl.GrailsArtifacts; import org.netbeans.spi.project.ui.PrivilegedTemplates; import org.netbeans.spi.project.ui.RecommendedTemplates; @@ -147,14 +147,14 @@ }; - private final SourceCategory sourceCategory; + private final SourceCategoryType sourceCategory; public TemplatesImpl(GrailsProject project, SourceGroup sourceGroup) { FileObject projectDir = project.getProjectDirectory(); FileObject rootFolder = sourceGroup.getRootFolder(); - sourceCategory = GrailsArtifacts.getCategoryForFolder(projectDir, rootFolder); + sourceCategory = GrailsArtifacts.getCategoryTypeForFolder(projectDir, rootFolder, project.getSourceCategoriesFactory()); } @Override diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/ui/wizards/GrailsArtifactWizardIterator.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/ui/wizards/GrailsArtifactWizardIterator.java --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/ui/wizards/GrailsArtifactWizardIterator.java +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/ui/wizards/GrailsArtifactWizardIterator.java @@ -79,6 +79,7 @@ import org.netbeans.modules.groovy.grails.api.GrailsProjectConfig; import org.netbeans.modules.groovy.grailsproject.GrailsProject; import org.netbeans.modules.groovy.grailsproject.SourceCategory; +import org.netbeans.modules.groovy.grailsproject.SourceCategoriesFactory; import org.netbeans.modules.groovy.grailsproject.actions.RefreshProjectRunnable; import org.netbeans.modules.groovy.grailsproject.ui.wizards.impl.GrailsArtifacts; import org.netbeans.modules.groovy.grailsproject.ui.wizards.impl.GrailsTargetChooserPanel; @@ -262,12 +263,13 @@ this.wiz = wiz; FileObject template = Templates.getTemplate(wiz); - - sourceCategory = GrailsArtifacts.getCategoryForTemplate(template); + + project = Templates.getProject(wiz).getLookup().lookup(GrailsProject.class); + + SourceCategoriesFactory sourceCategoriesFactory = project.getSourceCategoriesFactory(); + sourceCategory = sourceCategoriesFactory.getSourceCategory(GrailsArtifacts.getCategoryTypeForTemplate(template)); assert sourceCategory != null; - project = Templates.getProject(wiz).getLookup().lookup(GrailsProject.class); - index = 0; panels = createPanels(wiz); // Make sure list of steps is accurate. diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/ui/wizards/impl/GrailsArtifacts.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/ui/wizards/impl/GrailsArtifacts.java --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/ui/wizards/impl/GrailsArtifacts.java +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/ui/wizards/impl/GrailsArtifacts.java @@ -46,6 +46,8 @@ import org.netbeans.api.project.Project; import org.netbeans.api.project.SourceGroup; import org.netbeans.modules.groovy.grailsproject.SourceCategory; +import org.netbeans.modules.groovy.grailsproject.SourceCategoriesFactory; +import org.netbeans.modules.groovy.grailsproject.SourceCategoryType; import org.netbeans.modules.groovy.grailsproject.ui.TemplatesImpl; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; @@ -56,7 +58,7 @@ */ public class GrailsArtifacts { - public static SourceCategory getCategoryForFolder(FileObject projectRoot, FileObject fileObject) { + public static SourceCategoryType getCategoryTypeForFolder(FileObject projectRoot, FileObject fileObject, SourceCategoriesFactory sourceCategoriesFactory) { String dirName = null; if (projectRoot != null && fileObject.isFolder()) { dirName = FileUtil.getRelativePath(projectRoot, fileObject); @@ -64,64 +66,65 @@ if (dirName == null) { return null; } - if (SourceCategory.GRAILSAPP_CONF.getRelativePath().equals(dirName)) { - return SourceCategory.GRAILSAPP_CONF; - } else if (SourceCategory.GRAILSAPP_CONTROLLERS.getRelativePath().equals(dirName)) { - return SourceCategory.GRAILSAPP_CONTROLLERS; - } else if (SourceCategory.GRAILSAPP_DOMAIN.getRelativePath().equals(dirName)) { - return SourceCategory.GRAILSAPP_DOMAIN; - } else if (SourceCategory.TEST_INTEGRATION.getRelativePath().equals(dirName)) { - return SourceCategory.TEST_INTEGRATION; - } else if (SourceCategory.LIB.getRelativePath().equals(dirName)) { - return SourceCategory.LIB; - } else if (SourceCategory.GRAILSAPP_I18N.getRelativePath().equals(dirName)) { - return SourceCategory.GRAILSAPP_I18N; - } else if (SourceCategory.SCRIPTS.getRelativePath().equals(dirName)) { - return SourceCategory.SCRIPTS; - } else if (SourceCategory.GRAILSAPP_SERVICES.getRelativePath().equals(dirName)) { - return SourceCategory.GRAILSAPP_SERVICES; - } else if (SourceCategory.SRC_GROOVY.getRelativePath().equals(dirName)) { - return SourceCategory.SRC_GROOVY; - } else if (SourceCategory.SRC_JAVA.getRelativePath().equals(dirName)) { - return SourceCategory.SRC_JAVA; - } else if (SourceCategory.SRC_GWT.getRelativePath().equals(dirName)) { - return SourceCategory.SRC_GWT; - } else if (SourceCategory.GRAILSAPP_TAGLIB.getRelativePath().equals(dirName)) { - return SourceCategory.GRAILSAPP_TAGLIB; - } else if (SourceCategory.TEST_UNIT.getRelativePath().equals(dirName)) { - return SourceCategory.TEST_UNIT; - } else if (SourceCategory.GRAILSAPP_UTILS.getRelativePath().equals(dirName)) { - return SourceCategory.GRAILSAPP_UTILS; - } else if (SourceCategory.GRAILSAPP_VIEWS.getRelativePath().equals(dirName)) { - return SourceCategory.GRAILSAPP_VIEWS; - } else if (SourceCategory.WEBAPP.getRelativePath().equals(dirName)) { - return SourceCategory.WEBAPP; + + if (sourceCategoriesFactory.getSourceCategory( SourceCategoryType.GRAILSAPP_CONF).getRelativePath().equals(dirName)) { + return SourceCategoryType.GRAILSAPP_CONF; + } else if (sourceCategoriesFactory.getSourceCategory( SourceCategoryType.GRAILSAPP_CONTROLLERS).getRelativePath().equals(dirName)) { + return SourceCategoryType.GRAILSAPP_CONTROLLERS; + } else if (sourceCategoriesFactory.getSourceCategory( SourceCategoryType.GRAILSAPP_DOMAIN).getRelativePath().equals(dirName)) { + return SourceCategoryType.GRAILSAPP_DOMAIN; + } else if (sourceCategoriesFactory.getSourceCategory( SourceCategoryType.TEST_INTEGRATION).getRelativePath().equals(dirName)) { + return SourceCategoryType.TEST_INTEGRATION; + } else if (sourceCategoriesFactory.getSourceCategory( SourceCategoryType.LIB).getRelativePath().equals(dirName)) { + return SourceCategoryType.LIB; + } else if (sourceCategoriesFactory.getSourceCategory( SourceCategoryType.GRAILSAPP_I18N).getRelativePath().equals(dirName)) { + return SourceCategoryType.GRAILSAPP_I18N; + } else if (sourceCategoriesFactory.getSourceCategory( SourceCategoryType.SCRIPTS).getRelativePath().equals(dirName)) { + return SourceCategoryType.SCRIPTS; + } else if (sourceCategoriesFactory.getSourceCategory( SourceCategoryType.GRAILSAPP_SERVICES).getRelativePath().equals(dirName)) { + return SourceCategoryType.GRAILSAPP_SERVICES; + } else if (sourceCategoriesFactory.getSourceCategory( SourceCategoryType.SRC_GROOVY).getRelativePath().equals(dirName)) { + return SourceCategoryType.SRC_GROOVY; + } else if (sourceCategoriesFactory.getSourceCategory( SourceCategoryType.SRC_JAVA).getRelativePath().equals(dirName)) { + return SourceCategoryType.SRC_JAVA; + } else if (sourceCategoriesFactory.getSourceCategory( SourceCategoryType.SRC_GWT).getRelativePath().equals(dirName)) { + return SourceCategoryType.SRC_GWT; + } else if (sourceCategoriesFactory.getSourceCategory( SourceCategoryType.GRAILSAPP_TAGLIB).getRelativePath().equals(dirName)) { + return SourceCategoryType.GRAILSAPP_TAGLIB; + } else if (sourceCategoriesFactory.getSourceCategory( SourceCategoryType.TEST_UNIT).getRelativePath().equals(dirName)) { + return SourceCategoryType.TEST_UNIT; + } else if (sourceCategoriesFactory.getSourceCategory( SourceCategoryType.GRAILSAPP_UTILS).getRelativePath().equals(dirName)) { + return SourceCategoryType.GRAILSAPP_UTILS; + } else if (sourceCategoriesFactory.getSourceCategory( SourceCategoryType.GRAILSAPP_VIEWS).getRelativePath().equals(dirName)) { + return SourceCategoryType.GRAILSAPP_VIEWS; + } else if (sourceCategoriesFactory.getSourceCategory( SourceCategoryType.WEBAPP).getRelativePath().equals(dirName)) { + return SourceCategoryType.WEBAPP; } return null; } - public static SourceCategory getCategoryForTemplate(FileObject template) { + public static SourceCategoryType getCategoryTypeForTemplate(FileObject template) { String templatePath = template.getPath(); if (TemplatesImpl.CONTROLLER.equals(templatePath)) { // NOI18N - return SourceCategory.GRAILSAPP_CONTROLLERS; + return SourceCategoryType.GRAILSAPP_CONTROLLERS; } else if (TemplatesImpl.DOMAIN_CLASS.equals(templatePath)) { - return SourceCategory.GRAILSAPP_DOMAIN; + return SourceCategoryType.GRAILSAPP_DOMAIN; } else if (TemplatesImpl.GANT_SCRIPT.equals(templatePath)) { - return SourceCategory.SCRIPTS; + return SourceCategoryType.SCRIPTS; } else if (TemplatesImpl.GROOVY_CLASS.equals(templatePath)) { - return SourceCategory.SRC_GROOVY; + return SourceCategoryType.SRC_GROOVY; } else if (TemplatesImpl.GROOVY_SCRIPT.equals(templatePath)) { - return SourceCategory.SCRIPTS; + return SourceCategoryType.SCRIPTS; } else if (TemplatesImpl.GSP.equals(templatePath)) { - return SourceCategory.GRAILSAPP_VIEWS; + return SourceCategoryType.GRAILSAPP_VIEWS; } else if (TemplatesImpl.INTEGRATION_TEST.equals(templatePath)) { - return SourceCategory.TEST_INTEGRATION; + return SourceCategoryType.TEST_INTEGRATION; } else if (TemplatesImpl.SERVICE.equals(templatePath)) { - return SourceCategory.GRAILSAPP_SERVICES; + return SourceCategoryType.GRAILSAPP_SERVICES; } else if (TemplatesImpl.TAG_LIB.equals(templatePath)) { - return SourceCategory.GRAILSAPP_TAGLIB; + return SourceCategoryType.GRAILSAPP_TAGLIB; } else if (TemplatesImpl.UNIT_TEST.equals(templatePath)) { - return SourceCategory.TEST_UNIT; + return SourceCategoryType.TEST_UNIT; } return null; }