diff --git a/editor.lib/src/org/netbeans/editor/ext/ExtKit.java b/editor.lib/src/org/netbeans/editor/ext/ExtKit.java --- a/editor.lib/src/org/netbeans/editor/ext/ExtKit.java +++ b/editor.lib/src/org/netbeans/editor/ext/ExtKit.java @@ -443,10 +443,10 @@ } -// @EditorActionRegistration( -// name = buildToolTipAction, -// shortDescription = editorBundleHash + buildToolTipAction -// ) + @EditorActionRegistration( + name = buildToolTipAction, + shortDescription = editorBundleHash + buildToolTipAction + ) public static class BuildToolTipAction extends BaseAction { static final long serialVersionUID =-2701131863705941250L; diff --git a/editor.lib2/apichanges.xml b/editor.lib2/apichanges.xml --- a/editor.lib2/apichanges.xml +++ b/editor.lib2/apichanges.xml @@ -107,6 +107,21 @@ + + Add "weight" attribute to EditorActionRegistration. + + + + + +

+ Add "weight" attribute to EditorActionRegistration annotation + to allow for a clean actions overriding. +

+
+ +
+ Zoom text actions added diff --git a/editor.lib2/manifest.mf b/editor.lib2/manifest.mf --- a/editor.lib2/manifest.mf +++ b/editor.lib2/manifest.mf @@ -1,6 +1,6 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.editor.lib2/1 -OpenIDE-Module-Implementation-Version: 24 +OpenIDE-Module-Implementation-Version: 25 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/editor/lib2/Bundle.properties OpenIDE-Module-Layer: org/netbeans/modules/editor/lib2/resources/layer.xml OpenIDE-Module-Needs: org.netbeans.modules.editor.actions diff --git a/editor.lib2/nbproject/project.properties b/editor.lib2/nbproject/project.properties --- a/editor.lib2/nbproject/project.properties +++ b/editor.lib2/nbproject/project.properties @@ -43,7 +43,7 @@ is.autoload=true javac.source=1.6 javac.compilerargs=-Xlint:unchecked -spec.version.base=1.52.0 +spec.version.base=1.53.0 javadoc.arch=${basedir}/arch.xml javadoc.apichanges=${basedir}/apichanges.xml diff --git a/editor.lib2/src/org/netbeans/api/editor/EditorActionRegistration.java b/editor.lib2/src/org/netbeans/api/editor/EditorActionRegistration.java --- a/editor.lib2/src/org/netbeans/api/editor/EditorActionRegistration.java +++ b/editor.lib2/src/org/netbeans/api/editor/EditorActionRegistration.java @@ -177,5 +177,16 @@ * global mime-lookup MimeLookup.getLookup(MimePath.EMPTY). */ String preferencesKey() default ""; + + /** + * Allows to make an override of an action by adding a "weight" attribute + * into a generated file object (in the system filesystem). + * + * More about weight attribute. + * + * @return value of the weight attribute. When ommited (default value is used) + * then no weight attribute gets generated. + */ + int weight() default Integer.MIN_VALUE; } diff --git a/editor.lib2/src/org/netbeans/modules/editor/lib2/EditorActionRegistrationProcessor.java b/editor.lib2/src/org/netbeans/modules/editor/lib2/EditorActionRegistrationProcessor.java --- a/editor.lib2/src/org/netbeans/modules/editor/lib2/EditorActionRegistrationProcessor.java +++ b/editor.lib2/src/org/netbeans/modules/editor/lib2/EditorActionRegistrationProcessor.java @@ -314,6 +314,12 @@ // some tools may query FO's properties and expect it there. file.stringvalue(Action.NAME, actionName); + // Resolve weight attribute that allows to override existing action + int weight = annotation.weight(); + if (weight != Integer.MIN_VALUE) { + file.intvalue("weight", weight); + } + if (directActionCreation) { if (methodName != null) { file.methodvalue("instanceCreate", className, methodName); diff --git a/editor/src/org/netbeans/modules/editor/NbEditorKit.java b/editor/src/org/netbeans/modules/editor/NbEditorKit.java --- a/editor/src/org/netbeans/modules/editor/NbEditorKit.java +++ b/editor/src/org/netbeans/modules/editor/NbEditorKit.java @@ -631,7 +631,7 @@ } - @EditorActionRegistration(name = buildToolTipAction) + @EditorActionRegistration(name = buildToolTipAction, weight = 100) public static class NbBuildToolTipAction extends BuildToolTipAction { public @Override void actionPerformed(ActionEvent evt, JTextComponent target) { diff --git a/o.n.core/test/qa-functional/src/org/netbeans/core/validation/ValidateLayerConsistencyTest.java b/o.n.core/test/qa-functional/src/org/netbeans/core/validation/ValidateLayerConsistencyTest.java --- a/o.n.core/test/qa-functional/src/org/netbeans/core/validation/ValidateLayerConsistencyTest.java +++ b/o.n.core/test/qa-functional/src/org/netbeans/core/validation/ValidateLayerConsistencyTest.java @@ -623,14 +623,6 @@ Set overriders = overrides.keySet(); String file = e.getKey(); - if (file.matches("Editors/Actions/build-(popup-menu|tool-tip)[.]instance")) { - // Provided by editor.lib but overridden (direct dep) by editor. - // Seems like the editor.lib definition might be needed if editor is missing. - // @EditorActionRegistration does not supply a way to define a weight. - // So for now, just permit this special case. - continue; - } - if (new HashSet(overrides.values()).size() == 1) { // All the same. Check whether these are parallel declarations (e.g. CND debugger vs. Java debugger), or vertical. for (String overrider : overriders) {