langtools/make/tools/anttasks/SelectToolTask.java
author ihse
Thu, 13 Feb 2014 23:30:08 +0100
changeset 22716 cf32fe2eb254
parent 20266 d5e2fc28504e
child 26268 620556167c08
permissions -rw-r--r--
8034199: Add 'reconfigure' target for re-creating a configuration Reviewed-by: erikj, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
     1
/*
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
     2
 * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
     4
 *
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    10
 *
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    15
 * accompanied this code).
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    16
 *
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
    23
 * questions.
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    24
 */
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    25
12085
ce2780cb121f 7150579: Moved ant code into a separate package, anttasks.
ohrstrom
parents: 5520
diff changeset
    26
package anttasks;
ce2780cb121f 7150579: Moved ant code into a separate package, anttasks.
ohrstrom
parents: 5520
diff changeset
    27
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    28
import java.awt.GridBagConstraints;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    29
import java.awt.GridBagLayout;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    30
import java.awt.event.ActionEvent;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    31
import java.awt.event.ActionListener;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    32
import java.awt.event.FocusEvent;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    33
import java.awt.event.FocusListener;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    34
import java.awt.event.ItemEvent;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    35
import java.awt.event.ItemListener;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    36
import java.io.BufferedReader;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    37
import java.io.BufferedWriter;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    38
import java.io.File;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    39
import java.io.FileReader;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    40
import java.io.FileWriter;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    41
import java.io.IOException;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    42
import java.io.Reader;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    43
import java.io.Writer;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    44
import java.util.ArrayList;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    45
import java.util.Arrays;
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    46
import java.util.EnumSet;
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    47
import java.util.List;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    48
import java.util.Properties;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    49
import javax.swing.JButton;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    50
import javax.swing.JCheckBox;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    51
import javax.swing.JComboBox;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    52
import javax.swing.JDialog;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    53
import javax.swing.JLabel;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    54
import javax.swing.JOptionPane;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    55
import javax.swing.JPanel;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    56
import javax.swing.JTextField;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    57
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    58
import javax.swing.SwingUtilities;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    59
import org.apache.tools.ant.BuildException;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    60
import org.apache.tools.ant.Project;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    61
import org.apache.tools.ant.Task;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    62
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    63
/**
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    64
 * Task to allow the user to control langtools tools built when using NetBeans.
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    65
 *
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    66
 * There are two primary modes.
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    67
 * 1) Property mode. In this mode, property names are provided to get values
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    68
 * that may be specified by the user, either directly in a GUI dialog, or
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    69
 * read from a properties file. If the GUI dialog is invoked, values may
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    70
 * optionally be set for future use.
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    71
 * 2) Setup mode. In this mode, no property names are provided, and the GUI
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    72
 * is invoked to allow the user to set or reset values for use in property mode.
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    73
 */
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
    74
