private void saveLibrariesLocation() throws IOException, IllegalArgumentException { try { String str = SHARED_LIBRARIES_MODEL.getText(0, SHARED_LIBRARIES_MODEL.getLength()).trim(); if (str.length() == 0) { str = null; } String old = project.getAntProjectHelper().getLibrariesLocation(); if ((old == null && str == null) || (old != null && old.equals(str))) { //ignore, nothing changed.. } else { project.getAntProjectHelper().setLibrariesLocation(str); ProjectManager.getDefault().saveProject(project); } } catch (BadLocationException x) { Exceptions.printStackTrace(x); } }
private void saveLibrariesLocation() throws IOException, IllegalArgumentException { try { String str = SHARED_LIBRARIES_MODEL.getText(0, SHARED_LIBRARIES_MODEL.getLength()).trim(); if (str.length() == 0) { str = null; } String old = project.getAntProjectHelper().getLibrariesLocation(); if ((old == null && str == null) || (old != null && old.equals(str))) { //ignore, nothing changed.. } else { project.getAntProjectHelper().setLibrariesLocation(str); ProjectManager.getDefault().saveProject(project); } } catch (BadLocationException x) { Exceptions.printStackTrace(x); } }
private void saveLibrariesLocation() throws IOException, IllegalArgumentException { try { String str = SHARED_LIBRARIES_MODEL.getText(0, SHARED_LIBRARIES_MODEL.getLength()).trim(); if (str.length() == 0) { str = null; } String old = project.getAntProjectHelper().getLibrariesLocation(); if ((old == null && str == null) || (old != null && old.equals(str))) { //ignore, nothing changed.. } else { project.getAntProjectHelper().setLibrariesLocation(str); ProjectManager.getDefault().saveProject(project); } } catch (BadLocationException x) { Exceptions.printStackTrace(x); } }
private void saveLibrariesLocation() throws IOException, IllegalArgumentException { try { String str = SHARED_LIBRARIES_MODEL.getText(0, SHARED_LIBRARIES_MODEL.getLength()).trim(); if (str.length() == 0) { str = null; } String old = project.getAntProjectHelper().getLibrariesLocation(); if ((old == null && str == null) || (old != null && old.equals(str))) { //ignore, nothing changed.. } else { project.getAntProjectHelper().setLibrariesLocation(str); ProjectManager.getDefault().saveProject(project); } } catch (BadLocationException x) { ErrorManager.getDefault().notify(x); } }
private void rememberLibraryLocation() { libraryWithinProject = false; absolutesRelPath = null; libraryPath = project.getAntProjectHelper().getLibrariesLocation(); if (libraryPath != null) { File prjRoot = FileUtil.toFile(project.getProjectDirectory()); libraryFile = PropertyUtils.resolveFile(prjRoot, libraryPath); if (FileOwnerQuery.getOwner(libraryFile.toURI()) == project && libraryFile.getAbsolutePath().startsWith(prjRoot.getAbsolutePath())) { //do not update the relative path if within the project.. libraryWithinProject = true; FileObject fo = FileUtil.toFileObject(libraryFile); if (new File(libraryPath).isAbsolute() && fo != null) { // if absolte path within project, it will get moved/copied.. absolutesRelPath = FileUtil.getRelativePath(project.getProjectDirectory(), fo); } } } }
private void rememberLibraryLocation() { libraryWithinProject = false; absolutesRelPath = null; libraryPath = project.getAntProjectHelper().getLibrariesLocation(); if (libraryPath != null) { File prjRoot = FileUtil.toFile(project.getProjectDirectory()); libraryFile = PropertyUtils.resolveFile(prjRoot, libraryPath); if (FileOwnerQuery.getOwner(libraryFile.toURI()) == project && libraryFile.getAbsolutePath().startsWith(prjRoot.getAbsolutePath())) { //do not update the relative path if within the project.. libraryWithinProject = true; FileObject fo = FileUtil.toFileObject(libraryFile); if (new File(libraryPath).isAbsolute() && fo != null) { // if absolte path within project, it will get moved/copied.. absolutesRelPath = FileUtil.getRelativePath(project.getProjectDirectory(), fo); } } } }
private void rememberLibraryLocation() { libraryWithinProject = false; absolutesRelPath = null; libraryPath = project.getAntProjectHelper().getLibrariesLocation(); if (libraryPath != null) { File prjRoot = FileUtil.toFile(project.getProjectDirectory()); libraryFile = PropertyUtils.resolveFile(prjRoot, libraryPath); if (FileOwnerQuery.getOwner(libraryFile.toURI()) == project && libraryFile.getAbsolutePath().startsWith(prjRoot.getAbsolutePath())) { //do not update the relative path if within the project.. libraryWithinProject = true; FileObject fo = FileUtil.toFileObject(libraryFile); if (new File(libraryPath).isAbsolute() && fo != null) { // if absolte path within project, it will get moved/copied.. absolutesRelPath = FileUtil.getRelativePath(project.getProjectDirectory(), fo); } } } }
private void librariesBrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_librariesBrowseActionPerformed if (!isSharable) { if (uiProperties.makeSharable()) { isSharable = true; sharedLibrariesLabel.setEnabled(true); librariesLocation.setEnabled(true); librariesLocation.setText(uiProperties.getProject().getAntProjectHelper().getLibrariesLocation()); Mnemonics.setLocalizedText(librariesBrowse, NbBundle.getMessage(CustomizerLibraries.class, "LBL_CustomizerLibraries_Browse_JButton")); // NOI18N updateJars(uiProperties.JAVAC_CLASSPATH_MODEL); updateJars(uiProperties.JAVAC_TEST_CLASSPATH_MODEL); updateJars(uiProperties.RUN_CLASSPATH_MODEL); updateJars(uiProperties.RUN_TEST_CLASSPATH_MODEL); switchLibrary(); } } else { File prjLoc = FileUtil.toFile(uiProperties.getProject().getProjectDirectory()); String s[] = splitPath(librariesLocation.getText().trim()); String loc = SharableLibrariesUtils.browseForLibraryLocation(s[0], this, prjLoc); if (loc != null) { librariesLocation.setText(s[1] != null ? loc + File.separator + s[1] : loc + File.separator + SharableLibrariesUtils.DEFAULT_LIBRARIES_FILENAME); switchLibrary(); } } }//GEN-LAST:event_librariesBrowseActionPerformed
String value = ahelper.getStandardPropertyEvaluator().evaluate(reference); File absFile = ahelper.resolveFile(value); String location = ahelper.getLibrariesLocation(); File libraryFile = ahelper.resolveFile(location); File directory = libraryFile.getParentFile();
private FileObject getSharedLibraryFolderLocation() { String libLoc = helper.getLibrariesLocation(); if (libLoc != null) { String libLocEval = evaluator.evaluate(libLoc); File file = null; if (libLocEval != null) { file = helper.resolveFile(libLocEval); } FileObject libLocFO = FileUtil.toFileObject(file); if (libLocFO != null) { //#126366 this can happen when people checkout the project but not the libraries description //that is located outside the project FileObject libLocParent = libLocFO.getParent(); return libLocParent; } } return null; }
private void librariesBrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_librariesBrowseActionPerformed if (!isSharable) { boolean result = makeSharable(uiProperties); if (result) { isSharable = true; sharedLibrariesLabel.setEnabled(true); librariesLocation.setEnabled(true); librariesLocation.setText(uiProperties.getProject().getAntProjectHelper().getLibrariesLocation()); Mnemonics.setLocalizedText(librariesBrowse, NbBundle.getMessage(CustomizerLibraries.class, "LBL_CustomizerLibraries_Browse_JButton")); // NOI18N updateJars(uiProperties.JAVAC_CLASSPATH_MODEL.getDefaultListModel()); updateJars(uiProperties.JAVAC_PROCESSORPATH_MODEL); updateJars(uiProperties.JAVAC_TEST_CLASSPATH_MODEL); updateJars(uiProperties.RUN_TEST_CLASSPATH_MODEL); updateJars(uiProperties.ENDORSED_CLASSPATH_MODEL); switchLibrary(); } } else { File prjLoc = FileUtil.toFile(uiProperties.getProject().getProjectDirectory()); String s[] = splitPath(librariesLocation.getText().trim()); String loc = SharableLibrariesUtils.browseForLibraryLocation(s[0], this, prjLoc); if (loc != null) { librariesLocation.setText(s[1] != null ? loc + File.separator + s[1] : loc + File.separator + SharableLibrariesUtils.DEFAULT_LIBRARIES_FILENAME); switchLibrary(); } } }//GEN-LAST:event_librariesBrowseActionPerformed
private void librariesBrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_librariesBrowseActionPerformed if (!isSharable) { boolean result = makeSharable(uiProperties); if (result) { isSharable = true; sharedLibrariesLabel.setEnabled(true); librariesLocation.setEnabled(true); librariesLocation.setText(uiProperties.getProject().getAntProjectHelper().getLibrariesLocation()); Mnemonics.setLocalizedText(librariesBrowse, NbBundle.getMessage(CustomizerLibraries.class, "LBL_CustomizerLibraries_Browse_JButton")); // NOI18N updateJars(uiProperties.JAVAC_CLASSPATH_MODEL.getDefaultListModel()); updateJars(uiProperties.JAVAC_PROCESSORPATH_MODEL); updateJars(uiProperties.JAVAC_TEST_CLASSPATH_MODEL); updateJars(uiProperties.RUN_TEST_CLASSPATH_MODEL); updateJars(uiProperties.ENDORSED_CLASSPATH_MODEL); switchLibrary(); } } else { File prjLoc = FileUtil.toFile(uiProperties.getProject().getProjectDirectory()); String s[] = splitPath(librariesLocation.getText().trim()); String loc = SharableLibrariesUtils.browseForLibraryLocation(s[0], this, prjLoc); if (loc != null) { librariesLocation.setText(s[1] != null ? loc + File.separator + s[1] : loc + File.separator + SharableLibrariesUtils.DEFAULT_LIBRARIES_FILENAME); switchLibrary(); } } }//GEN-LAST:event_librariesBrowseActionPerformed
private void librariesBrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_librariesBrowseActionPerformed if (!isSharable) { boolean result = makeSharable(uiProperties); if (result) { isSharable = true; sharedLibrariesLabel.setEnabled(true); librariesLocation.setEnabled(true); librariesLocation.setText(uiProperties.getProject().getAntProjectHelper().getLibrariesLocation()); Mnemonics.setLocalizedText(librariesBrowse, NbBundle.getMessage(CustomizerLibraries.class, "LBL_CustomizerLibraries_Browse_JButton")); // NOI18N updateJars(uiProperties.JAVAC_CLASSPATH_MODEL.getDefaultListModel()); updateJars(uiProperties.JAVAC_PROCESSORPATH_MODEL); updateJars(uiProperties.JAVAC_TEST_CLASSPATH_MODEL); updateJars(uiProperties.ENDORSED_CLASSPATH_MODEL); updateJars(uiProperties.RUN_TEST_CLASSPATH_MODEL); switchLibrary(); cleanupOldLibraryReferences(); } } else { File prjLoc = FileUtil.toFile(uiProperties.getProject().getProjectDirectory()); String s[] = splitPath(librariesLocation.getText().trim()); String loc = SharableLibrariesUtils.browseForLibraryLocation(s[0], this, prjLoc); if (loc != null) { librariesLocation.setText(s[1] != null ? loc + File.separator + s[1] : loc + File.separator + SharableLibrariesUtils.DEFAULT_LIBRARIES_FILENAME); switchLibrary(); } } }//GEN-LAST:event_librariesBrowseActionPerformed
if (helper.getLibrariesLocation() != null) { File f = helper.resolveFile(helper.getLibrariesLocation()); if (f != null && f.exists()) { FileObject libFolder = FileUtil.toFileObject(f).getParent();
if (helper.getLibrariesLocation() != null) { File f = helper.resolveFile(helper.getLibrariesLocation()); if (f != null && f.exists()) { FileObject libFolder = FileUtil.toFileObject(f).getParent();
if (helper.getLibrariesLocation() != null) { File f = helper.resolveFile(helper.getLibrariesLocation()); if (f != null && f.exists()) { FileObject libFolder = FileUtil.toFileObject(f).getParent();
@Messages("ERR_LibraryExists=The library {0} already exists, reusing the old definition.") public void actionPerformed(ActionEvent e) { String loc = helper.getLibrariesLocation(); assert loc != null; File mainPropertiesFile = helper.resolveFile(loc);
librariesBrowse.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerLibraries.class, "ACSD_MakeSharable")); } else { librariesLocation.setText(uiProperties.getProject().getAntProjectHelper().getLibrariesLocation());
private static void copyRequiredLibraries(AntProjectHelper h, ReferenceHelper rh) throws IOException { if (!h.isSharableProject()) { return; } if (rh.getProjectLibraryManager().getLibrary("junit") == null // NOI18N && LibraryManager.getDefault().getLibrary("junit") != null) { // NOI18N rh.copyLibrary(LibraryManager.getDefault().getLibrary("junit")); // NOI18N } if (rh.getProjectLibraryManager().getLibrary("junit_4") == null // NOI18N && LibraryManager.getDefault().getLibrary("junit_4") != null) { // NOI18N rh.copyLibrary(LibraryManager.getDefault().getLibrary("junit_4")); // NOI18N } if (rh.getProjectLibraryManager().getLibrary("CopyLibs") == null // NOI18N && LibraryManager.getDefault().getLibrary("CopyLibs") != null) { // NOI18N rh.copyLibrary(LibraryManager.getDefault().getLibrary("CopyLibs")); // NOI18N } if (rh.getProjectLibraryManager().getLibrary("JavaFX2Runtime") == null // NOI18N && LibraryManager.getDefault().getLibrary("JavaFX2Runtime") != null) { // NOI18N File mainPropertiesFile = h.resolveFile(h.getLibrariesLocation()); referenceLibrary(LibraryManager.getDefault().getLibrary("JavaFX2Runtime"), mainPropertiesFile.toURI().toURL(), true); //NOI18N } }
SHARED_LIBRARIES_MODEL = new PlainDocument(); try { SHARED_LIBRARIES_MODEL.insertString(0, project.getAntProjectHelper().getLibrariesLocation(), null); } catch (BadLocationException ex) { Exceptions.printStackTrace(ex);