--- a/o.apache.tools.ant.module/nbproject/project.xml Thu Oct 16 13:02:21 2008 +0200
+++ a/o.apache.tools.ant.module/nbproject/project.xml Thu Oct 16 13:03:02 2008 +0200
@@ -97,6 +97,7 @@
1
+ 1.32
--- a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/resources/AntModuleLayer.xml Thu Oct 16 13:02:21 2008 +0200
+++ a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/resources/AntModuleLayer.xml Thu Oct 16 13:03:02 2008 +0200
@@ -43,24 +43,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--- a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/Bundle.properties Thu Oct 16 13:02:21 2008 +0200
+++ a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/Bundle.properties Thu Oct 16 13:03:02 2008 +0200
@@ -77,21 +77,6 @@
# {0} - display name of process, e.g. "myapp (jar)"
FMT_target_stopped_status=Build of {0} stopped.
-# StopBuildingAction
-LBL_stop_building=&Stop Build/Run
-# {0} - display name of previous build
-LBL_stop_building_one=&Stop Build/Run: {0}
-LBL_stop_building_many=&Stop Build/Run...
-# StopBuildingAlert
-LBL_SBA_intro=Multiple build/run processes are running simultaneously.
-LBL_SBA_select=&Select the processes to stop:
-TITLE_SBA=Stop Build/Run
-LBL_SBA_stop=Stop
-# RunLastTargetAction
-LBL_RunLastTargetAction_general=Re&peat Build/Run
-# {0} - display name of previous build
-TIP_RunLastTargetAction_specific=Repeat Build/Run: {0}
-# {0} - display name of previous build
-LBL_RunLastTargetAction_specific=Re&peat Build/Run: {0}
+
--- a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/LastTargetExecuted.java Thu Oct 16 13:02:21 2008 +0200
+++ a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/LastTargetExecuted.java Thu Oct 16 13:03:02 2008 +0200
@@ -44,93 +44,109 @@
import java.io.File;
import java.io.IOException;
import java.util.Map;
-import javax.swing.event.ChangeListener;
+import org.apache.tools.ant.module.AntModule;
import org.apache.tools.ant.module.api.AntProjectCookie;
import org.apache.tools.ant.module.api.support.AntScriptUtils;
+import org.apache.tools.ant.module.bridge.AntBridge;
+import org.netbeans.spi.project.ui.support.BuildExecutionSupport;
import org.openide.execution.ExecutorTask;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.util.ChangeSupport;
+import org.openide.util.RequestProcessor;
/**
* Records the last Ant target(s) that was executed.
* @author Jesse Glick
*/
-public class LastTargetExecuted {
+public class LastTargetExecuted implements BuildExecutionSupport.Item {
private LastTargetExecuted() {}
- private static File buildScript;
+ private File buildScript;
//private static int verbosity;
- private static String[] targets;
- private static Map properties;
- private static String displayName;
+ private String[] targets;
+ private Map properties;
+ private String displayName;
+ private Thread thread;
/** Called from {@link TargetExecutor}. */
- static void record(File buildScript, String[] targets, Map properties, String displayName) {
- LastTargetExecuted.buildScript = buildScript;
+ static LastTargetExecuted record(File buildScript, String[] targets, Map properties, String displayName, Thread thread) {
+ LastTargetExecuted rec = new LastTargetExecuted();
+ rec.buildScript = buildScript;
//LastTargetExecuted.verbosity = verbosity;
- LastTargetExecuted.targets = targets;
- LastTargetExecuted.properties = properties;
- LastTargetExecuted.displayName = displayName;
- cs.fireChange();
+ rec.targets = targets;
+ rec.properties = properties;
+ rec.displayName = displayName;
+ rec.thread = thread;
+ BuildExecutionSupport.registerRunningItem(rec);
+ return rec;
+ }
+
+ static void finish(LastTargetExecuted exc) {
+ BuildExecutionSupport.registerFinishedItem(exc);
}
/**
* Get the last build script to be run.
* @return the last-run build script, or null if nothing has been run yet (or the build script disappeared etc.)
*/
- public static AntProjectCookie getLastBuildScript() {
- if (buildScript != null && buildScript.isFile()) {
- FileObject fo = FileUtil.toFileObject(buildScript);
+ public static AntProjectCookie getLastBuildScript(LastTargetExecuted ext) {
+ if (ext.buildScript != null && ext.buildScript.isFile()) {
+ FileObject fo = FileUtil.toFileObject(ext.buildScript);
assert fo != null;
return AntScriptUtils.antProjectCookieFor(fo);
}
return null;
}
- /**
- * Get the last target names to be run.
- * @return a list of one or more targets, or null for the default target
- */
- public static String[] getLastTargets() {
- return targets;
- }
-
- /**
- * Get a display name (as it would appear in the Output Window) for the last process.
- * @return a process display name, or null if nothing has been run yet
- */
- public static String getProcessDisplayName() {
- return displayName;
- }
-
+
/**
* Try to rerun the last task.
*/
- public static ExecutorTask rerun() throws IOException {
- AntProjectCookie apc = getLastBuildScript();
+ public static ExecutorTask rerun(LastTargetExecuted exec) throws IOException {
+ AntProjectCookie apc = getLastBuildScript(exec);
if (apc == null) {
// Can happen in case the build script was deleted (similar to #84874).
// Also make sure to disable RunLastTargetAction.
cs.fireChange();
return null;
}
- TargetExecutor t = new TargetExecutor(apc, targets);
+ TargetExecutor t = new TargetExecutor(apc, exec.targets);
//t.setVerbosity(verbosity);
- t.setProperties(properties);
- t.setDisplayName(displayName); // #140999: do not recalculate
+ t.setProperties(exec.properties);
+ t.setDisplayName(exec.displayName); // #140999: do not recalculate
return t.execute();
}
private static final ChangeSupport cs = new ChangeSupport(LastTargetExecuted.class);
- public static void addChangeListener(ChangeListener l) {
- cs.addChangeListener(l);
+
+
+ public String getDisplayName() {
+ return displayName;
}
-
- public static void removeChangeListener(ChangeListener l) {
- cs.removeChangeListener(l);
+
+ public void repeatExecution() {
+ RequestProcessor.getDefault().post(new Runnable() {
+ public void run() {
+ try {
+ rerun(LastTargetExecuted.this);
+ } catch (IOException ioe) {
+ AntModule.err.notify(ioe);
+ }
+ }
+ });
+ }
+
+ public boolean isRunning() {
+ return thread != null ? thread.isAlive() : false;
+ }
+
+ public void stopRunning() {
+ if (thread != null) {
+ AntBridge.getInterface().stop(thread);
+ }
}
}
--- a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/RunLastTargetAction.java Thu Oct 16 13:02:21 2008 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common
- * Development and Distribution License("CDDL") (collectively, the
- * "License"). You may not use this file except in compliance with the
- * License. You can obtain a copy of the License at
- * http://www.netbeans.org/cddl-gplv2.html
- * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
- * specific language governing permissions and limitations under the
- * License. When distributing the software, include this License Header
- * Notice in each file and include the License file at
- * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the GPL Version 2 section of the License file that
- * accompanied this code. If applicable, add the following below the
- * License Header, with the fields enclosed by brackets [] replaced by
- * your own identifying information:
- * "Portions Copyrighted [year] [name of copyright owner]"
- *
- * Contributor(s):
- *
- * The Original Software is NetBeans. The Initial Developer of the Original
- * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
- * Microsystems, Inc. All Rights Reserved.
- *
- * If you wish your version of this file to be governed by only the CDDL
- * or only the GPL Version 2, indicate your decision by adding
- * "[Contributor] elects to include this software in this distribution
- * under the [CDDL or GPL Version 2] license." If you do not indicate a
- * single choice of license, a recipient has the option to distribute
- * your version of this file under either the CDDL, the GPL Version 2 or
- * to extend the choice of license to its licensees as provided above.
- * However, if you add GPL Version 2 code and therefore, elected the GPL
- * Version 2 license, then the option applies only if the new code is
- * made subject to such option by the copyright holder.
- */
-
-package org.apache.tools.ant.module.run;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.io.IOException;
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JMenuItem;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import org.apache.tools.ant.module.AntModule;
-import org.openide.awt.Actions;
-import org.openide.awt.DynamicMenuContent;
-import org.openide.awt.Mnemonics;
-import org.openide.util.NbBundle;
-import org.openide.util.RequestProcessor;
-import org.openide.util.WeakListeners;
-import org.openide.util.actions.Presenter;
-
-/**
- * An action to run the last Ant build.
- * @see "#47925"
- */
-public final class RunLastTargetAction extends AbstractAction implements ChangeListener, Presenter.Menu, Presenter.Toolbar {
-
- public RunLastTargetAction() {
- super(NbBundle.getMessage(RunLastTargetAction.class, "LBL_RunLastTargetAction_general")/*,
- new ImageIcon(Utilities.loadImage("org/apache/tools/ant/module/resources/AntIcon.gif", true))*/);
- LastTargetExecuted.addChangeListener(WeakListeners.change(this, LastTargetExecuted.class));
- }
-
- @Override
- public boolean isEnabled() {
- return LastTargetExecuted.getLastBuildScript() != null;
- }
-
- @Override
- public Object getValue(String key) {
- if (key.equals(Action.SHORT_DESCRIPTION)) {
- String display = LastTargetExecuted.getProcessDisplayName();
- if (display != null) {
- return NbBundle.getMessage(RunLastTargetAction.class, "TIP_RunLastTargetAction_specific", display);
- } else {
- return null;
- }
- } else {
- return super.getValue(key);
- }
- }
-
- public void actionPerformed(ActionEvent e) {
- RequestProcessor.getDefault().post(new Runnable() {
- public void run() {
- try {
- LastTargetExecuted.rerun();
- } catch (IOException ioe) {
- AntModule.err.notify(ioe);
- }
- }
- });
- }
-
- public void stateChanged(ChangeEvent e) {
- firePropertyChange("enabled", null, Boolean.valueOf(isEnabled())); // NOI18N
- firePropertyChange(Action.SHORT_DESCRIPTION, null, null);
- }
-
- public JMenuItem getMenuPresenter() {
- class SpecialMenuItem extends JMenuItem implements DynamicMenuContent {
- public SpecialMenuItem() {
- super(RunLastTargetAction.this);
- }
- public JComponent[] getMenuPresenters() {
- String label;
- String display = LastTargetExecuted.getProcessDisplayName();
- if (display != null) {
- label = NbBundle.getMessage(RunLastTargetAction.class, "LBL_RunLastTargetAction_specific", display);
- } else {
- label = (String) getValue(Action.NAME);
- }
- Mnemonics.setLocalizedText(this, label);
- return new JComponent[] {this};
- }
- public JComponent[] synchMenuPresenters(JComponent[] items) {
- return getMenuPresenters();
- }
- }
- return new SpecialMenuItem();
- }
-
- public Component getToolbarPresenter() {
- JButton button = new JButton();
- Actions.connect(button, this);
- return button;
- }
-
-}
--- a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/StopBuildingAction.java Thu Oct 16 13:02:21 2008 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common
- * Development and Distribution License("CDDL") (collectively, the
- * "License"). You may not use this file except in compliance with the
- * License. You can obtain a copy of the License at
- * http://www.netbeans.org/cddl-gplv2.html
- * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
- * specific language governing permissions and limitations under the
- * License. When distributing the software, include this License Header
- * Notice in each file and include the License file at
- * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the GPL Version 2 section of the License file that
- * accompanied this code. If applicable, add the following below the
- * License Header, with the fields enclosed by brackets [] replaced by
- * your own identifying information:
- * "Portions Copyrighted [year] [name of copyright owner]"
- *
- * Contributor(s):
- *
- * The Original Software is NetBeans. The Initial Developer of the Original
- * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
- * Microsystems, Inc. All Rights Reserved.
- *
- * If you wish your version of this file to be governed by only the CDDL
- * or only the GPL Version 2, indicate your decision by adding
- * "[Contributor] elects to include this software in this distribution
- * under the [CDDL or GPL Version 2] license." If you do not indicate a
- * single choice of license, a recipient has the option to distribute
- * your version of this file under either the CDDL, the GPL Version 2 or
- * to extend the choice of license to its licensees as provided above.
- * However, if you add GPL Version 2 code and therefore, elected the GPL
- * Version 2 license, then the option applies only if the new code is
- * made subject to such option by the copyright holder.
- */
-
-package org.apache.tools.ant.module.run;
-
-import java.awt.EventQueue;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.WeakHashMap;
-import javax.swing.JComponent;
-import javax.swing.JMenuItem;
-import org.openide.awt.DynamicMenuContent;
-import org.openide.awt.Mnemonics;
-import org.openide.util.HelpCtx;
-import org.openide.util.NbBundle;
-import org.openide.util.actions.CallableSystemAction;
-import org.openide.util.actions.SystemAction;
-
-/**
- * Action which stops the currently running Ant process.
- * If there is more than one, a dialog appears asking you to select one.
- * @author Jesse Glick
- * @see "issue #43143"
- */
-public final class StopBuildingAction extends CallableSystemAction {
-
- /**
- * Map from active processing threads to their process display names.
- */
- private static final Map activeProcesses = new WeakHashMap();
-
- static void registerProcess(Thread t, String displayName) {
- synchronized (activeProcesses) {
- assert !activeProcesses.containsKey(t);
- activeProcesses.put(t, displayName);
- }
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- SystemAction.get(StopBuildingAction.class).setEnabled(true);
- }
- });
- }
-
- static void unregisterProcess(Thread t) {
- final boolean enable;
- synchronized (activeProcesses) {
- assert activeProcesses.containsKey(t);
- activeProcesses.remove(t);
- enable = !activeProcesses.isEmpty();
- }
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- SystemAction.get(StopBuildingAction.class).setEnabled(enable);
- }
- });
- }
-
- @Override
- public void performAction() {
- Thread[] toStop = null;
- synchronized (activeProcesses) {
- assert !activeProcesses.isEmpty();
- if (activeProcesses.size() == 1) {
- toStop = activeProcesses.keySet().toArray(new Thread[1]);
- }
- }
- if (toStop == null) {
- // More than one, need to select one.
- Map activeProcessesClone;
- synchronized (activeProcesses) {
- activeProcessesClone = new HashMap(activeProcesses);
- }
- toStop = StopBuildingAlert.selectProcessToKill(activeProcessesClone);
- synchronized (activeProcesses) {
- for (int i = 0; i < toStop.length; i++) {
- if (!activeProcesses.containsKey(toStop[i])) {
- // Oops, process ended while it was being selected... just ignore.
- toStop[i] = null;
- }
- }
- }
- }
- for (Thread t : toStop) {
- if (t != null) {
- TargetExecutor.stopProcess(t);
- }
- }
- }
-
- @Override
- public String getName() {
- return NbBundle.getMessage(StopBuildingAction.class, "LBL_stop_building");
- }
-
- @Override
- public HelpCtx getHelpCtx() {
- return null;
- }
-
- @Override
- protected void initialize() {
- super.initialize();
- setEnabled(false); // no processes initially
- }
-
- @Override
- protected boolean asynchronous() {
- return false;
- }
-
- @Override
- public JMenuItem getMenuPresenter() {
- class SpecialMenuItem extends JMenuItem implements DynamicMenuContent {
- public SpecialMenuItem() {
- super(StopBuildingAction.this);
- }
- public JComponent[] getMenuPresenters() {
- String label;
- synchronized (activeProcesses) {
- switch (activeProcesses.size()) {
- case 0:
- label = NbBundle.getMessage(StopBuildingAction.class, "LBL_stop_building");
- break;
- case 1:
- label = NbBundle.getMessage(StopBuildingAction.class, "LBL_stop_building_one",
- activeProcesses.values().iterator().next());
- break;
- default:
- label = NbBundle.getMessage(StopBuildingAction.class, "LBL_stop_building_many");
- }
- }
- Mnemonics.setLocalizedText(this, label);
- return new JComponent[] {this};
- }
- public JComponent[] synchMenuPresenters(JComponent[] items) {
- return getMenuPresenters();
- }
- }
- return new SpecialMenuItem();
- }
-
-}
--- a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/StopBuildingAlert.form Thu Oct 16 13:02:21 2008 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-
-
-
--- a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/StopBuildingAlert.java Thu Oct 16 13:02:21 2008 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common
- * Development and Distribution License("CDDL") (collectively, the
- * "License"). You may not use this file except in compliance with the
- * License. You can obtain a copy of the License at
- * http://www.netbeans.org/cddl-gplv2.html
- * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
- * specific language governing permissions and limitations under the
- * License. When distributing the software, include this License Header
- * Notice in each file and include the License file at
- * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the GPL Version 2 section of the License file that
- * accompanied this code. If applicable, add the following below the
- * License Header, with the fields enclosed by brackets [] replaced by
- * your own identifying information:
- * "Portions Copyrighted [year] [name of copyright owner]"
- *
- * Contributor(s):
- *
- * The Original Software is NetBeans. The Initial Developer of the Original
- * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
- * Microsystems, Inc. All Rights Reserved.
- *
- * If you wish your version of this file to be governed by only the CDDL
- * or only the GPL Version 2, indicate your decision by adding
- * "[Contributor] elects to include this software in this distribution
- * under the [CDDL or GPL Version 2] license." If you do not indicate a
- * single choice of license, a recipient has the option to distribute
- * your version of this file under either the CDDL, the GPL Version 2 or
- * to extend the choice of license to its licensees as provided above.
- * However, if you add GPL Version 2 code and therefore, elected the GPL
- * Version 2 license, then the option applies only if the new code is
- * made subject to such option by the copyright holder.
- */
-
-package org.apache.tools.ant.module.run;
-
-import java.awt.Component;
-import java.text.Collator;
-import java.util.Comparator;
-import java.util.Map;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.DefaultListModel;
-import javax.swing.JButton;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import org.openide.DialogDescriptor;
-import org.openide.DialogDisplayer;
-import org.openide.NotifyDescriptor;
-import org.openide.util.NbBundle;
-
-/**
- * Displays an alert asking user to pick a running build to stop.
- * @author Jesse Glick
- */
-final class StopBuildingAlert extends JPanel {
-
- /**
- * Select one or more processes to kill among several choices.
- * @param processesWithDisplayNames a list of possible threads to kill, mapped to display names
- * @return the selection(s) (or empty if cancelled)
- */
- public static Thread[] selectProcessToKill(final Map processesWithDisplayNames) {
- StopBuildingAlert alert = new StopBuildingAlert(processesWithDisplayNames);
- final JList list = alert.buildsList;
- // Add all threads, sorted by display name.
- DefaultListModel model = new DefaultListModel();
- Comparator comp = new Comparator() {
- private final Collator coll = Collator.getInstance();
- public int compare(Thread t1, Thread t2) {
- String n1 = processesWithDisplayNames.get(t1);
- String n2 = processesWithDisplayNames.get(t2);
- int r = coll.compare(n1, n2);
- if (r != 0) {
- return r;
- } else {
- // Arbitrary. XXX Note that there is no way to predict which is
- // which if you have more than one build running. Ideally it
- // would be subsorted by creation time, probably.
- return System.identityHashCode(t1) - System.identityHashCode(t2);
- }
- }
- };
- SortedSet threads = new TreeSet(comp);
- threads.addAll(processesWithDisplayNames.keySet());
- for (Thread t : threads) {
- model.addElement(t);
- }
- list.setModel(model);
- list.setSelectedIndex(0);
- // Make a dialog with buttons "Stop Building" and "Cancel".
- DialogDescriptor dd = new DialogDescriptor(alert, NbBundle.getMessage(StopBuildingAlert.class, "TITLE_SBA"));
- dd.setMessageType(NotifyDescriptor.PLAIN_MESSAGE);
- final JButton stopButton = new JButton(NbBundle.getMessage(StopBuildingAlert.class, "LBL_SBA_stop"));
- list.addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- stopButton.setEnabled(list.getSelectedValue() != null);
- }
- });
- dd.setOptions(new Object[] {stopButton, DialogDescriptor.CANCEL_OPTION});
- DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
- if (dd.getValue() == stopButton) {
- Object[] _selectedThreads = list.getSelectedValues();
- Thread[] selectedThreads = new Thread[_selectedThreads.length];
- for (int i = 0; i < _selectedThreads.length; i++) {
- selectedThreads[i] = (Thread) _selectedThreads[i];
- }
- return selectedThreads;
- } else {
- return new Thread[0];
- }
- }
-
- private final Map processesWithDisplayNames;
-
- private StopBuildingAlert(Map processesWithDisplayNames) {
- this.processesWithDisplayNames = processesWithDisplayNames;
- initComponents();
- buildsList.setCellRenderer(new ProcessCellRenderer());
- }
-
- // //GEN-BEGIN:initComponents
- private void initComponents() {
- java.awt.GridBagConstraints gridBagConstraints;
-
- introLabel = new javax.swing.JLabel();
- buildsLabel = new javax.swing.JLabel();
- buildsScrollPane = new javax.swing.JScrollPane();
- buildsList = new javax.swing.JList();
-
- org.openide.awt.Mnemonics.setLocalizedText(introLabel, org.openide.util.NbBundle.getMessage(StopBuildingAlert.class, "LBL_SBA_intro"));
-
- buildsLabel.setLabelFor(buildsList);
- org.openide.awt.Mnemonics.setLocalizedText(buildsLabel, org.openide.util.NbBundle.getMessage(StopBuildingAlert.class, "LBL_SBA_select"));
-
- buildsScrollPane.setViewportView(buildsList);
-
- org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
- this.setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
- .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
- .addContainerGap()
- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
- .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
- .add(buildsScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
- .addContainerGap())
- .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
- .add(buildsLabel)
- .add(introLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .add(28, 28, 28))))
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
- .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
- .addContainerGap()
- .add(introLabel)
- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
- .add(buildsLabel)
- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
- .add(buildsScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 234, Short.MAX_VALUE)
- .addContainerGap())
- );
- }
- // //GEN-END:initComponents
-
-
- // Variables declaration - do not modify//GEN-BEGIN:variables
- public javax.swing.JLabel buildsLabel;
- public javax.swing.JList buildsList;
- public javax.swing.JScrollPane buildsScrollPane;
- public javax.swing.JLabel introLabel;
- // End of variables declaration//GEN-END:variables
-
- private final class ProcessCellRenderer extends DefaultListCellRenderer/**/ {
-
- public ProcessCellRenderer() {}
-
- @Override
- public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
- Thread t = (Thread) value;
- String displayName = processesWithDisplayNames.get(t);
- return super.getListCellRendererComponent(list, displayName, index, isSelected, cellHasFocus);
- }
-
- }
-
-}
--- a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/TargetExecutor.java Thu Oct 16 13:02:21 2008 +0200
+++ a/o.apache.tools.ant.module/src/org/apache/tools/ant/module/run/TargetExecutor.java Thu Oct 16 13:03:02 2008 +0200
@@ -175,7 +175,7 @@
private static final class StopAction extends AbstractAction {
- public Thread t;
+ public LastTargetExecuted t;
public StopAction() {
setEnabledEQ(this, false); // initially, until ready
@@ -195,7 +195,7 @@
public void actionPerformed(ActionEvent e) {
setEnabled(false); // discourage repeated clicking
if (t != null) { // #84688
- stopProcess(t);
+ t.stopRunning();
}
}
@@ -394,7 +394,7 @@
/** Call execute(), not this method directly!
*/
synchronized public void run () {
- final Thread[] thisProcess = new Thread[1];
+ final LastTargetExecuted[] thisExec = new LastTargetExecuted[1];
final StopAction sa = stopActions.get(io);
assert sa != null;
RerunAction ra = rerunActions.get(io);
@@ -429,10 +429,11 @@
}
// #139185: do not record verbosity level; always pick it up from Ant Settings.
- LastTargetExecuted.record(buildFile, /*verbosity,*/
+ thisExec[0] = LastTargetExecuted.record(buildFile, /*verbosity,*/
targetNames != null ? targetNames.toArray(new String[targetNames.size()]) : null,
properties,
- suggestedDisplayName != null ? suggestedDisplayName : getProcessDisplayName(pcookie, targetNames));
+ suggestedDisplayName != null ? suggestedDisplayName : getProcessDisplayName(pcookie, targetNames), Thread.currentThread());
+ sa.t = thisExec[0];
// Don't hog the CPU, the build might take a while:
Thread.currentThread().setPriority((Thread.MIN_PRIORITY + Thread.NORM_PRIORITY) / 2);
@@ -478,9 +479,6 @@
}
}
- thisProcess[0] = Thread.currentThread();
- StopBuildingAction.registerProcess(thisProcess[0], displayName);
- sa.t = thisProcess[0];
// #58513, #87801: register a progress handle for the task too.
ProgressHandle handle = ProgressHandleFactory.createHandle(displayName, new Cancellable() {
public boolean cancel() {
@@ -504,8 +502,8 @@
freeTabs.put(io, displayName);
}
}
- if (thisProcess[0] != null) {
- StopBuildingAction.unregisterProcess(thisProcess[0]);
+ if (thisExec[0] != null) {
+ LastTargetExecuted.finish(thisExec[0]);
}
sa.t = null;
setEnabledEQ(sa, false);