|
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-2004 Sun * Microsystems, Inc. All Rights Reserved. */ package org.apache.tools.ant.module.wizards.shortcut; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import javax.swing.KeyStroke; import org.apache.tools.ant.module.AntModule; import org.apache.tools.ant.module.api.AntProjectCookie; import org.openide.DialogDisplayer; import org.openide.WizardDescriptor; import org.openide.filesystems.FileLock; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileSystem; import org.openide.filesystems.FileUtil; import org.openide.filesystems.Repository; import org.openide.loaders.DataFolder; import org.openide.util.NbBundle; import org.openide.util.Utilities; import org.openide.xml.XMLUtil; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * The shortcut wizard itself. * @author Jesse Glick */ public final class ShortcutWizard extends WizardDescriptor { /** * Show the shortcut wizard for a given Ant target. * @param project the Ant script to make a target to * @param target the particular target in it */ public static void show(AntProjectCookie project, Element target) { final ShortcutWizard wiz = new ShortcutWizard(project, target, new ShortcutIterator()); DialogDisplayer.getDefault().createDialog(wiz).setVisible(true); // #44351: have to wait for dialog to be closed. // Does *not* work to use a PropertyChangeListener on PROP_VALUE. if (wiz.getValue().equals(WizardDescriptor.FINISH_OPTION)) { try { wiz.finish(); } catch (IOException ioe) { AntModule.err.notify(ioe); } } } // Attributes stored on the template wizard: /** type String */ private static final String PROP_CONTENTS = "wizdata.contents"; // NOI18N /** type String */ static final String PROP_DISPLAY_NAME = "wizdata.displayName"; // NOI18N /** type Boolean */ static final String PROP_SHOW_CUST = "wizdata.show.cust"; // NOI18N /** type Boolean */ static final String PROP_SHOW_MENU = "wizdata.show.menu"; // NOI18N /** type Boolean */ static final String PROP_SHOW_TOOL = "wizdata.show.tool"; // NOI18N /** type Boolean */ static final String PROP_SHOW_KEYB = "wizdata.show.keyb"; // NOI18N /** type DataFolder */ static final String PROP_FOLDER_MENU = "wizdata.folder.menu"; // NOI18N /** type DataFolder */ static final String PROP_FOLDER_TOOL = "wizdata.folder.tool"; // NOI18N /** type KeyStroke */ static final String PROP_STROKE = "wizdata.stroke"; // NOI18N private final AntProjectCookie project; private final Element target; private final ShortcutIterator it; ShortcutWizard(AntProjectCookie project, Element target, ShortcutIterator it) { super(it); this.project = project; this.target = target; this.it = it; it.initialize(this); setTitle(NbBundle.getMessage(ShortcutWizard.class, "TITLE_wizard")); putProperty("WizardPanel_autoWizardStyle", Boolean.TRUE); // NOI18N putProperty("WizardPanel_contentDisplayed", Boolean.TRUE); // NOI18N putProperty("WizardPanel_contentNumbered", Boolean.TRUE); // NOI18N String desc = target.getAttribute("description"); // NOI18n putProperty(PROP_DISPLAY_NAME, desc); // XXX deal with toolbar short desc somehow: #39985 // Need to have another field in toolbar panel, and also patch AntActionInstance // to respond to Action.SHORT_DESCRIPTION, presumably as the |
... 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.