private boolean initPath(IResource selection) { if (!WebAppUtilities.isWebApp(hostPageProject)) { return false; } IFolder container = null; try { IFolder warFolder = WebAppUtilities.getWarSrc(hostPageProject); // If the selection was a subfolder of war, initialize to that if (selection.getType() == IResource.FOLDER) { if (warFolder.getFullPath().isPrefixOf(selection.getFullPath())) { container = (IFolder) selection; return true; } } // Otherwise, use the war folder as the default path if (warFolder.exists()) { container = warFolder; return true; } return false; } finally { if (container != null) { pathField.setText(container.getFullPath().removeFirstSegments(1).toString()); } } }
public IClasspathEntry[] getClasspathEntriesFromWebInfLib(IProject project) { // Fix classpath warning during project generation // http://code.google.com/p/google-plugin-for-eclipse/issues/detail?id=14 IFolder webInfLibFolder = WebAppUtilities.getWebInfLib(project); IFile file = webInfLibFolder.getFile(AppsMarketplacePlugin.APPS_MARKETPLACE_JAR_NAME); if (file == null) { return getClasspathEntries(); } else { IPath jarPath = file.getFullPath(); IClasspathEntry[] entries = new IClasspathEntry[1]; entries[0] = JavaCore.newLibraryEntry(jarPath, null, null); return entries; } }