Subject: CVS update: ADDED: project/src/org/netbeans/modules/java/project
Wrom: KHJYFMYXOEAIJJPHSCRTNHGSWZIDREXCAXZOWCONEUQZAAFXISHJEXXIMQZUIVOTQNQEMSFDULHPQQWOYIYZUNNYCGPKYLEJGDGVCJVTLBXFGGMEPYOQKEDOTWFAOBUZXUWLSZLKBRNVWWCUFPEGAUTFJMVRESKPNKMBIPBARHDMNNSKVFVWRKJVZCMHVIBGDADRZFSQHYUCDDJBLVLMHAALPTCXLYRWTQTIPWIGYOKSTTZRCLBDXRQBGJSNBOHMKHJYFMYXOEAIJJP
  User: dkonecny
  Date: 04/05/04 09:04:35

  Added:       project/src/org/netbeans/modules/java/project
                        BrokenReferencesCustomizer.form
                        BrokenReferencesCustomizer.java
                        BrokenReferencesModel.java
               project/src/org/netbeans/spi/java/project/support/ui
                        BrokenReferencesSupport.java
  Log:
  Rough version of management of project's broken references.
  
  Revision  Changes    Path
  1.466     +1 -1      nbbuild/build.xml
  
  http://nbbuild.netbeans.org/source/browse/nbbuild/build.xml.diff?r1=1.465&r2=1.466
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: build.xml
  ===================================================================
  RCS file: /cvs/nbbuild/build.xml,v
  retrieving revision 1.465
  retrieving revision 1.466
  diff -u -b -r1.465 -r1.466
  --- build.xml	4 May 2004 06:09:52 -0000	1.465
  +++ build.xml	4 May 2004 16:04:27 -0000	1.466
  @@ -1013,7 +1013,7 @@
         <echo message="Building module ant/project..."/>
         <ant dir="../ant/project" target="netbeans"/>
     </target>
  -  <target name="all-java/project" depends="all-openide,all-openide/loaders,all-openidex,all-projects/projectapi,all-projects/projectuiapi,all-java/api,all-java">
  +  <target name="all-java/project" depends="all-openide,all-openide/loaders,all-openidex,all-projects/projectapi,all-projects/projectuiapi,all-java/api,all-java,all-java/platform,all-ant/project,all-projects/libraries,all-projects/queries">
       <echo message="Building module java/project..."/>
       <ant dir="../java/project" target="netbeans"/>
     </target>
  
  
  
  1.15      +1 -1      java/j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEProject.java
  
  http://java.netbeans.org/source/browse/java/j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEProject.java.diff?r1=1.14&r2=1.15
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: J2SEProject.java
  ===================================================================
  RCS file: /cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEProject.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -b -r1.14 -r1.15
  --- J2SEProject.java	4 May 2004 14:00:10 -0000	1.14
  +++ J2SEProject.java	4 May 2004 16:04:28 -0000	1.15
  @@ -140,7 +140,7 @@
               helper.createCacheDirectoryProvider(),
               spp,
               new J2SEActionProvider( this, helper ),
  -            new J2SEPhysicalViewProvider(this, helper, evaluator(), spp),
  +            new J2SEPhysicalViewProvider(this, helper, evaluator(), spp, refHelper),
               new J2SECustomizerProvider(this, helper, evaluator(), refHelper),
               new ClassPathProviderImpl(helper, evaluator()),
               new CompiledSourceForBinaryQuery(helper, evaluator()),
  
  
  
  1.5       +3 -0      java/j2seproject/src/org/netbeans/modules/java/j2seproject/ui/Bundle.properties
  
  http://java.netbeans.org/source/browse/java/j2seproject/src/org/netbeans/modules/java/j2seproject/ui/Bundle.properties.diff?r1=1.4&r2=1.5
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Bundle.properties
  ===================================================================
  RCS file: /cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/ui/Bundle.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- Bundle.properties	27 Apr 2004 12:35:16 -0000	1.4
  +++ Bundle.properties	4 May 2004 16:04:29 -0000	1.5
  @@ -48,3 +48,6 @@
   #Nodes in logical view
   LBL_Node_Sources=Source Packages
   LBL_Node_Tests=Test Packages
  +
  +LBL_Fix_Broken_Links_Action=Resolve Configuration Problems
  +
  
  
  
  1.8       +32 -1     java/j2seproject/src/org/netbeans/modules/java/j2seproject/ui/J2SEPhysicalViewProvider.java
  
  http://java.netbeans.org/source/browse/java/j2seproject/src/org/netbeans/modules/java/j2seproject/ui/J2SEPhysicalViewProvider.java.diff?r1=1.7&r2=1.8
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: J2SEPhysicalViewProvider.java
  ===================================================================
  RCS file: /cvs/java/j2seproject/src/org/netbeans/modules/java/j2seproject/ui/J2SEPhysicalViewProvider.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- J2SEPhysicalViewProvider.java	27 Apr 2004 12:35:16 -0000	1.7
  +++ J2SEPhysicalViewProvider.java	4 May 2004 16:04:30 -0000	1.8
  @@ -32,12 +32,15 @@
   import org.netbeans.api.project.ProjectManager;
   import org.netbeans.api.project.ProjectUtils;
   import org.netbeans.modules.java.j2seproject.J2SEProjectType;
  +import org.netbeans.modules.java.j2seproject.ui.customizer.J2SEProjectProperties;
  +import org.netbeans.spi.java.project.support.ui.BrokenReferencesSupport;
   import org.netbeans.spi.java.project.support.ui.PackageView;
   import org.netbeans.spi.project.ActionProvider;
   import org.netbeans.spi.project.SubprojectProvider;
   import org.netbeans.spi.project.support.ant.AntProjectHelper;
   import org.netbeans.spi.project.support.ant.EditableProperties;
   import org.netbeans.spi.project.support.ant.PropertyEvaluator;
  +import org.netbeans.spi.project.support.ant.ReferenceHelper;
   import org.netbeans.spi.project.ui.LogicalViewProvider;
   import org.netbeans.spi.project.ui.support.LogicalViews;
   import org.netbeans.spi.project.ui.support.ProjectSensitiveActions;
  @@ -66,9 +69,10 @@
       private final AntProjectHelper helper;    
       private final PropertyEvaluator evaluator;
       private final SubprojectProvider spp;
  +    private final ReferenceHelper resolver;
       
       
  -    public J2SEPhysicalViewProvider(Project project, AntProjectHelper helper, PropertyEvaluator evaluator, SubprojectProvider spp) {
  +    public J2SEPhysicalViewProvider(Project project, AntProjectHelper helper, PropertyEvaluator evaluator, SubprojectProvider spp, ReferenceHelper resolver) {
           this.project = project;
           assert project != null;
           this.helper = helper;
  @@ -77,6 +81,7 @@
           assert evaluator != null;
           this.spp = spp;
           assert spp != null;
  +        this.resolver = resolver;
       }
           
       public Node createLogicalView() {
  @@ -93,17 +98,29 @@
   
       // Private innerclasses ----------------------------------------------------
           
  +    private static final String[] BREAKABLE_PROPERTIES = new String[] {
  +        J2SEProjectProperties.JAVAC_CLASSPATH,  
  +        J2SEProjectProperties.RUN_CLASSPATH, 
  +        J2SEProjectProperties.DEBUG_CLASSPATH, 
  +        J2SEProjectProperties.RUN_TEST_CLASSPATH, 
  +        J2SEProjectProperties.DEBUG_TEST_CLASSPATH, 
  +        J2SEProjectProperties.JAVAC_TEST_CLASSPATH};
  +        
       /** Filter node containin additional features for the J2SE physical
        */
       private final class J2SELogicalViewRootNode extends AbstractNode {
   
           private Image icon;
           private Lookup lookup;
  +        private boolean showBrokenLinksAction = false;
           
           public J2SELogicalViewRootNode() {
               super( new J2SEViews.LogicalViewChildren( helper, evaluator ), createLookup( project ) ); 
               setIconBase( "org/netbeans/modules/java/j2seproject/ui/resources/j2seProject" ); // NOI18N
               setName( ProjectUtils.getInformation( project ).getDisplayName() );            
  +            if (BrokenReferencesSupport.isBroken(helper.getStandardPropertyEvaluator(), BREAKABLE_PROPERTIES, evaluator.getProperty(J2SEProjectProperties.JAVA_PLATFORM))) {
  +                showBrokenLinksAction = true;
  +            }
           }
           
           public Node.PropertySet[] getPropertySets() {
  @@ -179,9 +196,23 @@
                   null,
                   SystemAction.get( org.openide.actions.ToolsAction.class ),
                   null,
  +                showBrokenLinksAction ? createBrokenLinksAction() : null,
                   LogicalViews.customizeProjectAction(),
               };
   
  +        }
  +        
  +        private Action createBrokenLinksAction() {
  +            Action action = new AbstractAction() {
  +                    public void actionPerformed(ActionEvent e) {
  +                        BrokenReferencesSupport.showCustomizer(helper, resolver, BREAKABLE_PROPERTIES, evaluator.getProperty(J2SEProjectProperties.JAVA_PLATFORM));
  +                        if (!BrokenReferencesSupport.isBroken(helper.getStandardPropertyEvaluator(), BREAKABLE_PROPERTIES, evaluator.getProperty(J2SEProjectProperties.JAVA_PLATFORM))) {
  +                            setEnabled(false);
  +                        }
  +                    }
  +                };
  +            action.putValue(Action.NAME, NbBundle.getMessage(J2SEPhysicalViewProvider.class, "LBL_Fix_Broken_Links_Action"));
  +            return action;
           }
           
           private Node.PropertySet[] getAdditionalSets() {
  
  
  
  1.8       +32 -0     java/project/nbproject/project.xml
  
  http://java.netbeans.org/source/browse/java/project/nbproject/project.xml.diff?r1=1.7&r2=1.8
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: project.xml
  ===================================================================
  RCS file: /cvs/java/project/nbproject/project.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- project.xml	30 Apr 2004 17:17:28 -0000	1.7
  +++ project.xml	4 May 2004 16:04:30 -0000	1.8
  @@ -34,6 +34,30 @@
                       <run-dependency/>
                   </dependency>
                   <dependency>
  +                    <code-name-base>org.netbeans.modules.java.platform</code-name-base>
  +                    <build-prerequisite/>
  +                    <compile-dependency/>
  +                    <run-dependency>
  +                        <release-version>0</release-version>
  +                    </run-dependency>
  +                </dependency>
  +                <dependency>
  +                    <code-name-base>org.netbeans.modules.project.ant</code-name-base>
  +                    <build-prerequisite/>
  +                    <compile-dependency/>
  +                    <run-dependency>
  +                        <release-version>0</release-version>
  +                    </run-dependency>
  +                </dependency>
  +                <dependency>
  +                    <code-name-base>org.netbeans.modules.project.libraries</code-name-base>
  +                    <build-prerequisite/>
  +                    <compile-dependency/>
  +                    <run-dependency>
  +                        <release-version>0</release-version>
  +                    </run-dependency>
  +                </dependency>
  +                <dependency>
                       <code-name-base>org.openidex.util</code-name-base>
                       <build-prerequisite/>
                       <compile-dependency/>
  @@ -51,6 +75,14 @@
                   </dependency>
                   <dependency>
                       <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
  +                    <build-prerequisite/>
  +                    <compile-dependency/>
  +                    <run-dependency>
  +                        <release-version>0</release-version>
  +                    </run-dependency>
  +                </dependency>
  +                <dependency>
  +                    <code-name-base>org.netbeans.modules.queries</code-name-base>
                       <build-prerequisite/>
                       <compile-dependency/>
                       <run-dependency>
  
  
  
  1.3       +22 -0     java/project/src/org/netbeans/modules/java/project/Bundle.properties
  
  http://java.netbeans.org/source/browse/java/project/src/org/netbeans/modules/java/project/Bundle.properties.diff?r1=1.2&r2=1.3
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Bundle.properties
  ===================================================================
  RCS file: /cvs/java/project/src/org/netbeans/modules/java/project/Bundle.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- Bundle.properties	16 Mar 2004 15:31:45 -0000	1.2
  +++ Bundle.properties	4 May 2004 16:04:33 -0000	1.3
  @@ -13,3 +13,25 @@
   OpenIDE-Module-Display-Category=Java
   OpenIDE-Module-Short-Description=Support for defining Ant-based project types involving Java sources.
   #OpenIDE-Module-Long-Description=XXX
  +
  +LBL_BrokenLinksCustomizer_Close=Close
  +LBL_BrokenLinksCustomizer_Fix=Fix
  +LBL_BrokenLinksCustomizer_Description=Description:
  +LBL_BrokenLinksCustomizer_List=Problems:
  +LBL_BrokenLinksCustomizer_BrokenPlatform=Platform "{0}" was not found
  +LBL_BrokenLinksCustomizer_BrokenLibrary=Library "{0}" was not found
  +LBL_BrokenLinksCustomizer_BrokenFileReference=File reference "{0}" could not be resolved
  +LBL_BrokenLinksCustomizer_BrokenProjectReference=Project reference "{0}" could not be resolved
  +LBL_BrokenLinksCustomizer_BrokenPlatformDesc=The project is setup to use \
  +    Java Platform with name "{0}", but this platform was not found. \
  +    Correction: press Fix button and create new platform with name "{0}".
  +LBL_BrokenLinksCustomizer_BrokenLibraryDesc=The project is setup to use \
  +    Java Library with name "{0}", but this library was not found. \
  +    Correction: press Fix button and create new library with name "{0}".
  +LBL_BrokenLinksCustomizer_BrokenFileReferenceDesc=The project uses file \
  +    which was not found. The file reference is "{0}". \
  +    Correction: press Fix button and find that file.
  +LBL_BrokenLinksCustomizer_BrokenProjectReferenceDesc=The project depends on \
  +    other project which was not found. The foreign project reference is \
  +    "{0}". Correction: press Fix button and find that project.
  +LBL_BrokenLinksCustomizer_Title=Resolve configuration problems
  
  
  
  1.1                  java/project/src/org/netbeans/modules/java/project/BrokenReferencesCustomizer.form
  
  http://java.netbeans.org/source/browse/java/project/src/org/netbeans/modules/java/project/BrokenReferencesCustomizer.form?rev=1.1&content-type=text/x-cvsweb-markup
  
  Index: BrokenReferencesCustomizer.form
  ===================================================================
  <?xml version="1.0" encoding="UTF-8" ?>
  
  <Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    <Properties>
      <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
        <Dimension value="[400, 300]"/>
      </Property>
    </Properties>
  
    <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
    <SubComponents>
      <Component class="javax.swing.JLabel" name="errorListLabel">
        <Properties>
          <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
            <ComponentRef name="errorList"/>
          </Property>
          <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
            <ResourceString bundle="org/netbeans/modules/java/project/Bundle.properties" key="LBL_BrokenLinksCustomizer_List" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
          </Property>
        </Properties>
        <Constraints>
          <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
            <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="3" insetsRight="0" anchor="16" weightX="0.0" weightY="0.0"/>
          </Constraint>
        </Constraints>
      </Component>
      <Container class="javax.swing.JScrollPane" name="jScrollPane1">
        <Constraints>
          <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
            <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="1.0" weightY="1.0"/>
          </Constraint>
        </Constraints>
  
        <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
        <SubComponents>
          <Component class="javax.swing.JList" name="errorList">
            <Properties>
              <Property name="selectionMode" type="int" value="0"/>
            </Properties>
            <Events>
              <EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="errorListValueChanged"/>
            </Events>
          </Component>
        </SubComponents>
      </Container>
      <Component class="javax.swing.JButton" name="fix">
        <Properties>
          <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
            <ResourceString bundle="org/netbeans/modules/java/project/Bundle.properties" key="LBL_BrokenLinksCustomizer_Fix" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
          </Property>
        </Properties>
        <Events>
          <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="fixActionPerformed"/>
        </Events>
        <Constraints>
          <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
            <GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
          </Constraint>
        </Constraints>
      </Component>
      <Component class="javax.swing.JLabel" name="descriptionLabel">
        <Properties>
          <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
            <ComponentRef name="description"/>
          </Property>
          <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
            <ResourceString bundle="org/netbeans/modules/java/project/Bundle.properties" key="LBL_BrokenLinksCustomizer_Description" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
          </Property>
        </Properties>
        <Constraints>
          <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
            <GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="0" insetsBottom="3" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
          </Constraint>
        </Constraints>
      </Component>
      <Container class="javax.swing.JScrollPane" name="jScrollPane2">
        <Constraints>
          <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
            <GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="60" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
          </Constraint>
        </Constraints>
  
        <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
        <SubComponents>
          <Component class="javax.swing.JTextArea" name="description">
            <Properties>
              <Property name="editable" type="boolean" value="false"/>
              <Property name="lineWrap" type="boolean" value="true"/>
              <Property name="wrapStyleWord" type="boolean" value="true"/>
            </Properties>
          </Component>
        </SubComponents>
      </Container>
    </SubComponents>
  </Form>
  
  
  
  1.1                  java/project/src/org/netbeans/modules/java/project/BrokenReferencesCustomizer.java
  
  http://java.netbeans.org/source/browse/java/project/src/org/netbeans/modules/java/project/BrokenReferencesCustomizer.java?rev=1.1&content-type=text/x-cvsweb-markup
  
  Index: BrokenReferencesCustomizer.java
  ===================================================================
  /*
   *                 Sun Public License Notice
   *
   * The contents of this file are subject to the Sun Public License
   * Version 1.0 (the "License"). You may not use this file except in
   * compliance with the License. A copy of the License is available at
   * http://www.sun.com/
   *
   * The Original Code is NetBeans. The Initial Developer of the Original
   * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
   * Microsystems, Inc. All Rights Reserved.
   */
  
  package org.netbeans.modules.java.project;
  
  import java.io.File;
  import javax.swing.AbstractListModel;
  import javax.swing.JFileChooser;
  import org.netbeans.api.java.platform.PlatformsCustomizer;
  import org.netbeans.api.project.libraries.LibrariesCustomizer;
  import org.netbeans.spi.project.ui.support.ProjectChooser;
  import org.openide.util.NbBundle;
  
  /**
   *
   * @author  David Konecny
   */
  public class BrokenReferencesCustomizer extends javax.swing.JPanel {
  
      private BrokenReferencesModel model;
      
      /** Creates new form BrokenReferencesCustomizer */
      public BrokenReferencesCustomizer(BrokenReferencesModel model) {
          initComponents();
          this.model = model;
          errorList.setModel(model);
          errorList.setSelectedIndex(0);
      }
      
      /** This method is called from within the constructor to
       * initialize the form.
       * WARNING: Do NOT modify this code. The content of this method is
       * always regenerated by the Form Editor.
       */
      private void initComponents() {//GEN-BEGIN:initComponents
          java.awt.GridBagConstraints gridBagConstraints;
  
          errorListLabel = new javax.swing.JLabel();
          jScrollPane1 = new javax.swing.JScrollPane();
          errorList = new javax.swing.JList();
          fix = new javax.swing.JButton();
          descriptionLabel = new javax.swing.JLabel();
          jScrollPane2 = new javax.swing.JScrollPane();
          description = new javax.swing.JTextArea();
  
          setLayout(new java.awt.GridBagLayout());
  
          setPreferredSize(new java.awt.Dimension(400, 300));
          errorListLabel.setLabelFor(errorList);
          errorListLabel.setText(org.openide.util.NbBundle.getMessage(BrokenReferencesCustomizer.class, "LBL_BrokenLinksCustomizer_List"));
          gridBagConstraints = new java.awt.GridBagConstraints();
          gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
          gridBagConstraints.insets = new java.awt.Insets(0, 0, 3, 0);
          add(errorListLabel, gridBagConstraints);
  
          errorList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
          errorList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
              public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                  errorListValueChanged(evt);
              }
          });
  
          jScrollPane1.setViewportView(errorList);
  
          gridBagConstraints = new java.awt.GridBagConstraints();
          gridBagConstraints.gridx = 0;
          gridBagConstraints.gridy = 1;
          gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
          gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
          gridBagConstraints.weightx = 1.0;
          gridBagConstraints.weighty = 1.0;
          add(jScrollPane1, gridBagConstraints);
  
          fix.setText(org.openide.util.NbBundle.getMessage(BrokenReferencesCustomizer.class, "LBL_BrokenLinksCustomizer_Fix"));
          fix.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  fixActionPerformed(evt);
              }
          });
  
          gridBagConstraints = new java.awt.GridBagConstraints();
          gridBagConstraints.gridx = 1;
          gridBagConstraints.gridy = 1;
          gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
          gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
          gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0);
          add(fix, gridBagConstraints);
  
          descriptionLabel.setLabelFor(description);
          descriptionLabel.setText(org.openide.util.NbBundle.getMessage(BrokenReferencesCustomizer.class, "LBL_BrokenLinksCustomizer_Description"));
          gridBagConstraints = new java.awt.GridBagConstraints();
          gridBagConstraints.gridx = 0;
          gridBagConstraints.gridy = 2;
          gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
          gridBagConstraints.insets = new java.awt.Insets(6, 0, 3, 0);
          add(descriptionLabel, gridBagConstraints);
  
          description.setEditable(false);
          description.setLineWrap(true);
          description.setWrapStyleWord(true);
          jScrollPane2.setViewportView(description);
  
          gridBagConstraints = new java.awt.GridBagConstraints();
          gridBagConstraints.gridx = 0;
          gridBagConstraints.gridy = 3;
          gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
          gridBagConstraints.ipady = 60;
          add(jScrollPane2, gridBagConstraints);
  
      }//GEN-END:initComponents
  
      private void errorListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_errorListValueChanged
          updateSelection();
      }//GEN-LAST:event_errorListValueChanged
  
      private void fixActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fixActionPerformed
          if (model.isLibrary(errorList.getSelectedIndex())) {
              LibrariesCustomizer.showCustomizer(null);
          } else if (model.isPlatform(errorList.getSelectedIndex())) {
              PlatformsCustomizer.showCustomizer(null);
          } else {
              JFileChooser chooser;
              if (model.isProjectReference(errorList.getSelectedIndex())) {
                  chooser = ProjectChooser.projectChooser();
              } else {
                  chooser = new JFileChooser();
              }
              int option = chooser.showOpenDialog(null);
              if (option == JFileChooser.APPROVE_OPTION) {
                  model.updateReference(errorList.getSelectedIndex(), chooser.getSelectedFile());
              }
          }
          model.refresh();
          updateSelection();
      }//GEN-LAST:event_fixActionPerformed
  
      private void updateSelection() {
          if (errorList.getSelectedIndex() != -1 && errorList.getSelectedIndex() < model.getSize()) {
              description.setText(model.getDesciption(errorList.getSelectedIndex()));
              fix.setEnabled(true);
          } else {
              description.setText("");
              fix.setEnabled(false);
          }
      }
      
      
      // Variables declaration - do not modify//GEN-BEGIN:variables
      private javax.swing.JTextArea description;
      private javax.swing.JLabel descriptionLabel;
      private javax.swing.JList errorList;
      private javax.swing.JLabel errorListLabel;
      private javax.swing.JButton fix;
      private javax.swing.JScrollPane jScrollPane1;
      private javax.swing.JScrollPane jScrollPane2;
      // End of variables declaration//GEN-END:variables
  
  
  }
  
  
  
  1.1                  java/project/src/org/netbeans/modules/java/project/BrokenReferencesModel.java
  
  http://java.netbeans.org/source/browse/java/project/src/org/netbeans/modules/java/project/BrokenReferencesModel.java?rev=1.1&content-type=text/x-cvsweb-markup
  
  Index: BrokenReferencesModel.java
  ===================================================================
  /*
   *                 Sun Public License Notice
   *
   * The contents of this file are subject to the Sun Public License
   * Version 1.0 (the "License"). You may not use this file except in
   * compliance with the License. A copy of the License is available at
   * http://www.sun.com/
   *
   * The Original Code is NetBeans. The Initial Developer of the Original
   * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
   * Microsystems, Inc. All Rights Reserved.
   */
  
  package org.netbeans.modules.java.project;
  
  import java.io.File;
  import java.util.ArrayList;
  import java.util.LinkedHashSet;
  import java.util.Set;
  import javax.swing.AbstractListModel;
  import org.netbeans.api.java.platform.JavaPlatform;
  import org.netbeans.api.java.platform.JavaPlatformManager;
  import org.netbeans.api.queries.CollocationQuery;
  import org.netbeans.spi.project.support.ant.AntProjectHelper;
  import org.netbeans.spi.project.support.ant.EditableProperties;
  import org.netbeans.spi.project.support.ant.PropertyEvaluator;
  import org.netbeans.spi.project.support.ant.PropertyUtils;
  import org.netbeans.spi.project.support.ant.ReferenceHelper;
  import org.openide.filesystems.FileUtil;
  import org.openide.filesystems.URLMapper;
  import org.openide.util.NbBundle;
  
  public class BrokenReferencesModel extends AbstractListModel {
  
      private String[] props;
      private String[] brokenReferences;
      private String platform;
      private boolean isPlatformBroken;
      private AntProjectHelper helper;
      private ReferenceHelper resolver;
  
      public BrokenReferencesModel(AntProjectHelper helper, 
              ReferenceHelper resolver, String[] props, String platform) {
          this.props = props;
          this.platform = platform;
          this.resolver = resolver;
          this.helper = helper;
          refresh();
      }
      
      public void refresh() {
          brokenReferences = getReferences(helper.getStandardPropertyEvaluator(), props, false);
          isPlatformBroken = platform != null ? !existPlatform(platform) : false;
          this.fireContentsChanged(this, 0, getSize());
      }
  
      public Object getElementAt(int index) {
          if (index < brokenReferences.length) {
              if (isLibrary(index)) {
                  return NbBundle.getMessage(BrokenReferencesCustomizer.class, "LBL_BrokenLinksCustomizer_BrokenLibrary", getLibraryID(index));
              } else {
                  if (isProjectReference(index)) {
                      return NbBundle.getMessage(BrokenReferencesCustomizer.class, "LBL_BrokenLinksCustomizer_BrokenProjectReference", getProjectID(index));
                  } else {
                      return NbBundle.getMessage(BrokenReferencesCustomizer.class, "LBL_BrokenLinksCustomizer_BrokenFileReference", getFileID(index));
                  }
              }
          } else {
              assert index == getSize()-1;
              return NbBundle.getMessage(BrokenReferencesCustomizer.class, "LBL_BrokenLinksCustomizer_BrokenPlatform", platform);
          }
      }
  
      public String getDesciption(int index) {
          if (index < brokenReferences.length) {
              if (isLibrary(index)) {
                  // XXX: if library classpath is defined then just WARN user 
                  // that library is not defined
                  return NbBundle.getMessage(BrokenReferencesCustomizer.class, "LBL_BrokenLinksCustomizer_BrokenLibraryDesc", getLibraryID(index));
              } else {
                  if (isProjectReference(index)) {
                      return NbBundle.getMessage(BrokenReferencesCustomizer.class, "LBL_BrokenLinksCustomizer_BrokenProjectReferenceDesc", getProjectID(index));
                  } else {
                      return NbBundle.getMessage(BrokenReferencesCustomizer.class, "LBL_BrokenLinksCustomizer_BrokenFileReferenceDesc", getFileID(index));
                  }
              }
          } else {
              assert index == getSize()-1;
              return NbBundle.getMessage(BrokenReferencesCustomizer.class, "LBL_BrokenLinksCustomizer_BrokenPlatformDesc", platform);
          }
      }
  
      boolean isLibrary(int index) {
          return index < brokenReferences.length ? brokenReferences[index].startsWith("libs.") : false;
      }
      
      private String getLibraryID(int index) {
          // libs.<name>.classpath
          return brokenReferences[index].substring(5, brokenReferences[index].length()-10);
      }
  
      boolean isPlatform(int index) {
          return isPlatformBroken && index == getSize()-1;
      }
  
      boolean isProjectReference(int index) {
          return brokenReferences[index].startsWith("project.");
      }
  
      private String getProjectID(int index) {
          // project.<name>
          return brokenReferences[index].substring(8);
      }
  
      private String getFileID(int index) {
          // file.reference.<name>
          return brokenReferences[index].substring(15);
      }
  
      public int getSize() {
          return brokenReferences.length + (isPlatformBroken ? 1 : 0);
      }
  
      public static boolean isBroken(PropertyEvaluator evaluator, String[] props, String platform) {
          String[] broken = getReferences(evaluator, props, true);
          if (broken.length > 0) {
              return true;
          }
          return !existPlatform(platform);
      }
  
      private static String[] getReferences(PropertyEvaluator evaluator, String[] ps, boolean abortAfterFirstProblem) {
          Set set = new LinkedHashSet();
          for (int i=0; i<ps.length; i++) {
              // evaluate given property and tokenize it
              String[] vals = PropertyUtils.tokenizePath(evaluator.getProperty(ps[i]));
              
              // XXX: perhaps I could check here also that correctly resolved
              // path point to an existing file? For foreign file references it
              // make sence.
              
              // no check whether after evaluating there are still some 
              // references which could not be evaluated
              for (int j=0; j<vals.length; j++) {
                  // we are checking only: project reference, file reference, library reference
                  if (!(vals[j].startsWith("${file.reference.") || vals[j].startsWith("${project.") || vals[j].startsWith("${libs."))) {
                      continue;
                  }
                  if (vals[j].startsWith("${project.")) {
                      // something in the form: "${project.<projID>}/dist/foo.jar"
                      String val = vals[j].substring(2, vals[j].indexOf('}'));
                      set.add(val);
                  } else {
                      set.add(vals[j].substring(2, vals[j].length()-1));
                  }
                  if (abortAfterFirstProblem) {
                      break;
                  }
              }
              if (set.size() > 0 && abortAfterFirstProblem) {
                  break;
              }
          }
          return (String[])set.toArray(new String[set.size()]);
      }
      
      private static boolean existPlatform(String platform) {
          if (platform.equals("default_platform")) { // NOI18N
              return true;
          }
          JavaPlatform plats[] = JavaPlatformManager.getDefault().getInstalledPlatforms();
          for (int i=0; i<plats.length; i++) {
              if (platform.equals(plats[i].getProperties().get("platform.ant.name"))) { // NOI18N
                  return true;
              }
          }
          return false;
      }
  
      // XXX: perhaps could be moved to ReferenceResolver. 
      // But nobody should need it so it is here for now.
      void updateReference(int index, File file) {
          String reference = brokenReferences[index];
          File myProjDir = FileUtil.toFile(helper.getProjectDirectory());
          String propertiesFile;
          String path;
          if (CollocationQuery.areCollocated(myProjDir, file)) {
              propertiesFile = AntProjectHelper.PROJECT_PROPERTIES_PATH;
              path = PropertyUtils.relativizeFile(myProjDir, file);
              assert path != null : "expected relative path from " + myProjDir + " to " + file; // NOI18N
          } else {
              propertiesFile = AntProjectHelper.PRIVATE_PROPERTIES_PATH;
              path = file.getAbsolutePath();
          }
          EditableProperties props = helper.getProperties(propertiesFile);
          if (!path.equals(props.getProperty(reference))) {
              props.setProperty(reference, path);
              helper.putProperties(propertiesFile, props);
          }
      }
      
  }
  
  
  
  1.1                  java/project/src/org/netbeans/spi/java/project/support/ui/BrokenReferencesSupport.java
  
  http://java.netbeans.org/source/browse/java/project/src/org/netbeans/spi/java/project/support/ui/BrokenReferencesSupport.java?rev=1.1&content-type=text/x-cvsweb-markup
  
  Index: BrokenReferencesSupport.java
  ===================================================================
  /*
   *                 Sun Public License Notice
   *
   * The contents of this file are subject to the Sun Public License
   * Version 1.0 (the "License"). You may not use this file except in
   * compliance with the License. A copy of the License is available at
   * http://www.sun.com/
   *
   * The Original Code is NetBeans. The Initial Developer of the Original
   * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
   * Microsystems, Inc. All Rights Reserved.
   */
  
  package org.netbeans.spi.java.project.support.ui;
  
  import java.awt.Dialog;
  import org.netbeans.modules.java.project.BrokenReferencesCustomizer;
  import org.netbeans.modules.java.project.BrokenReferencesModel;
  import org.netbeans.spi.project.support.ant.AntProjectHelper;
  import org.netbeans.spi.project.support.ant.PropertyEvaluator;
  import org.netbeans.spi.project.support.ant.ReferenceHelper;
  import org.openide.DialogDescriptor;
  import org.openide.DialogDisplayer;
  import org.openide.util.NbBundle;
  
  /**
   * Support for managing broken project references. Project freshly checkout from
   * VCS can has broken references of several types: reference to other project, 
   * reference to a foreign file, reference to an external source root, reference
   * to a Java Library or reference to a Java Platform. This class has helper
   * methods for detection of these problems and for fixing them.
   * <div class="nonnormative">
   * Typical usage of this class it to check whether the project has some broken
   * references and if it has then providing an action on project's node which
   * allows to correct these configuration problems by showing broken references
   * customizer.
   * </div>
   * @author David Konecny
   */
  public class BrokenReferencesSupport {
      
      private BrokenReferencesSupport() {}
  
      /**
       * Checks whether the project has some broken references or not.
       * @param evaluator property evaluator associated with the project
       * @param properties array of property names which values hold
       *    references which may be broken. For example for J2SE project
       *    the property names will be: "javac.classpath", "run.classpath", etc.
       * @param platform name of the platform used by the project or 
       *    "default_platform" if default platform is used
       * @return true if some problem was found and it is necessary to give
       *    user a chance to fix them
       */
      public static boolean isBroken(PropertyEvaluator evaluator, String[] properties, String platform) {
          return BrokenReferencesModel.isBroken(evaluator, properties, platform);
      }
      
      /**
       * Shows UI customizer which gives users chance to fix encountered problems.
       * @param projectHelper AntProjectHelper associated with the project.
       * @param referenceHelper ReferenceHelper associated with the project.
       * @param properties array of property names which values hold
       *    references which may be broken. For example for J2SE project
       *    the property names will be: "javac.classpath", "run.classpath", etc.
       * @param platform name of the platform used by the project or 
       *    "default_platform" if default platform is used
       */
      public static void showCustomizer(AntProjectHelper projectHelper, 
              ReferenceHelper referenceHelper, String[] properties, String platform) {
          BrokenReferencesModel model = new BrokenReferencesModel(projectHelper, referenceHelper, properties, platform);
          BrokenReferencesCustomizer customizer = new BrokenReferencesCustomizer(model);
          DialogDescriptor dd = new DialogDescriptor(customizer, 
              NbBundle.getMessage(BrokenReferencesCustomizer.class, "LBL_BrokenLinksCustomizer_Title"));
          Dialog dlg = null;
          try {
              dlg = DialogDisplayer.getDefault().createDialog(dd);
              dlg.setVisible(true);
          } finally {
              if (dlg != null)
                  dlg.dispose();
          }
      }
      
  }