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...@locus.apache.org on 2000/11/16 23:38:38 UTC

cvs commit: jakarta-ant/src/antidote/org/apache/tools/ant/gui Main.java PropertyEditor.java

metasim     00/11/16 14:38:38

  Modified:    src/antidote/org/apache/tools/ant/gui Main.java
                        PropertyEditor.java
  Log:
  Changed mechanism by which the PropertyEditor editor is instantiated so that it
  uses whatever class is retured by BeanDescriptor.getCustomizerClass() rather
  than assuming DynamicCustomizer. This will allow BeanSpecific customizers to be
  used in leu of the DynamicCustomizer.
  
  Also finally figured out the IllegalAccessException problem with calling the
  NodeList methods in the ACSTreeNodeElement classes, which turned out only to
  happen when jikes was used for compiling. Implemented a work around.
  
  Revision  Changes    Path
  1.5       +1 -10     jakarta-ant/src/antidote/org/apache/tools/ant/gui/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/Main.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Main.java	2000/11/16 18:32:23	1.4
  +++ Main.java	2000/11/16 22:38:38	1.5
  @@ -60,7 +60,7 @@
   /**
    * Launch point for the Antidote GUI. Configurs it as an application.
    * 
  - * @version $Revision: 1.4 $ 
  + * @version $Revision: 1.5 $ 
    * @author Simeon Fitch 
    */
   public class Main {
  @@ -71,15 +71,6 @@
   	 */
       public static void main(String[] args) {
           XMLHelper.init();
  -
  -        String vmVersion = System.getProperty("java.vm.vendor");
  -        if(vmVersion.indexOf("Blackdown") > 0 &&
  -           vmVersion.indexOf("RC") > 0) {
  -            System.err.println(
  -                "Warning: Antidote will not work with VM version " +
  -                "Blackdown-1.3.0-RC1.");
  -            System.err.println("Your version: " + vmVersion);
  -        }
   
           try {
               JFrame f = new JFrame("Antidote");
  
  
  
  1.8       +17 -7     jakarta-ant/src/antidote/org/apache/tools/ant/gui/PropertyEditor.java
  
  Index: PropertyEditor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/PropertyEditor.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PropertyEditor.java	2000/11/15 21:25:33	1.7
  +++ PropertyEditor.java	2000/11/16 22:38:38	1.8
  @@ -58,20 +58,22 @@
   import org.apache.tools.ant.gui.event.*;
   import javax.swing.*;
   import java.util.*;
  +import java.beans.*;
   import java.io.StringReader;
   import java.io.IOException;
   import java.awt.BorderLayout;
  +import java.awt.Component;
   
   /**
    * Stub for a property editor.
    *
  - * @version $Revision: 1.7 $ 
  + * @version $Revision: 1.8 $ 
    * @author Simeon H.K. Fitch 
    */
   class PropertyEditor extends AntEditor {
   
  -    /** The property sheet. */
  -    private DynamicCustomizer _customizer = null;
  +    /** The editor for current bean.*/
  +    private Customizer _customizer = null;
       /** Container for the customizer. */
       private JPanel _container = null;
   
  @@ -95,14 +97,22 @@
   	 */
       private void updateDisplay(ACSElement[] items) {
           if(_customizer != null) {
  -            _container.remove(_customizer);
  +            _container.remove((Component)_customizer);
               _customizer = null;
           }
   
           if(items != null && items.length == 1) {
  -            _customizer = new DynamicCustomizer(items[0].getClass());
  -            _customizer.setObject(items[0]);
  -            _container.add(BorderLayout.CENTER, _customizer);
  +            try {
  +                BeanInfo info = Introspector.getBeanInfo(items[0].getClass());
  +                _customizer = (Customizer) info.getBeanDescriptor().
  +                    getCustomizerClass().newInstance();
  +                _customizer.setObject(items[0]);
  +                _container.add(BorderLayout.CENTER, (Component) _customizer);
  +            }
  +            catch(Exception ex) {
  +                // XXX log me.
  +                ex.printStackTrace();
  +            }
           }
   
           validate();