This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 197627
Collapse All | Expand All

(-)a/java.api.common/src/org/netbeans/modules/java/api/common/project/ui/customizer/EditMediator.java (-3 / +4 lines)
Lines 361-374 Link Here
361
        }
361
        }
362
        else if ( source == addLibrary ) {
362
        else if ( source == addLibrary ) {
363
            //TODO this piece needs to go somewhere else?
363
            //TODO this piece needs to go somewhere else?
364
            URL librariesFolder = null;
364
            LibraryManager manager = null;
365
            LibraryManager manager = null;
365
            boolean empty = false;
366
            boolean empty = false;
366
            try {
367
            try {
367
                String path = libraryPath.getText(0, libraryPath.getLength());
368
                String path = libraryPath.getText(0, libraryPath.getLength());
368
                if (path != null && path.length() > 0) {
369
                if (path != null && path.length() > 0) {
369
                    File fil = PropertyUtils.resolveFile(FileUtil.toFile(helper.getProjectDirectory()), path);
370
                    File fil = PropertyUtils.resolveFile(FileUtil.toFile(helper.getProjectDirectory()), path);
370
                    URL url = FileUtil.normalizeFile(fil).toURI().toURL();
371
                    librariesFolder = FileUtil.normalizeFile(fil).toURI().toURL();
371
                    manager = LibraryManager.forLocation(url);
372
                    manager = LibraryManager.forLocation(librariesFolder);
372
                } else {
373
                } else {
373
                    empty = true;
374
                    empty = true;
374
                }
375
                }
Lines 387-393 Link Here
387
            }
388
            }
388
389
389
            Set<Library> added = LibraryChooser.showDialog(manager,
390
            Set<Library> added = LibraryChooser.showDialog(manager,
390
                    createLibraryFilter(), refHelper.getLibraryChooserImportHandler());
391
                    createLibraryFilter(), empty ? refHelper.getLibraryChooserImportHandler() : refHelper.getLibraryChooserImportHandler(librariesFolder));
391
            if (added != null) {
392
            if (added != null) {
392
                Set<Library> includedLibraries = new HashSet<Library>();
393
                Set<Library> includedLibraries = new HashSet<Library>();
393
               int[] newSelection = ClassPathUiSupport.addLibraries(listModel, list.getSelectedIndices(), 
394
               int[] newSelection = ClassPathUiSupport.addLibraries(listModel, list.getSelectedIndices(), 
(-)a/project.ant/apichanges.xml (+16 lines)
Lines 108-113 Link Here
108
108
109
    <changes>
109
    <changes>
110
110
111
        <change id="ReferenceHelper-getLibraryChooserImportHandler-url">
112
            <api name="general"/>
113
            <summary>Added <code>getLibraryChooserImportHandler</code> method into <code>ReferenceHelper</code> accepting <code>URL</code></summary>
114
            <version major="1" minor="41"/>
115
            <date day="15" month="4" year="2011"/>
116
            <author login="tzezula"/>
117
            <compatibility addition="yes"/>
118
            <description>
119
                <p>
120
                   A new method enables a client to specify target folder different from <code>AntProjectHelper.getLibrariesLocation</code>
121
                </p>
122
            </description>
123
            <class package="org.netbeans.spi.project.support.ant" name="ReferenceHelper"/>
124
            <issue number=""/>
125
        </change>
126
111
        <change id="SourcesHelper-SourceGroupModifierImplementation">
127
        <change id="SourcesHelper-SourceGroupModifierImplementation">
112
            <api name="general"/>
128
            <api name="general"/>
113
            <summary>Added <code>SourceGroupModifierImplementation</code> implementation for Ant-based projects</summary>
129
            <summary>Added <code>SourceGroupModifierImplementation</code> implementation for Ant-based projects</summary>
(-)a/project.ant/manifest.mf (-1 / +1 lines)
Lines 1-6 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.project.ant/1
2
OpenIDE-Module: org.netbeans.modules.project.ant/1
3
OpenIDE-Module-Specification-Version: 1.40
3
OpenIDE-Module-Specification-Version: 1.41
4
OpenIDE-Module-Layer: org/netbeans/modules/project/ant/resources/mf-layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/project/ant/resources/mf-layer.xml
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/project/ant/Bundle.properties
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/project/ant/Bundle.properties
6
OpenIDE-Module-Install: org/netbeans/modules/project/ant/AntProjectModule.class
6
OpenIDE-Module-Install: org/netbeans/modules/project/ant/AntProjectModule.class
(-)a/project.ant/src/org/netbeans/spi/project/support/ant/ReferenceHelper.java (-3 / +27 lines)
Lines 49-54 Link Here
49
import java.net.MalformedURLException;
49
import java.net.MalformedURLException;
50
import java.net.URI;
50
import java.net.URI;
51
import java.net.URISyntaxException;
51
import java.net.URISyntaxException;
52
import java.net.URL;
52
import java.util.ArrayList;
53
import java.util.ArrayList;
53
import java.util.Arrays;
54
import java.util.Arrays;
54
import java.util.HashMap;
55
import java.util.HashMap;
Lines 62-67 Link Here
62
import java.util.logging.Logger;
63
import java.util.logging.Logger;
63
import java.util.regex.Matcher;
64
import java.util.regex.Matcher;
64
import java.util.regex.Pattern;
65
import java.util.regex.Pattern;
66
import org.netbeans.api.annotations.common.NonNull;
65
import org.netbeans.api.project.Project;
67
import org.netbeans.api.project.Project;
66
import org.netbeans.api.project.ProjectManager;
68
import org.netbeans.api.project.ProjectManager;
67
import org.netbeans.api.project.ProjectUtils;
69
import org.netbeans.api.project.ProjectUtils;
Lines 1554-1562 Link Here
1554
            return lib;
1556
            return lib;
1555
        }
1557
        }
1556
        File mainPropertiesFile = h.resolveFile(h.getLibrariesLocation());
1558
        File mainPropertiesFile = h.resolveFile(h.getLibrariesLocation());
1557
        return ProjectLibraryProvider.copyLibrary(lib, mainPropertiesFile.toURI().toURL(), true);
1559
        return copyLibrary(lib, mainPropertiesFile.toURI().toURL());
1558
    }
1560
    }
1559
    
1561
        
1560
    /**
1562
    /**
1561
     * Returns library import handler which imports global library to sharable
1563
     * Returns library import handler which imports global library to sharable
1562
     * one. See {@link LibraryChooser#showDialog} for usage of this handler.
1564
     * one. See {@link LibraryChooser#showDialog} for usage of this handler.
Lines 1570-1575 Link Here
1570
            }
1572
            }
1571
        };        
1573
        };        
1572
    }
1574
    }
1575
1576
    /**
1577
     * Returns library import handler which imports global library to sharable
1578
     * one. See {@link LibraryChooser#showDialog} for usage of this handler.
1579
     * @param the URL of the libraries definition file to import the library into
1580
     * @return copy handler
1581
     * @since org.netbeans.modules.project.ant/1 1.41
1582
     */
1583
    public LibraryChooser.LibraryImportHandler getLibraryChooserImportHandler(final @NonNull URL librariesLocation) {
1584
        return new LibraryChooser.LibraryImportHandler() {
1585
            @Override
1586
            public Library importLibrary(final @NonNull Library library) throws IOException {
1587
                return copyLibrary(library, librariesLocation);
1588
            }
1589
        };
1590
    }
1591
1573
    /**
1592
    /**
1574
     * Tries to find a library by name in library manager associated with the project.
1593
     * Tries to find a library by name in library manager associated with the project.
1575
     * It is <em>not</em> guaranteed that any returned library is an identical object to one which passed in to {@link #createLibraryReference}.
1594
     * It is <em>not</em> guaranteed that any returned library is an identical object to one which passed in to {@link #createLibraryReference}.
Lines 1940-1944 Link Here
1940
        }
1959
        }
1941
        
1960
        
1942
    }
1961
    }
1943
    
1962
1963
    private static Library copyLibrary(final @NonNull Library lib, final @NonNull URL librariesLocation) throws IOException {
1964
        Parameters.notNull("lib", lib); //NOI18N
1965
        Parameters.notNull("librariesLocation", librariesLocation); //NOI18N
1966
        return ProjectLibraryProvider.copyLibrary(lib, librariesLocation, true);
1967
    }
1944
}
1968
}

Return to bug 197627