Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /antelope/, /antelope/src/ise/antelope/app/, /antelope/src/ise/antelope/common/, /antelope/src/ise/antelope/common/dependency/

antelope
Discussion topic

If checked, the target buttons will be sorted alphabetically by target name." ); + cb1b.addActionListener( + new ActionListener() { + public void actionPerformed( ActionEvent ae ) { + JCheckBox cb = ( JCheckBox ) ae.getSource(); + settings.setSortTargets( cb.isSelected() ); + } + } + ); ++con.y; target_panel.add( label0, con ); @@ -305,7 +316,8 @@ target_panel.add( cb1, con ); ++con.y; target_panel.add( cb1a, con ); - + ++con.y; + target_panel.add( cb1b, con); // Message Level panel JPanel msg_panel = new JPanel(new KappaLayout()); @@ -509,7 +521,7 @@ /** * Description of the Class * - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ */ class LevelRadioButton extends JRadioButton { /** File [changed]: AntelopePanel.java Url: http://antelope.tigris.org/source/browse/antelope/src/ise/antelope/common/AntelopePanel.java?r1=1.13&r2=1.14 Delta lines: +66 -60 --------------------- --- AntelopePanel.java 8 May 2004 02:42:55 -0000 1.13 +++ AntelopePanel.java 19 May 2004 14:03:57 -0000 1.14 @@ -1,4 +1,4 @@ -// $Id: AntelopePanel.java,v 1.13 2004/05/08 02:42:55 danson Exp $ +// $Id: AntelopePanel.java,v 1.14 2004/05/19 14:03:57 danson Exp $ /* * Based on the Apache Software License, Version 1.1 * @@ -67,7 +67,7 @@ * progress. * * @author Dale Anson, danson@germane-software.com - * @version $Revision: 1.13 $ + * @version $Revision: 1.14 $ * @created July 23, 2002 */ public class AntelopePanel extends JPanel implements Constants { @@ -88,7 +88,7 @@ */ private Target _unnamed_target = null; - private TreeMap _targets = null; // key is a String, value is a Target + private Map _targets = null; // key is a String, value is a Target private ArrayList _buttons = null; private ArrayList _execute_targets = null; private DeckPanel _center_panel = null; @@ -366,7 +366,7 @@ } _multi.setToolTipText( "Execute multiple targets sequentially" ); - _multi.setSelected(_settings.getMultipleTargets()); + _multi.setSelected( _settings.getMultipleTargets() ); _multi.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent ae ) { @@ -474,11 +474,11 @@ } } Iterator itr = targets.iterator(); - while(itr.hasNext()) { - String target_name = (String)itr.next(); - for (i = 0; i < components.length; i++) { - AbstractButton btn = (AbstractButton)components[i]; - if ( target_name.equals( btn.getActionCommand())) { + while ( itr.hasNext() ) { + String target_name = ( String ) itr.next(); + for ( i = 0; i < components.length; i++ ) { + AbstractButton btn = ( AbstractButton ) components[ i ]; + if ( target_name.equals( btn.getActionCommand() ) ) { btn.doClick(); break; } @@ -929,7 +929,7 @@ public void openBuildFile( final File build_file ) { if ( build_file == null || !build_file.exists() ) return ; - boolean new_file = !build_file.equals(_build_file); + boolean new_file = !build_file.equals( _build_file ); _build_file = build_file; try { @@ -1014,8 +1014,8 @@ // set up "Execute" button for multiple targets ArrayList last_used_targets = null; - if (new_file) { - _multi.setSelected(_settings.getMultipleTargets()); + if ( new_file ) { + _multi.setSelected( _settings.getMultipleTargets() ); } if ( _multi.isSelected() ) { JButton execute_btn = new JButton( "Execute" ); @@ -1032,7 +1032,7 @@ // load the targets from the build file, only keep the targets // that meet the user's subtarget display settings. - Hashtable targets = _project.getTargets(); + Map targets = _project.getTargets(); if ( targets == null || targets.size() == 0 ) { //System.out.println( "no targets in project" ); return ; /// ??? really ??? @@ -1040,6 +1040,7 @@ // Ant 1.6 has an un-named target to hold project-level tasks, so // find it and save it for later. + _unnamed_target = null; if ( getAntVersion() == 16 ) { Iterator iter = targets.keySet().iterator(); @@ -1051,12 +1052,16 @@ } // make buttons by sorting the targets by name + if ( _settings.getSortTargets() ) _targets = new TreeMap( java.text.Collator.getInstance() ); - HashMap sax_targets = _sax_panel.getTargets(); - Enumeration enum = targets.keys(); - while ( enum.hasMoreElements() ) { + else{ + _targets = new LinkedHashMap(); + } + Map sax_targets = _sax_panel.getTargets(); + Iterator it = targets.keySet().iterator(); + while ( it.hasNext() ) { // adjust which targets are showing -- - String target_name = ( String ) enum.nextElement(); + String target_name = ( String ) it.next(); // Ant 1.6 has an un-named target to hold project-level tasks. // It has no name and shouldn't be executed by itself, so @@ -1110,7 +1115,7 @@ // for the targets for this project _buttons = new ArrayList(); _execute_targets = new ArrayList(); - Iterator it = _targets.keySet().iterator(); + it = _targets.keySet().iterator(); while ( it.hasNext() ) { String target_name = ( String ) it.next(); Target target = ( Target ) _targets.get( target_name ); @@ -1168,14 +1173,14 @@ ++con.y; } // if new and was multi, restore selected targets - if (new_file && _multi.isSelected()) { + if ( new_file && _multi.isSelected() ) { it = _settings.getMultipleTargetList().iterator(); - while(it.hasNext()) { - String name = (String)it.next(); + while ( it.hasNext() ) { + String name = ( String ) it.next(); Iterator itr = _buttons.iterator(); - while(itr.hasNext()) { - AbstractButton btn = (AbstractButton)itr.next(); - if (btn.getActionCommand().equals(name)) + while ( itr.hasNext() ) { + AbstractButton btn = ( AbstractButton ) itr.next(); + if ( btn.getActionCommand().equals( name ) ) btn.doClick(); } } @@ -1281,10 +1286,10 @@ // add the gui input handler try { - Object ih = PrivilegedAccessor.getNewInstance("ise.antelope.common.AntInputHandler", new Object[]{(Component)this}); - PrivilegedAccessor.invokeMethod(p, "setInputHandler", new Object[]{ih}); + Object ih = PrivilegedAccessor.getNewInstance( "ise.antelope.common.AntInputHandler", new Object[] {( Component ) this} ); + PrivilegedAccessor.invokeMethod( p, "setInputHandler", new Object[] {ih} ); } - catch(Exception e) { + catch ( Exception e ) { e.printStackTrace(); } @@ -1532,40 +1537,41 @@ /** Description of the Method */ private void saveConfigurationSettings() { - _settings.setMultipleTargets(_multi.isSelected()); - if (_buttons != null && _multi.isSelected()) { - TreeSet btns = new TreeSet(new Comparator(){ - public int compare(Object a, Object b) { - AbstractButton btna = (AbstractButton)a; - AbstractButton btnb = (AbstractButton)b; + _settings.setMultipleTargets( _multi.isSelected() ); + if ( _buttons != null && _multi.isSelected() ) { + TreeSet btns = new TreeSet( new Comparator() { + public int compare( Object a, Object b ) { + AbstractButton btna = ( AbstractButton ) a; + AbstractButton btnb = ( AbstractButton ) b; String aname = btna.getText(); String bname = btnb.getText(); - aname = aname.substring(0, aname.length() - 1); - aname = aname.substring(aname.lastIndexOf("(") + 1); - bname = bname.substring(0, bname.length() - 1); - bname = bname.substring(bname.lastIndexOf("(") + 1); - int aint = Integer.parseInt(aname); - int bint = Integer.parseInt(bname); - if (aint < bint) + aname = aname.substring( 0, aname.length() - 1 ); + aname = aname.substring( aname.lastIndexOf( "(" ) + 1 ); + bname = bname.substring( 0, bname.length() - 1 ); + bname = bname.substring( bname.lastIndexOf( "(" ) + 1 ); + int aint = Integer.parseInt( aname ); + int bint = Integer.parseInt( bname ); + if ( aint < bint ) return -1; - if (aint == bint) + if ( aint == bint ) return 0; return 1; } - }); + } + ); Iterator it = _buttons.iterator(); - while(it.hasNext()) { - AbstractButton btn = (AbstractButton)it.next(); - if(btn.isSelected()) - btns.add(btn); + while ( it.hasNext() ) { + AbstractButton btn = ( AbstractButton ) it.next(); + if ( btn.isSelected() ) + btns.add( btn ); } it = btns.iterator(); ArrayList target_list = new ArrayList(); - while(it.hasNext()) { - String target_name = ((AbstractButton)it.next()).getActionCommand(); - target_list.add(target_name); + while ( it.hasNext() ) { + String target_name = ( ( AbstractButton ) it.next() ).getActionCommand(); + target_list.add( target_name ); } - _settings.setMultipleTargetList(target_list); + _settings.setMultipleTargetList( target_list ); } if ( _prefs != null ) { try { File [changed]: Constants.java Url: http://antelope.tigris.org/source/browse/antelope/src/ise/antelope/common/Constants.java?r1=1.6&r2=1.7 Delta lines: +2 -1 ------------------- --- Constants.java 8 May 2004 02:42:55 -0000 1.6 +++ Constants.java 19 May 2004 14:03:57 -0000 1.7 @@ -1,4 +1,4 @@ -// $Id: Constants.java,v 1.6 2004/05/08 02:42:55 danson Exp $ +// $Id: Constants.java,v 1.7 2004/05/19 14:03:57 danson Exp $ /* * Based on the Apache Software License, Version 1.1 * @@ -125,6 +125,7 @@ public final static String SHOW_TARGETS_WO_DESC = "showTargetsWODesc"; public final static String SHOW_TARGETS_W_DOTS = "showTargetsWDots"; public final static String SHOW_TARGETS_W_DASH = "showTargetsWDash"; + public final static String SORT_TARGETS = "sortTargets"; public final static String MSG_LEVEL = "msgLevel"; public final static String SHOW_BUILD_EVENTS = "showBuildEvents"; public final static String SHOW_TARGET_EVENTS = "showTargetEvents"; File [changed]: OptionSettings.java Url: http://antelope.tigris.org/source/browse/antelope/src/ise/antelope/common/OptionSettings.java?r1=1.5&r2=1.6 Delta lines: +11 -0 -------------------- --- OptionSettings.java 8 May 2004 02:42:55 -0000 1.5 +++ OptionSettings.java 19 May 2004 14:03:57 -0000 1.6 @@ -16,6 +16,7 @@ private boolean _show_targets_wo_desc = false; private boolean _show_targets_w_dot = false; private boolean _show_targets_w_dash = false; + private boolean _sort_targets = true; private int _message_level = Project.MSG_INFO; private boolean _show_build_events = true; private boolean _show_target_events = false; @@ -52,6 +53,7 @@ _show_targets_wo_desc = _prefs.getBoolean( SHOW_TARGETS_WO_DESC, false ); _show_targets_w_dot = _prefs.getBoolean( SHOW_TARGETS_W_DOTS, false ); _show_targets_w_dash = _prefs.getBoolean( SHOW_TARGETS_W_DASH, false ); + _sort_targets = _prefs.getBoolean(SORT_TARGETS, true); _message_level = _prefs.getInt( MSG_LEVEL, Project.MSG_INFO ); _show_build_events = _prefs.getBoolean( SHOW_BUILD_EVENTS, true ); _show_target_events = _prefs.getBoolean( SHOW_TARGET_EVENTS, false ); @@ -83,6 +85,7 @@ _prefs.putBoolean( SHOW_TARGETS_W_DASH, _show_targets_w_dash ); _prefs.putBoolean( SHOW_TARGETS_W_DOTS, _show_targets_w_dot ); _prefs.putBoolean( SHOW_TARGETS_WO_DESC, _show_targets_wo_desc ); + _prefs.putBoolean( SORT_TARGETS, _sort_targets); _prefs.putBoolean( SHOW_TASK_EVENTS, _show_task_events ); _prefs.putBoolean( USE_ERROR_PARSING, _use_error_parsing ); _prefs.putBoolean( AUTO_RELOAD, _auto_reload ); @@ -156,12 +159,20 @@ _show_targets_w_dash = b; } + public void setSortTargets(boolean b) { + _sort_targets = b; + } + public boolean getShowTargetsWDot() { return _show_targets_w_dot; } public boolean getShowTargetsWDash() { return _show_targets_w_dash; + } + + public boolean getSortTargets() { + return _sort_targets; } public void setMessageOutputLevel( int level ) { File [changed]: SAXPanel.java Url: http://antelope.tigris.org/source/browse/antelope/src/ise/antelope/common/SAXPanel.java?r1=1.10&r2=1.11 Delta lines: +1 -1 ------------------- --- SAXPanel.java 14 Apr 2004 13:10:22 -0000 1.10 +++ SAXPanel.java 19 May 2004 14:03:57 -0000 1.11 @@ -435,7 +435,7 @@ * @return a list of targets in the current build file. Key is the target name, * value is a SAXTreeNode. */ - protected HashMap getTargets() { + protected Map getTargets() { SAXTreeModel model = (SAXTreeModel)tree.getModel(); return model.getTargets(); } File [changed]: SAXTreeModel.java Url: http://antelope.tigris.org/source/browse/antelope/src/ise/antelope/common/SAXTreeModel.java?r1=1.5&r2=1.6 Delta lines: +4 -4 ------------------- --- SAXTreeModel.java 14 Apr 2004 13:10:22 -0000 1.5 +++ SAXTreeModel.java 19 May 2004 14:03:57 -0000 1.6 @@ -147,9 +147,9 @@ * @return a list of targets in the current build file. Key is the target name, * value is a SAXTreeNode. */ - public HashMap getTargets() { + public Map getTargets() { // list of targets, key is target name, value is a SAXTreeNode representing a target - HashMap list = new HashMap(); + Map list = new LinkedHashMap(); // project children Enumeration en = ( ( SAXTreeNode ) getRoot() ).children(); @@ -166,7 +166,7 @@ return list; } - private void addSubProjectTargets( SAXTreeNode project, HashMap list ) { + private void addSubProjectTargets( SAXTreeNode project, Map list ) { Enumeration en = project.children(); String project_name = project.getAttributeValue( "name" ); if ( project_name == null ) @@ -193,7 +193,7 @@ StringBuffer sb = new StringBuffer(); // check target dependencies for each target - HashMap targets = getTargets(); + Map targets = getTargets(); Iterator it = targets.keySet().iterator(); while ( it.hasNext() ) { String name = ( String ) it.next(); File [changed]: version.txt Url: http://antelope.tigris.org/source/browse/antelope/src/ise/antelope/common/version.txt?r1=1.27&r2=1.28 Delta lines: +2 -2 ------------------- --- version.txt 8 May 2004 02:42:55 -0000 1.27 +++ version.txt 19 May 2004 14:03:57 -0000 1.28 @@ -1,2 +1,2 @@ VERSION=3.1.6 -DATE=May 7 2004 \ No newline at end of file +DATE=May 16 2004 \ No newline at end of file Directory: /antelope/src/ise/antelope/common/dependency/ ======================================================== File [changed]: DependencyViewer.java Url: http://antelope.tigris.org/source/browse/antelope/src/ise/antelope/common/dependency/DependencyViewer.java?r1=1.2&r2=1.3 Delta lines: +1 -1 ------------------- --- DependencyViewer.java 8 May 2004 02:42:56 -0000 1.2 +++ DependencyViewer.java 19 May 2004 14:03:57 -0000 1.3 @@ -24,7 +24,7 @@ // load the build file and get all target nodes SAXTreeModel model = new SAXTreeModel( _build_file ); - HashMap target_nodes = model.getTargets(); + Map target_nodes = model.getTargets(); // make corresponding graph nodes HashMap graph_nodes = new HashMap(); --------------------------------------------------------------------- To unsubscribe, e-mail: cvs-unsubscribe@antelope.tigris.org For additional commands, e-mail: cvs-help@antelope.tigris.org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /antelope/, /antelope/src/ise/antelope/app/, /antelope/src/ise/antelope/common/, /antelope/src/ise/antelope/common/dependency/ danson Dale Anson 2004-05-19 07:03:59 PDT
Messages per page: