# HG changeset patch # Parent afcd7be3c368337866c2a303683ec8bd0dad97ab Migration of groovy cluster to DataObjecRegistration diff --git a/groovy.editor/nbproject/project.xml b/groovy.editor/nbproject/project.xml --- a/groovy.editor/nbproject/project.xml +++ b/groovy.editor/nbproject/project.xml @@ -367,11 +367,6 @@ - org.netbeans.modules.nbjunit - - - - org.netbeans.modules.projectui diff --git a/groovy.editor/src/org/netbeans/modules/groovy/editor/api/parser/GroovyLanguage.java b/groovy.editor/src/org/netbeans/modules/groovy/editor/api/parser/GroovyLanguage.java --- a/groovy.editor/src/org/netbeans/modules/groovy/editor/api/parser/GroovyLanguage.java +++ b/groovy.editor/src/org/netbeans/modules/groovy/editor/api/parser/GroovyLanguage.java @@ -71,10 +71,14 @@ import org.netbeans.modules.groovy.editor.api.StructureAnalyzer; import org.netbeans.modules.groovy.editor.api.completion.CompletionHandler; import org.netbeans.modules.groovy.editor.api.lexer.GroovyTokenId; +import static org.netbeans.modules.groovy.editor.api.parser.GroovyLanguage.*; import org.netbeans.modules.groovy.editor.hints.infrastructure.GroovyHintsProvider; import org.netbeans.modules.parsing.spi.Parser; import org.netbeans.modules.parsing.spi.indexing.EmbeddingIndexerFactory; import org.netbeans.modules.parsing.spi.indexing.PathRecognizerRegistration; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; import org.openide.filesystems.MIMEResolver; import org.openide.util.Lookup; import org.openide.windows.TopComponent; @@ -88,24 +92,39 @@ @MIMEResolver.ExtensionRegistration( displayName="#GroovyResolver", extension={ "groovy" }, - mimeType="text/x-groovy", + mimeType=GROOVY_MIME_TYPE, position=281 ) -@LanguageRegistration(mimeType="text/x-groovy", useMultiview=true) -@PathRecognizerRegistration(mimeTypes="text/x-groovy", sourcePathIds=ClassPath.SOURCE, libraryPathIds={}, binaryLibraryPathIds={}) //NOI18N +@LanguageRegistration(mimeType=GROOVY_MIME_TYPE, useMultiview=true) +@PathRecognizerRegistration(mimeTypes=GROOVY_MIME_TYPE, sourcePathIds=ClassPath.SOURCE, libraryPathIds={}, binaryLibraryPathIds={}) //NOI18N +@ActionReferences({ + @ActionReference(id = @ActionID(category = "System", id = "org.openide.actions.OpenAction"), path = ACTIONS, position = 100), + @ActionReference(id = @ActionID(category = "Edit", id = "org.openide.actions.CutAction"), path = ACTIONS, position = 300, separatorBefore = 200), + @ActionReference(id = @ActionID(category = "Edit", id = "org.openide.actions.CopyAction"), path = ACTIONS, position = 400), + @ActionReference(id = @ActionID(category = "Edit", id = "org.openide.actions.PasteAction"), path = ACTIONS, position = 500, separatorAfter = 600), + @ActionReference(id = @ActionID(category = "System", id = "org.openide.actions.NewAction"), path = ACTIONS, position = 700), + @ActionReference(id = @ActionID(category = "Edit", id = "org.openide.actions.DeleteAction"), path = ACTIONS, position = 800), + @ActionReference(id = @ActionID(category = "System", id = "org.openide.actions.RenameAction"), path = ACTIONS, position = 900, separatorAfter = 1000), + @ActionReference(id = @ActionID(category = "System", id = "org.openide.actions.SaveAsTemplateAction"), path = ACTIONS, position = 1100, separatorAfter = 1200), + @ActionReference(id = @ActionID(category = "System", id = "org.openide.actions.FileSystemAction"), path = ACTIONS, position = 1300, separatorAfter = 1400), + @ActionReference(id = @ActionID(category = "System", id = "org.openide.actions.ToolsAction"), path = ACTIONS, position = 1500), + @ActionReference(id = @ActionID(category = "System", id = "org.openide.actions.PropertiesAction"), path = ACTIONS, position = 1600) +}) public class GroovyLanguage extends DefaultLanguageConfig { + public static final String GROOVY_MIME_TYPE ="text/x-groovy"; + public static final String ACTIONS = "Loaders/"+GROOVY_MIME_TYPE+"/Actions"; + // Copy of groovy/support/resources icon because some API change caused // that it's not possible to refer to resource from different module private static final String GROOVY_FILE_ICON_16x16 = "org/netbeans/modules/groovy/editor/resources/GroovyFile16x16.png"; - - + public GroovyLanguage() { } @MultiViewElement.Registration( displayName = "#CTL_SourceTabCaption", - mimeType = "text/x-groovy", + mimeType = GROOVY_MIME_TYPE, iconBase = GROOVY_FILE_ICON_16x16, persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED, preferredID = "groovy.source", diff --git a/groovy.editor/src/org/netbeans/modules/groovy/editor/resources/layer.xml b/groovy.editor/src/org/netbeans/modules/groovy/editor/resources/layer.xml --- a/groovy.editor/src/org/netbeans/modules/groovy/editor/resources/layer.xml +++ b/groovy.editor/src/org/netbeans/modules/groovy/editor/resources/layer.xml @@ -102,82 +102,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - diff --git a/groovy.grailsproject/nbproject/project.xml b/groovy.grailsproject/nbproject/project.xml --- a/groovy.grailsproject/nbproject/project.xml +++ b/groovy.grailsproject/nbproject/project.xml @@ -323,11 +323,6 @@ - org.netbeans.modules.nbjunit - - - - org.netbeans.modules.projectui diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/Bundle.properties b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/Bundle.properties --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/Bundle.properties +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/Bundle.properties @@ -1,64 +1,58 @@ -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. -# -# Copyright 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]" -# -# 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. - -CTL_GotoControllerAction=Go to Grails Con&troller -CTL_GotoDomainClassAction=Go to Grails Domain class -CTL_GotoViewAction=Go to Grails Vi&ew -LBL_process_problem=There was a problem creating the grails process: - -CTL_GenerateAllAction=Generate All -CTL_GenerateViewsAction=Generate Views - -CTL_ManagePluginsAction=Grails Plugins... -CTL_Close=Close -CTL_PluginTitle=Grails Plugins - -MSG_Runtime_Not_Configured=The Grails Home has not been set.
\ -Use menu Tools/Options/Groovy to set the environment. - - -LBL_ResolvePlugins=Resolve Plugins - -CTL_GrailsCommandAction=Run/Debug Grails Command... -#Run/Debug Grails Command... - -LBL_ResolvingPluginsLabel=Resolving Project Plugins ... -LBL_Resolving_Project_Plugins=Resolving Project Plugins -LBL_Resolving_Project_Plugins_progress=Resolving Project Plugins +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. +# +# Copyright 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]" +# +# 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. + +LBL_process_problem=There was a problem creating the grails process: + + +CTL_ManagePluginsAction=Grails Plugins... +CTL_Close=Close +CTL_PluginTitle=Grails Plugins + +MSG_Runtime_Not_Configured=The Grails Home has not been set.
\ +Use menu Tools/Options/Groovy to set the environment. + + +LBL_ResolvePlugins=Resolve Plugins + +#Run/Debug Grails Command... + +LBL_ResolvingPluginsLabel=Resolving Project Plugins ... +LBL_Resolving_Project_Plugins=Resolving Project Plugins +LBL_Resolving_Project_Plugins_progress=Resolving Project Plugins diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GenerateAllAction.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GenerateAllAction.java --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GenerateAllAction.java +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GenerateAllAction.java @@ -41,12 +41,21 @@ */ package org.netbeans.modules.groovy.grailsproject.actions; -import org.openide.util.NbBundle; +import static org.netbeans.modules.groovy.editor.api.parser.GroovyLanguage.ACTIONS; +import static org.netbeans.modules.groovy.grailsproject.actions.Bundle.CTL_GenerateAllAction; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionRegistration; +import org.openide.util.NbBundle.Messages; +@Messages("CTL_GenerateAllAction=Generate All") +@ActionID(id = "org.netbeans.modules.groovy.grailsproject.actions.GenerateAllAction", category = "Build") +@ActionRegistration(lazy = false, displayName = "#CTL_GenerateAllAction") +@ActionReference(path = ACTIONS, position = 20,separatorAfter=50) public final class GenerateAllAction extends GenerateAction { public GenerateAllAction() { - super("generate-all", NbBundle.getMessage(GenerateAllAction.class, "CTL_GenerateAllAction")); + super("generate-all", CTL_GenerateAllAction()); } } diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GenerateViewsAction.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GenerateViewsAction.java --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GenerateViewsAction.java +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GenerateViewsAction.java @@ -42,16 +42,26 @@ package org.netbeans.modules.groovy.grailsproject.actions; -import org.openide.util.NbBundle; +import static org.netbeans.modules.groovy.editor.api.parser.GroovyLanguage.ACTIONS; +import static org.netbeans.modules.groovy.grailsproject.actions.Bundle.CTL_GenerateViewsAction; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionRegistration; +import org.openide.util.NbBundle.Messages; /** * * @author Petr Hejl */ +@Messages("CTL_GenerateViewsAction=Generate Views") +@ActionID(id = "org.netbeans.modules.groovy.grailsproject.actions.GenerateViewsAction", category = "Build") +@ActionRegistration(lazy = false, displayName = "#CTL_GenerateViewsAction") +@ActionReference(path = ACTIONS, position = 0,separatorBefore=-100) + public final class GenerateViewsAction extends GenerateAction { public GenerateViewsAction() { - super("generate-views", NbBundle.getMessage(GenerateViewsAction.class, "CTL_GenerateViewsAction")); + super("generate-views", CTL_GenerateViewsAction()); } } diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GotoControllerAction.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GotoControllerAction.java --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GotoControllerAction.java +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GotoControllerAction.java @@ -45,12 +45,25 @@ import javax.swing.text.JTextComponent; import org.netbeans.editor.BaseAction; import org.netbeans.modules.groovy.grailsproject.NavigationSupport; -import org.openide.util.NbBundle; +import static org.netbeans.modules.groovy.grailsproject.actions.Bundle.CTL_GotoControllerAction; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; +import org.openide.awt.ActionRegistration; +import org.openide.util.NbBundle.Messages; + +@Messages("CTL_GotoControllerAction=Go to Grails Con&troller") +@ActionID(id = "org.netbeans.modules.groovy.grailsproject.actions.GotoControllerAction", category = "Groovy") +@ActionRegistration(lazy = false, displayName = "#CTL_GotoControllerAction") +@ActionReferences(value = { + @ActionReference(path = "Menu/GoTo", position = 550), + @ActionReference(path = "Editors/text/x-groovy/Popup/goto", position = 150), + @ActionReference(path = "Editors/text/x-gsp/Popup/goto", position = 150)}) public final class GotoControllerAction extends BaseAction { public GotoControllerAction() { - super(NbBundle.getMessage(GotoViewAction.class, "CTL_GotoControllerAction")); // NOI18N + super(CTL_GotoControllerAction()); // NOI18N } @Override diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GotoDomainClassAction.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GotoDomainClassAction.java --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GotoDomainClassAction.java +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GotoDomainClassAction.java @@ -45,12 +45,18 @@ import javax.swing.text.JTextComponent; import org.netbeans.editor.BaseAction; import org.netbeans.modules.groovy.grailsproject.NavigationSupport; -import org.openide.util.NbBundle; +import static org.netbeans.modules.groovy.grailsproject.actions.Bundle.CTL_GotoControllerAction; +import org.openide.awt.ActionID; +import org.openide.awt.ActionRegistration; +import org.openide.util.NbBundle.Messages; +@Messages("CTL_GotoDomainClassAction=Go to Grails Domain class") +@ActionID(id = "org.netbeans.modules.groovy.grailsproject.actions.GotoDomainClassAction", category = "Groovy") +@ActionRegistration(lazy = false, displayName = "#CTL_GotoDomainClassAction") public final class GotoDomainClassAction extends BaseAction { public GotoDomainClassAction() { - super(NbBundle.getMessage(GotoViewAction.class, "CTL_GotoDomainClassAction")); // NOI18N + super(CTL_GotoControllerAction()); // NOI18N } @Override diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GotoViewAction.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GotoViewAction.java --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GotoViewAction.java +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GotoViewAction.java @@ -45,12 +45,25 @@ import javax.swing.text.JTextComponent; import org.netbeans.editor.BaseAction; import org.netbeans.modules.groovy.grailsproject.NavigationSupport; -import org.openide.util.NbBundle; +import static org.netbeans.modules.groovy.grailsproject.actions.Bundle.CTL_GotoViewAction; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; +import org.openide.awt.ActionRegistration; +import org.openide.util.NbBundle.Messages; + +@Messages("CTL_GotoViewAction=Go to Grails Vi&ew") +@ActionID(id = "org.netbeans.modules.groovy.grailsproject.actions.GotoViewAction", category = "Groovy") +@ActionRegistration(lazy = false, displayName = "#CTL_GotoViewAction") +@ActionReferences(value = { + @ActionReference(path = "Menu/GoTo", position = 575), + @ActionReference(path = "Editors/text/x-groovy/Popup/goto", position = 100), + @ActionReference(path = "Editors/text/x-gsp/Popup/goto", position = 100)}) public final class GotoViewAction extends BaseAction { public GotoViewAction() { - super(NbBundle.getMessage(GotoViewAction.class, "CTL_GotoViewAction")); // NOI18N + super(CTL_GotoViewAction()); // NOI18N } @Override diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GrailsCommandAction.java b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GrailsCommandAction.java --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GrailsCommandAction.java +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/actions/GrailsCommandAction.java @@ -48,20 +48,27 @@ import org.netbeans.api.extexecution.ExecutionService; import org.netbeans.api.project.ProjectInformation; import org.netbeans.modules.groovy.grails.api.ExecutionSupport; +import org.netbeans.modules.groovy.grails.api.GrailsPlatform; import org.netbeans.modules.groovy.grails.api.GrailsProjectConfig; -import org.netbeans.modules.groovy.grails.api.GrailsPlatform; import org.netbeans.modules.groovy.grailsproject.GrailsProject; import org.netbeans.modules.groovy.grailsproject.GrailsServerState; +import static org.netbeans.modules.groovy.grailsproject.actions.Bundle.CTL_GrailsCommandAction; import org.netbeans.modules.groovy.grailsproject.commands.GrailsCommandChooser; import org.netbeans.modules.groovy.grailsproject.commands.GrailsCommandSupport; +import org.openide.awt.ActionID; +import org.openide.awt.ActionRegistration; import org.openide.util.HelpCtx; -import org.openide.util.NbBundle; +import org.openide.util.NbBundle.Messages; import org.openide.util.actions.CallableSystemAction; /** * * @author Petr Hejl */ +@Messages("CTL_GrailsCommandAction=Run/Debug Grails Command...") +@ActionID(id = "org.netbeans.modules.groovy.grailsproject.actions.GrailsCommandAction", category = "Groovy") +@ActionRegistration(lazy = false, displayName = "#CTL_GrailsCommandAction") + public class GrailsCommandAction extends CallableSystemAction { @Override @@ -167,7 +174,7 @@ @Override public String getName() { - return NbBundle.getMessage(GrailsCommandAction.class, "CTL_GrailsCommandAction"); + return CTL_GrailsCommandAction(); } } diff --git a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/resources/layer.xml b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/resources/layer.xml --- a/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/resources/layer.xml +++ b/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/resources/layer.xml @@ -1,55 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -163,33 +114,11 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/groovy.gsp/src/org/netbeans/modules/groovy/gsp/GspLanguage.java b/groovy.gsp/src/org/netbeans/modules/groovy/gsp/GspLanguage.java --- a/groovy.gsp/src/org/netbeans/modules/groovy/gsp/GspLanguage.java +++ b/groovy.gsp/src/org/netbeans/modules/groovy/gsp/GspLanguage.java @@ -54,7 +54,7 @@ import org.netbeans.modules.parsing.spi.Parser; -@LanguageRegistration(mimeType="text/x-gsp", useCustomEditorKit=true, useMultiview=true) //NOI18N +@LanguageRegistration(mimeType=GspTokenId.MIME_TYPE, useCustomEditorKit=true, useMultiview=true) //NOI18N public class GspLanguage extends DefaultLanguageConfig { public GspLanguage() { diff --git a/groovy.gsp/src/org/netbeans/modules/groovy/gsp/loaders/GspDataLoader.java b/groovy.gsp/src/org/netbeans/modules/groovy/gsp/loaders/GspDataLoader.java --- a/groovy.gsp/src/org/netbeans/modules/groovy/gsp/loaders/GspDataLoader.java +++ b/groovy.gsp/src/org/netbeans/modules/groovy/gsp/loaders/GspDataLoader.java @@ -46,15 +46,34 @@ import java.io.IOException; import org.netbeans.modules.groovy.gsp.lexer.GspTokenId; +import static org.netbeans.modules.groovy.gsp.loaders.GspDataLoader.ACTIONS; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; import org.openide.filesystems.FileObject; +import org.openide.loaders.DataObject.Registration; import org.openide.loaders.DataObjectExistsException; import org.openide.loaders.MultiDataObject; import org.openide.loaders.UniFileLoader; import org.openide.util.NbBundle; +@Registration(position = 99999, displayName = "org.netbeans.modules.groovy.gsp.resources.Bundle#Loaders/text/x-gsp/Factories/org-netbeans-modules-groovy-gsp-loaders-GspDataLoader.instance", mimeType = GspTokenId.MIME_TYPE,iconBase="org/netbeans/modules/groovy/gsp/resources/GspFile16x16.png") + +@ActionReferences(value = { + @ActionReference(id = @ActionID(category = "System", id = "org.openide.actions.OpenAction"), path = ACTIONS, position = 100), + @ActionReference(id = @ActionID(category = "System", id = "org.openide.actions.FileSystemAction"), path = ACTIONS, position = 200, separatorAfter = 300), + @ActionReference(id = @ActionID(category = "Edit", id = "org.openide.actions.CutAction"), path = ACTIONS, position = 400), + @ActionReference(id = @ActionID(category = "Edit", id = "org.openide.actions.CopyAction"), path = ACTIONS, position = 500, separatorAfter = 600), + @ActionReference(id = @ActionID(category = "Edit", id = "org.openide.actions.DeleteAction"), path = ACTIONS, position = 700), + @ActionReference(id = @ActionID(category = "System", id = "org.openide.actions.RenameAction"), path = ACTIONS, position = 800, separatorAfter = 900), + @ActionReference(id = @ActionID(category = "System", id = "org.openide.actions.SaveAsTemplateAction"), path = ACTIONS, position = 1000, separatorAfter = 1100), + @ActionReference(id = @ActionID(category = "System", id = "org.openide.actions.ToolsAction"), path = ACTIONS, position = 1200), + @ActionReference(id = @ActionID(category = "System", id = "org.openide.actions.PropertiesAction"), path = ACTIONS, position = 1300)}) + public class GspDataLoader extends UniFileLoader { private static final long serialVersionUID = 1L; + protected static final String ACTIONS = "Loaders/"+GspTokenId.MIME_TYPE+"/Actions"; public GspDataLoader() { super("org.netbeans.modules.groovy.gsp.loaders.GspDataObject"); @@ -77,7 +96,7 @@ @Override protected String actionsContext() { - return "Loaders/" + GspTokenId.MIME_TYPE + "/Actions"; + return ACTIONS; } } diff --git a/groovy.gsp/src/org/netbeans/modules/groovy/gsp/loaders/GspDataObject.java b/groovy.gsp/src/org/netbeans/modules/groovy/gsp/loaders/GspDataObject.java --- a/groovy.gsp/src/org/netbeans/modules/groovy/gsp/loaders/GspDataObject.java +++ b/groovy.gsp/src/org/netbeans/modules/groovy/gsp/loaders/GspDataObject.java @@ -47,6 +47,7 @@ import java.io.IOException; import org.netbeans.core.spi.multiview.MultiViewElement; import org.netbeans.core.spi.multiview.text.MultiViewEditorElement; +import org.netbeans.modules.groovy.gsp.lexer.GspTokenId; import org.openide.filesystems.FileObject; import org.openide.filesystems.MIMEResolver; import org.openide.loaders.DataObjectExistsException; @@ -58,7 +59,7 @@ @MIMEResolver.ExtensionRegistration( displayName="#GspResolver", extension="gsp", - mimeType="text/x-gsp", + mimeType=GspTokenId.MIME_TYPE, position=255 ) public class GspDataObject extends MultiDataObject @@ -66,7 +67,7 @@ public GspDataObject(FileObject pf, GspDataLoader loader) throws DataObjectExistsException, IOException { super(pf, loader); - registerEditor("text/x-gsp", true); + registerEditor(GspTokenId.MIME_TYPE, true); } @Override @@ -82,7 +83,7 @@ @MultiViewElement.Registration( displayName = "#CTL_SourceTabCaption", iconBase = "org/netbeans/modules/groovy/gsp/resources/GspFile16x16.png", - mimeType = "text/x-gsp", + mimeType = GspTokenId.MIME_TYPE, persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED, preferredID = "groovy.gsp", position = 1 diff --git a/groovy.gsp/src/org/netbeans/modules/groovy/gsp/resources/layer.xml b/groovy.gsp/src/org/netbeans/modules/groovy/gsp/resources/layer.xml --- a/groovy.gsp/src/org/netbeans/modules/groovy/gsp/resources/layer.xml +++ b/groovy.gsp/src/org/netbeans/modules/groovy/gsp/resources/layer.xml @@ -1,74 +1,15 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/groovy.support/src/org/netbeans/modules/groovy/support/Bundle.properties b/groovy.support/src/org/netbeans/modules/groovy/support/Bundle.properties --- a/groovy.support/src/org/netbeans/modules/groovy/support/Bundle.properties +++ b/groovy.support/src/org/netbeans/modules/groovy/support/Bundle.properties @@ -1,88 +1,87 @@ -# 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): -# -# The Original Software is NetBeans. The Initial Developer of the Original -# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun -# Microsystems, Inc. All Rights Reserved. -# -# 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. - -LBL_GroovySetting=Groovy - -PROP_GroovyHome=Groovy Home -HINT_GroovyHome=Groovy installation directory. - -LBL_loaderName=Groovy Objects - -MSG_HomeNotSet=Groovy home is not set.\n\ -Go to Tools -> Options -> Advanced Options -> Building -> Groovy and specify where Groovy is installed. - -MSG_HomeNotSetTemplate=Groovy home is not set.\n\ -After finishing the "Create new..." wizard, go to Tools -> Options -> Building -> Groovy\n\ -and specify where Groovy is installed.\n\ -Then run Tools -> Make WebApp Groovy Compliant action to correct your web application. - -# manifest.mf -OpenIDE-Module-Name=Coyote - Groovy Support -OpenIDE-Module-Display-Category=Tools -OpenIDE-Module-Short-Description=Enables editing and running of scripts written in Groovy language. -OpenIDE-Module-Long-Description=The Groovy Support module enables editing and running of \ -user application files written in Groovy language. This module requires groovy installation \ -on the computer. Groovy home page: http://groovy.codehaus.org/ - -#MakeGroovyWebApp -CTL_MakeGroovyWebAppAction=Make WebApp Groovy Compliant -EXC_UnsupportedVersion=Unsupported web.xml version: {0} -MSG_ConfirmUpdateWebXML=Do you want to make {0} web application Groovy compliant?\n\ -Several elements will be added WEB-INF/web.xml deployment descriptor\n\ -and a few required libraries will be added to the project. - -TIT_ConfirmUpdateWebXML=Confirm web.xml update - -# Messages for the IDE's status line -MSG_ScriptStarted=Script {0} started. -MSG_ScriptFinished=Script {0} finished. -MSG_ScriptFailed=Script {0} failed. - -EXC_LibraryNotFound=Cannot find {0} library in {1}. - -LBL_No_Build_XML_Found=The project does not have a build script. -LBL_RunFile_Action=Run File -LBL_CompileFile_Action=Compile File -ACTION_run.single=Run File -ACTION_debug.single=Debug File - -LBL_No_Main_Classs_Found=Class "{0}" does not have a main method. +# 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): +# +# The Original Software is NetBeans. The Initial Developer of the Original +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun +# Microsystems, Inc. All Rights Reserved. +# +# 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. + +LBL_GroovySetting=Groovy + +PROP_GroovyHome=Groovy Home +HINT_GroovyHome=Groovy installation directory. + +LBL_loaderName=Groovy Objects + +MSG_HomeNotSet=Groovy home is not set.\n\ +Go to Tools -> Options -> Advanced Options -> Building -> Groovy and specify where Groovy is installed. + +MSG_HomeNotSetTemplate=Groovy home is not set.\n\ +After finishing the "Create new..." wizard, go to Tools -> Options -> Building -> Groovy\n\ +and specify where Groovy is installed.\n\ +Then run Tools -> Make WebApp Groovy Compliant action to correct your web application. + +# manifest.mf +OpenIDE-Module-Name=Coyote - Groovy Support +OpenIDE-Module-Display-Category=Tools +OpenIDE-Module-Short-Description=Enables editing and running of scripts written in Groovy language. +OpenIDE-Module-Long-Description=The Groovy Support module enables editing and running of \ +user application files written in Groovy language. This module requires groovy installation \ +on the computer. Groovy home page: http://groovy.codehaus.org/ + +#MakeGroovyWebApp +CTL_MakeGroovyWebAppAction=Make WebApp Groovy Compliant +EXC_UnsupportedVersion=Unsupported web.xml version: {0} +MSG_ConfirmUpdateWebXML=Do you want to make {0} web application Groovy compliant?\n\ +Several elements will be added WEB-INF/web.xml deployment descriptor\n\ +and a few required libraries will be added to the project. + +TIT_ConfirmUpdateWebXML=Confirm web.xml update + +# Messages for the IDE's status line +MSG_ScriptStarted=Script {0} started. +MSG_ScriptFinished=Script {0} finished. +MSG_ScriptFailed=Script {0} failed. + +EXC_LibraryNotFound=Cannot find {0} library in {1}. + +LBL_No_Build_XML_Found=The project does not have a build script. +LBL_CompileFile_Action=Compile File +ACTION_run.single=Run File +ACTION_debug.single=Debug File + +LBL_No_Main_Classs_Found=Class "{0}" does not have a main method. diff --git a/groovy.support/src/org/netbeans/modules/groovy/support/GroovyProjectModule.java b/groovy.support/src/org/netbeans/modules/groovy/support/GroovyProjectModule.java --- a/groovy.support/src/org/netbeans/modules/groovy/support/GroovyProjectModule.java +++ b/groovy.support/src/org/netbeans/modules/groovy/support/GroovyProjectModule.java @@ -44,22 +44,31 @@ package org.netbeans.modules.groovy.support; import javax.swing.Action; +import static org.netbeans.modules.groovy.support.Bundle.LBL_RunFile_Action; import org.netbeans.spi.project.ActionProvider; import org.netbeans.spi.project.ui.support.FileSensitiveActions; -import org.openide.util.NbBundle; - +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionRegistration; +import org.openide.util.NbBundle.Messages; /** * Supplies project-specific file actions (e.g. compile/run) for *.groovy files. * * @author Petr Hejl */ + +// + public class GroovyProjectModule { - + @ActionID(id = "org.netbeans.modules.groovy.support.GroovyProjectModule", category = "Groovy") + @ActionRegistration(lazy = false, displayName = "#LBL_RunFile_Action") + @ActionReference(path = "Loaders/text/x-groovy/Actions", position = 550, separatorBefore = 530) + @Messages("LBL_RunFile_Action=Run File") public static Action run() { return FileSensitiveActions.fileCommandAction( ActionProvider.COMMAND_RUN_SINGLE, - NbBundle.getMessage(GroovyProjectModule.class, "LBL_RunFile_Action"), // NOI18N + LBL_RunFile_Action(), // NOI18N null); } diff --git a/groovy.support/src/org/netbeans/modules/groovy/support/resources/layer.xml b/groovy.support/src/org/netbeans/modules/groovy/support/resources/layer.xml --- a/groovy.support/src/org/netbeans/modules/groovy/support/resources/layer.xml +++ b/groovy.support/src/org/netbeans/modules/groovy/support/resources/layer.xml @@ -50,23 +50,5 @@ - - - - - - - - - - - - - - - - - - - +