Lines 38-44
Link Here
|
38 |
package org.netbeans.modules.editor.actions; |
38 |
package org.netbeans.modules.editor.actions; |
39 |
|
39 |
|
40 |
import java.awt.event.ActionEvent; |
40 |
import java.awt.event.ActionEvent; |
41 |
import java.util.Map; |
41 |
import java.util.Arrays; |
42 |
import javax.swing.text.JTextComponent; |
42 |
import javax.swing.text.JTextComponent; |
43 |
import org.netbeans.api.editor.EditorActionNames; |
43 |
import org.netbeans.api.editor.EditorActionNames; |
44 |
import org.netbeans.api.editor.EditorActionRegistration; |
44 |
import org.netbeans.api.editor.EditorActionRegistration; |
Lines 57-62
Link Here
|
57 |
), |
57 |
), |
58 |
@EditorActionRegistration( |
58 |
@EditorActionRegistration( |
59 |
name = EditorActionNames.zoomTextOut |
59 |
name = EditorActionNames.zoomTextOut |
|
|
60 |
), |
61 |
@EditorActionRegistration( |
62 |
name = EditorActionNames.zoomTextReset |
60 |
) |
63 |
) |
61 |
}) |
64 |
}) |
62 |
public class ZoomTextAction extends AbstractEditorAction { |
65 |
public class ZoomTextAction extends AbstractEditorAction { |
Lines 67-81
Link Here
|
67 |
@Override |
70 |
@Override |
68 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
71 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
69 |
String actionName = actionName(); |
72 |
String actionName = actionName(); |
70 |
int delta = (EditorActionNames.zoomTextIn.equals(actionName)) ? +1 : -1; |
73 |
|
71 |
if (target != null) { |
74 |
if (target != null) { |
72 |
int newZoom = 0; |
75 |
int newZoom = 0; |
73 |
Integer currentZoom = (Integer) target.getClientProperty(TEXT_ZOOM_PROPERTY); |
76 |
//zoom in/out |
74 |
if (currentZoom != null) { |
77 |
if (Arrays.asList(EditorActionNames.zoomTextIn, EditorActionNames.zoomTextOut).contains(actionName)) { |
75 |
newZoom += currentZoom; |
78 |
Integer currentZoom = (Integer) target.getClientProperty(TEXT_ZOOM_PROPERTY); |
76 |
} |
79 |
if (currentZoom != null) { |
77 |
newZoom += delta; |
80 |
newZoom += currentZoom; |
78 |
target.putClientProperty(TEXT_ZOOM_PROPERTY, newZoom); |
81 |
} |
|
|
82 |
int delta = (EditorActionNames.zoomTextIn.equals(actionName)) ? +1 : -1; |
83 |
newZoom += delta; |
84 |
target.putClientProperty(TEXT_ZOOM_PROPERTY, newZoom); |
85 |
} |
86 |
//zoom reset |
87 |
if (EditorActionNames.zoomTextReset.equals(actionName)){ |
88 |
target.putClientProperty(TEXT_ZOOM_PROPERTY, null); |
89 |
} |
79 |
} |
90 |
} |
80 |
} |
91 |
} |
81 |
|
92 |
|