diff --git a/editor.actions/src/org/netbeans/modules/editor/actions/Bundle.properties b/editor.actions/src/org/netbeans/modules/editor/actions/Bundle.properties --- a/editor.actions/src/org/netbeans/modules/editor/actions/Bundle.properties +++ b/editor.actions/src/org/netbeans/modules/editor/actions/Bundle.properties @@ -57,6 +57,7 @@ goto-declaration_menu_text=Go to &Declaration zoom-text-in=Zoom Text In zoom-text-out=Zoom Text Out +zoom-text-reset=Zoom Text Reset move-code-element-up=Move Code Element Up move-code-element-up_menu_text=Move Code Element &Up move-code-element-down=Move Code Element Down diff --git a/editor.actions/src/org/netbeans/modules/editor/actions/ZoomTextAction.java b/editor.actions/src/org/netbeans/modules/editor/actions/ZoomTextAction.java --- a/editor.actions/src/org/netbeans/modules/editor/actions/ZoomTextAction.java +++ b/editor.actions/src/org/netbeans/modules/editor/actions/ZoomTextAction.java @@ -38,7 +38,7 @@ package org.netbeans.modules.editor.actions; import java.awt.event.ActionEvent; -import java.util.Map; +import java.util.Arrays; import javax.swing.text.JTextComponent; import org.netbeans.api.editor.EditorActionNames; import org.netbeans.api.editor.EditorActionRegistration; @@ -57,6 +57,9 @@ ), @EditorActionRegistration( name = EditorActionNames.zoomTextOut + ), + @EditorActionRegistration( + name = EditorActionNames.zoomTextReset ) }) public class ZoomTextAction extends AbstractEditorAction { @@ -67,15 +70,23 @@ @Override public void actionPerformed(ActionEvent evt, JTextComponent target) { String actionName = actionName(); - int delta = (EditorActionNames.zoomTextIn.equals(actionName)) ? +1 : -1; + if (target != null) { int newZoom = 0; - Integer currentZoom = (Integer) target.getClientProperty(TEXT_ZOOM_PROPERTY); - if (currentZoom != null) { - newZoom += currentZoom; - } - newZoom += delta; - target.putClientProperty(TEXT_ZOOM_PROPERTY, newZoom); + //zoom in/out + if (Arrays.asList(EditorActionNames.zoomTextIn, EditorActionNames.zoomTextOut).contains(actionName)) { + Integer currentZoom = (Integer) target.getClientProperty(TEXT_ZOOM_PROPERTY); + if (currentZoom != null) { + newZoom += currentZoom; + } + int delta = (EditorActionNames.zoomTextIn.equals(actionName)) ? +1 : -1; + newZoom += delta; + target.putClientProperty(TEXT_ZOOM_PROPERTY, newZoom); + } + //zoom reset + if (EditorActionNames.zoomTextReset.equals(actionName)){ + target.putClientProperty(TEXT_ZOOM_PROPERTY, null); + } } } 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.75.0 +spec.version.base=1.76.0 javadoc.arch=${basedir}/arch.xml javadoc.apichanges=${basedir}/apichanges.xml diff --git a/editor.lib2/src/org/netbeans/api/editor/EditorActionNames.java b/editor.lib2/src/org/netbeans/api/editor/EditorActionNames.java --- a/editor.lib2/src/org/netbeans/api/editor/EditorActionNames.java +++ b/editor.lib2/src/org/netbeans/api/editor/EditorActionNames.java @@ -96,6 +96,13 @@ public static final String zoomTextOut = "zoom-text-out"; // NOI18N /** + * Zoom text reset to default font size. + * @see #zoomInTextAction + * @since 1.76 + */ + public static final String zoomTextReset = "zoom-text-reset"; // NOI18N + + /** * Toggle between regular text selection and rectangular block selection * when caret selects in a column mode. */