|
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-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.xml.tree.lib; import java.awt.Image; import javax.swing.SwingUtilities; import org.openide.util.Utilities; import org.openide.ErrorManager; import org.openide.NotifyDescriptor; import org.openide.DialogDisplayer; import org.openide.awt.StatusDisplayer; import org.netbeans.tax.TreeException; /** * * @author Libor Kramolis * @version 0.1 */ public final class GuiUtil { /** */ public static Image getCutBadgeIcon () { return Utilities.loadImage ("org/netbeans/modules/xml/tree/resources/cutbadge.gif"); // NOI18N } /** */ public static boolean confirmAction (String message) { NotifyDescriptor nd = new NotifyDescriptor.Confirmation (message, NotifyDescriptor.YES_NO_OPTION); Object option = DialogDisplayer.getDefault().notify (nd); return ( option == NotifyDescriptor.YES_OPTION ); } /** */ public static void setStatusText (String text) { StatusDisplayer.getDefault().setStatusText (text); } /** * Notify exception to user. Just shortcut to ErrorManager. */ public static void notifyException (Throwable exc) { notifyException (null, exc); } /** * Notify annotated exception to user. Just shortcut to ErrorManager. */ public static void notifyException (String desc, Throwable ex) { ErrorManager err = ErrorManager.getDefault(); if (desc != null) { err.annotate (ex, desc); } err.notify (err.EXCEPTION, ex); // show stack trace to user } /** */ public static void notifyTreeException (TreeException exc) { notifyWarning (exc.getMessage()); } /** */ public static void notifyWarning (final String message) { SwingUtilities.invokeLater (new Runnable () { public void run () { NotifyDescriptor nd = new NotifyDescriptor.Message (message, NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault ().notify (nd); } }); } } |
... 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.