public class SelectToolTask extends Task {
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    75
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    76
    enum ToolChoices {
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    77
        NONE(""),
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    78
        JAVAC("javac"),
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    79
        JAVADOC("javadoc"),
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    80
        JAVAH("javah"),
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    81
        JAVAP("javap");
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    82
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    83
        String toolName;
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    84
        boolean bootstrap;
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    85
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    86
        ToolChoices(String toolName) {
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    87
            this(toolName, false);
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    88
        }
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    89
20266
d5e2fc28504e 8025139: javac patch for using bootstrap compiler for debugging is not working properly
vromero
parents: 19935
diff changeset
    90
        ToolChoices(String toolName, boolean bootstrap) {
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    91
            this.toolName = toolName;
20266
d5e2fc28504e 8025139: javac patch for using bootstrap compiler for debugging is not working properly
vromero
parents: 19935
diff changeset
    92
            this.bootstrap = bootstrap;
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    93
        }
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    94
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    95
        @Override
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    96
        public String toString() {
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    97
            return toolName;
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    98
        }
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
    99
    }
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   100
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   101
    /**
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   102
     * Set the location of the private properties file used to keep the retain
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   103
     * user preferences for this repository.
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   104
     */
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   105
    public void setPropertyFile(File propertyFile) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   106
        this.propertyFile = propertyFile;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   107
    }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   108
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   109
    /**
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   110
     * Set the name of the property which will be set to the name of the
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   111
     * selected tool, if any. If no tool is selected, the property will
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   112
     * remain unset.
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   113
     */
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   114
    public void setToolProperty(String toolProperty) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   115
        this.toolProperty = toolProperty;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   116
    }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   117
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   118
    /**
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   119
     * Set the name of the property which will be set to the execution args of the
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   120
     * selected tool, if any. The args default to an empty string.
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   121
     */
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   122
    public void setArgsProperty(String argsProperty) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   123
        this.argsProperty = argsProperty;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   124
    }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   125
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   126
    /**
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   127
     * Set the name of the property which will be set to the execution args of the
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   128
     * selected tool, if any. The args default to an empty string.
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   129
     */
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   130
    public void setBootstrapProperty(String bootstrapProperty) {
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   131
        this.bootstrapProperty = bootstrapProperty;
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   132
    }
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   133
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   134
    /**
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   135
     * Specify whether or not to pop up a dialog if the user has not specified
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   136
     * a default value for a property.
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   137
     */
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   138
    public void setAskIfUnset(boolean askIfUnset) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   139
        this.askIfUnset = askIfUnset;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   140
    }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   141
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   142
    @Override
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   143
    public void execute() {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   144
        Project p = getProject();
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   145
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   146
        Properties props = readProperties(propertyFile);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   147
        toolName = props.getProperty("tool.name");
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   148
        toolBootstrap = props.getProperty("tool.bootstrap") != null;
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   149
        if (toolName != null) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   150
            toolArgs = props.getProperty(toolName + ".args", "");
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   151
        }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   152
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   153
        if (toolProperty == null ||
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   154
            askIfUnset && (toolName == null
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   155
                || (argsProperty != null && toolArgs == null))) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   156
            showGUI(props);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   157
        }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   158
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   159
        // finally, return required values, if any
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   160
        if (toolProperty != null && !(toolName == null || toolName.equals(""))) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   161
            p.setProperty(toolProperty, toolName);
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   162
            if (toolBootstrap)
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   163
                p.setProperty(bootstrapProperty, "true");
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   164
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   165
            if (argsProperty != null && toolArgs != null)
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   166
                p.setProperty(argsProperty, toolArgs);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   167
        }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   168
    }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   169
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   170
    void showGUI(Properties fileProps) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   171
        Properties guiProps = new Properties(fileProps);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   172
        JOptionPane p = createPane(guiProps);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   173
        p.createDialog("Select Tool").setVisible(true);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   174
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   175
        toolName = ((ToolChoices)toolChoice.getSelectedItem()).toolName;
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   176
        toolArgs = argsField.getText();
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   177
        toolBootstrap = bootstrapCheckbox.isSelected();
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   178
        if (defaultCheck.isSelected()) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   179
            if (toolName.equals("")) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   180
                fileProps.remove("tool.name");
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   181
                fileProps.remove("tool.bootstrap");
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   182
            } else {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   183
                fileProps.put("tool.name", toolName);
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   184
                if (toolBootstrap) {
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   185
                    fileProps.put("tool.bootstrap", "true");
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   186
                } else {
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   187
                    fileProps.remove("tool.bootstrap");
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   188
                }
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   189
                fileProps.put(toolName + ".args", toolArgs);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   190
            }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   191
            writeProperties(propertyFile, fileProps);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   192
        }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   193
    }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   194
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   195
    JOptionPane createPane(final Properties props) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   196
        JPanel body = new JPanel(new GridBagLayout());
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   197
        GridBagConstraints lc = new GridBagConstraints();
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   198
        lc.insets.right = 10;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   199
        lc.insets.bottom = 3;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   200
        GridBagConstraints fc = new GridBagConstraints();
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   201
        fc.gridx = 1;
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   202
        fc.gridwidth = GridBagConstraints.NONE;
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   203
        fc.insets.bottom = 3;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   204
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   205
        JPanel toolPane = new JPanel(new GridBagLayout());
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   206
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   207
        JLabel toolLabel = new JLabel("Tool:");
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   208
        body.add(toolLabel, lc);
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   209
        EnumSet<ToolChoices> toolChoices = toolProperty == null ?
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   210
                EnumSet.allOf(ToolChoices.class) : EnumSet.range(ToolChoices.JAVAC, ToolChoices.JAVAP);
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   211
        toolChoice = new JComboBox(toolChoices.toArray());
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   212
        if (toolName != null)
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   213
            toolChoice.setSelectedItem(ToolChoices.valueOf(toolName.toUpperCase()));
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   214
        toolChoice.addItemListener(new ItemListener() {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   215
            public void itemStateChanged(ItemEvent e) {
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   216
                String tn = ((ToolChoices)e.getItem()).toolName;
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   217
                argsField.setText(getDefaultArgsForTool(props, tn));
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   218
                if (toolProperty != null)
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   219
                    okButton.setEnabled(!tn.equals(""));
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   220
            }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   221
        });
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   222
        GridBagConstraints checkConstraint = new GridBagConstraints();
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   223
        fc.anchor = GridBagConstraints.EAST;
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   224
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   225
        GridBagConstraints toolConstraint = new GridBagConstraints();
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   226
        fc.anchor = GridBagConstraints.WEST;
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   227
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   228
        toolPane.add(toolChoice, toolConstraint);
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   229
        bootstrapCheckbox = new JCheckBox("bootstrap", toolBootstrap);
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   230
        toolPane.add(bootstrapCheckbox, checkConstraint);
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   231
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   232
        body.add(toolPane, fc);
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   233
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   234
        argsField = new JTextField(getDefaultArgsForTool(props, toolName), 40);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   235
        if (toolProperty == null || argsProperty != null) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   236
            JLabel argsLabel = new JLabel("Args:");
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   237
            body.add(argsLabel, lc);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   238
            body.add(argsField, fc);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   239
            argsField.addFocusListener(new FocusListener() {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   240
                public void focusGained(FocusEvent e) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   241
                }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   242
                public void focusLost(FocusEvent e) {
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   243
                    String toolName = ((ToolChoices)toolChoice.getSelectedItem()).toolName;
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   244
                    if (toolName.length() > 0)
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   245
                        props.put(toolName + ".args", argsField.getText());
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   246
                }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   247
            });
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   248
        }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   249
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   250
        defaultCheck = new JCheckBox("Set as default");
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   251
        if (toolProperty == null)
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   252
            defaultCheck.setSelected(true);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   253
        else
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   254
            body.add(defaultCheck, fc);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   255
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   256
        final JOptionPane p = new JOptionPane(body);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   257
        okButton = new JButton("OK");
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   258
        okButton.setEnabled(toolProperty == null || (toolName != null && !toolName.equals("")));
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   259
        okButton.addActionListener(new ActionListener() {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   260
            public void actionPerformed(ActionEvent e) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   261
                JDialog d = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, p);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   262
                d.setVisible(false);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   263
            }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   264
        });
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   265
        p.setOptions(new Object[] { okButton });
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   266
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   267
        return p;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   268
    }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   269
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   270
    Properties readProperties(File file) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   271
        Properties p = new Properties();
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   272
        if (file != null && file.exists()) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   273
            Reader in = null;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   274
            try {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   275
                in = new BufferedReader(new FileReader(file));
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   276
                p.load(in);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   277
                in.close();
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   278
            } catch (IOException e) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   279
                throw new BuildException("error reading property file", e);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   280
            } finally {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   281
                if (in != null) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   282
                    try {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   283
                        in.close();
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   284
                    } catch (IOException e) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   285
                        throw new BuildException("cannot close property file", e);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   286
                    }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   287
                }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   288
            }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   289
        }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   290
        return p;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   291
    }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   292
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   293
    void writeProperties(File file, Properties p) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   294
        if (file != null) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   295
            Writer out = null;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   296
            try {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   297
                File dir = file.getParentFile();
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   298
                if (dir != null && !dir.exists())
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   299
                    dir.mkdirs();
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   300
                out = new BufferedWriter(new FileWriter(file));
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   301
                p.store(out, "langtools properties");
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   302
                out.close();
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   303
            } catch (IOException e) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   304
                throw new BuildException("error writing property file", e);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   305
            } finally {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   306
                if (out != null) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   307
                    try {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   308
                        out.close();
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   309
                    } catch (IOException e) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   310
                        throw new BuildException("cannot close property file", e);
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   311
                    }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   312
                }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   313
            }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   314
        }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   315
    }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   316
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   317
    String getDefaultArgsForTool(Properties props, String tn) {
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   318
        return (tn == null || tn.equals("")) ? "" : props.getProperty(tn + ".args", "");
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   319
    }
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   320
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   321
    // Ant task parameters
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   322
    private boolean askIfUnset;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   323
    private String toolProperty;
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   324
    private String bootstrapProperty;
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   325
    private String argsProperty;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   326
    private File propertyFile;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   327
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   328
    // GUI components
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   329
    private JComboBox toolChoice;
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   330
    private JCheckBox bootstrapCheckbox;
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   331
    private JTextField argsField;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   332
    private JCheckBox defaultCheck;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   333
    private JButton okButton;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   334
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   335
    // Result values for the client
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   336
    private String toolName;
19935
8f2c828192c3 8024414: javac, should facilitate the use of the bootstrap compiler for debugging
mcimadamore
parents: 13631
diff changeset
   337
    private boolean toolBootstrap;
1873
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   338
    private String toolArgs;
658385834998 6795365: NetBeans projects in langtools repository are not NB6.5-friendly
jjg
parents:
diff changeset
   339
}