|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.debugger.ui.actions; import java.awt.Dialog; import java.util.ResourceBundle; import javax.swing.*; import org.netbeans.api.debugger.DebuggerManager; import org.netbeans.modules.debugger.ui.WatchPanel; import org.openide.DialogDisplayer; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.util.actions.CallableSystemAction; /** * DebuggerManager Window action. * * @author Jan Jancura */ public class AddWatchAction extends CallableSystemAction { private static String watchHistory = ""; // NOI18N // public AddWatchAction () { // putValue ( // Action.NAME, // NbBundle.getMessage ( // AddWatchAction.class, // "CTL_New_Watch" // ) // ); // putValue ( // Action.SMALL_ICON, // Utils.getIcon ( // "org/netbeans/modules/debugger/resources/actions/NewWatch" // NOI18N // ) // ); // } protected boolean asynchronous () { return false; } public String getName () { return NbBundle.getMessage ( AddWatchAction.class, "CTL_New_Watch" ); } public HelpCtx getHelpCtx () { return new HelpCtx (AddWatchAction.class); } /** The action's icon location. * @return the action's icon location */ protected String iconResource () { return "org/netbeans/modules/debugger/resources/actions/NewWatch.gif"; // NOI18N } public void performAction () { ResourceBundle bundle = NbBundle.getBundle (AddWatchAction.class); WatchPanel wp = new WatchPanel (watchHistory); JComponent panel = wp.getPanel (); org.openide.DialogDescriptor dd = new org.openide.DialogDescriptor ( panel, bundle.getString ("CTL_WatchDialog_Title") // NOI18N ); Dialog dialog = DialogDisplayer.getDefault ().createDialog (dd); dialog.setVisible (true); dialog.dispose (); if (dd.getValue() != org.openide.DialogDescriptor.OK_OPTION) return; String watch = wp.getExpression (); if ( (watch == null) || (watch.trim ().length () == 0) ) return; String s = watch; int i = s.indexOf (';'); while (i > 0) { String ss = s.substring (0, i).trim (); if (ss.length () > 0) DebuggerManager.getDebuggerManager ().createWatch (ss); s = s.substring (i + 1); i = s.indexOf (';'); } s = s.trim (); if (s.length () > 0) DebuggerManager.getDebuggerManager ().createWatch (s); watchHistory = watch; // open watches view new WatchesViewAction ().actionPerformed (null); } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.