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 |
} |