You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by me...@apache.org on 2001/01/08 20:43:47 UTC
cvs commit: jakarta-ant/src/antidote/org/apache/tools/ant/gui/modules TargetMonitor.java
metasim 01/01/08 11:43:47
Modified: src/antidote/org/apache/tools/ant/gui/modules
TargetMonitor.java
Log:
Added *internal* support multiple projects, and generalized the selection
state mechanism.
Revision Changes Path
1.3 +13 -11 jakarta-ant/src/antidote/org/apache/tools/ant/gui/modules/TargetMonitor.java
Index: TargetMonitor.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/modules/TargetMonitor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TargetMonitor.java 2001/01/03 14:18:24 1.2
+++ TargetMonitor.java 2001/01/08 19:43:46 1.3
@@ -54,6 +54,7 @@
package org.apache.tools.ant.gui.modules;
import org.apache.tools.ant.gui.core.*;
import org.apache.tools.ant.gui.event.*;
+import org.apache.tools.ant.gui.acs.ACSElement;
import org.apache.tools.ant.gui.acs.ACSTargetElement;
import org.apache.tools.ant.gui.acs.ElementTreeSelectionModel;
import javax.swing.*;
@@ -67,7 +68,7 @@
/**
* A widget for displaying the currently selected targets.
*
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
* @author Simeon Fitch
*/
public class TargetMonitor extends AntModule {
@@ -139,20 +140,21 @@
public boolean eventPosted(EventObject event) {
ElementSelectionEvent e = (ElementSelectionEvent) event;
String text = _defText;
+ ACSElement[] selected = e.getSelectedElements();
- ProjectProxy p = getContext().getProject();
- if(p != null) {
- ElementTreeSelectionModel selections =
- p.getTreeSelectionModel();
- ACSTargetElement[] targets = selections.getSelectedTargets();
- if(targets != null && targets.length > 0) {
- StringBuffer buf = new StringBuffer();
- for(int i = 0; i < targets.length; i++) {
- buf.append(targets[i].getName());
- if(i < targets.length - 1) {
+ if(selected != null && selected.length > 0) {
+ StringBuffer buf = new StringBuffer();
+
+ for(int i = 0; i < selected.length; i++) {
+ if(selected[i] instanceof ACSTargetElement) {
+ if(buf.length() > 0) {
buf.append(", ");
}
+ buf.append(((ACSTargetElement)selected[i]).getName());
}
+ }
+
+ if(buf.length() > 0) {
text = buf.toString();
}
}