01: /*
02: * The contents of this file are subject to the terms of the Common
03: * Development
04: The contents of this file are subject to the terms of either the GNU
05: General Public License Version 2 only ("GPL") or the Common
06: Development and Distribution License("CDDL") (collectively, the
07: "License"). You may not use this file except in compliance with the
08: License. You can obtain a copy of the License at
09: http://www.netbeans.org/cddl-gplv2.html
10: or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
11: specific language governing permissions and limitations under the
12: License. When distributing the software, include this License Header
13: Notice in each file and include the License file at
14: nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
15: particular file as subject to the "Classpath" exception as provided
16: by Sun in the GPL Version 2 section of the License file that
17: accompanied this code. If applicable, add the following below the
18: License Header, with the fields enclosed by brackets [] replaced by
19: your own identifying information:
20: "Portions Copyrighted [year] [name of copyright owner]"
21:
22: Contributor(s):
23: *
24: * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
25:
26: If you wish your version of this file to be governed by only the CDDL
27: or only the GPL Version 2, indicate your decision by adding
28: "[Contributor] elects to include this software in this distribution
29: under the [CDDL or GPL Version 2] license." If you do not indicate a
30: single choice of license, a recipient has the option to distribute
31: your version of this file under either the CDDL, the GPL Version 2 or
32: to extend the choice of license to its licensees as provided above.
33: However, if you add GPL Version 2 code and therefore, elected the GPL
34: Version 2 license, then the option applies only if the new code is
35: made subject to such option by the copyright holder.
36: *
37: */
38: package org.netbeans.modules.sql.framework.ui.graph.actions;
39:
40: import java.awt.event.ActionEvent;
41: import java.awt.event.InputEvent;
42: import java.net.URL;
43: import javax.swing.Action;
44: import javax.swing.ImageIcon;
45: import javax.swing.KeyStroke;
46: import net.java.hulp.i18n.Logger;
47: import org.netbeans.modules.etl.logger.Localizer;
48: import org.netbeans.modules.etl.logger.LogUtil;
49: import org.netbeans.modules.etl.ui.DataObjectProvider;
50: import org.netbeans.modules.etl.ui.view.ETLCollaborationTopPanel;
51:
52: /**
53: *
54: * @author karthikeyan s
55: */
56: public class ZoomOutAction extends GraphAction {
57:
58: private static final URL zoomOutImgUrl = ZoomOutAction.class
59: .getResource("/org/netbeans/modules/sql/framework/ui/resources/images/zoom_out_edm.png");
60: private static transient final Logger mLogger = LogUtil
61: .getLogger(ZoomOutAction.class.getName());
62: private static transient final Localizer mLoc = Localizer.get();
63:
64: public ZoomOutAction() {
65: //action name
66: String nbBundle = mLoc.t("PRSR001: Zoom Out...");
67: this .putValue(Action.NAME, Localizer.parse(nbBundle));
68:
69: //action icon
70: this .putValue(Action.SMALL_ICON, new ImageIcon(zoomOutImgUrl));
71:
72: //action tooltip
73: String nbBundle1 = mLoc.t("PRSR001: Zoom Out (Cntl-Z)");
74: this .putValue(Action.SHORT_DESCRIPTION, Localizer
75: .parse(nbBundle1));
76: // Acceleratot Cntl-Z
77: this .putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(
78: 'Z', InputEvent.CTRL_MASK));
79: }
80:
81: public void actionPerformed(ActionEvent e) {
82: ETLCollaborationTopPanel etlEditor = null;
83: try {
84: etlEditor = DataObjectProvider.getProvider()
85: .getActiveDataObject().getETLEditorTopPanel();
86: } catch (Exception ex) {
87: // ignore
88: }
89: if (etlEditor != null) {
90: etlEditor.setZoomFactor(etlEditor.getZoomFactor() * 0.9);
91: }
92: }
93: }
|