List of usage examples for org.eclipse.jdt.core IClasspathEntry CPE_LIBRARY
int CPE_LIBRARY
To view the source code for org.eclipse.jdt.core IClasspathEntry CPE_LIBRARY.
Click Source Link
From source file:org.eclipse.ant.internal.ui.datatransfer.EclipseClasspath.java
License:Open Source License
private void handleJars(IClasspathEntry entry) { if (entry.getContentKind() == IPackageFragmentRoot.K_BINARY && entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { String jarFile = entry.getPath().toString(); StringBuffer jarFileBuffer = new StringBuffer(); StringBuffer jarFileAbsoluteBuffer = new StringBuffer(); String jarFileAbsolute = ExportUtil.resolve(entry.getPath()); if (jarFileAbsolute == null) { jarFileAbsolute = jarFile; // jarFile was already absolute if (handleSubProjectClassesDirectory(jarFile, jarFileBuffer, jarFileAbsoluteBuffer)) { jarFile = jarFileBuffer.toString(); jarFileAbsolute = jarFileAbsoluteBuffer.toString(); }/*from w ww.j av a2 s . c o m*/ } String jarFileOld = jarFile; jarFile = ExportUtil.removeProjectRoot(jarFile, project.getProject()); if (jarFile.equals(jarFileOld)) { if (handleSubProjectClassesDirectory(jarFile, jarFileBuffer, jarFileAbsoluteBuffer)) { jarFile = jarFileBuffer.toString(); jarFileAbsolute = jarFileAbsoluteBuffer.toString(); } } rawClassPathEntries.add(jarFile); rawClassPathEntriesAbsolute.add(jarFileAbsolute); } }
From source file:org.eclipse.birt.report.debug.internal.ui.launcher.util.WorkspaceClassPathFinder.java
License:Open Source License
private List getExistingEntries(IClasspathEntry[] classpathEntries, IProject project) { ArrayList newClassPath = new ArrayList(); for (int i = 0; i < classpathEntries.length; i++) { IClasspathEntry curr = classpathEntries[i]; if (curr.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { try { boolean inWorkSpace = true; IWorkspace space = ResourcesPlugin.getWorkspace(); if (space == null || space.getRoot() == null) { inWorkSpace = false; }//w ww . j av a 2 s. co m IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IPath path = curr.getPath(); if (root.findMember(path) == null) { inWorkSpace = false; } if (inWorkSpace) { String absPath = getFullPath(path, root.findMember(path).getProject()); URL url = new URL("file:///" + absPath);//$NON-NLS-1$//file:/ newClassPath.add(url); } else { newClassPath.add(curr.getPath().toFile().toURL()); } } catch (MalformedURLException e) { // DO nothing } } } return newClassPath; }
From source file:org.eclipse.birt.report.designer.internal.ui.ide.adapters.IDEClassPathBlock.java
License:Open Source License
private void editElementEntry(IDECPListElement elem) { IDECPListElement[] res = null;/*from w w w .j a v a2 s.c om*/ switch (elem.getEntryKind()) { case IClasspathEntry.CPE_LIBRARY: IResource resource = elem.getResource(); if (resource == null) { File file = elem.getPath().toFile(); if (file.isDirectory()) { res = openExternalClassFolderDialog(elem); } else { res = openExtJarFileDialog(elem); } } else if (resource.getType() == IResource.FILE) { res = openJarFileDialog(elem); } break; case IClasspathEntry.CPE_VARIABLE: res = openVariableSelectionDialog(elem); break; } if (res != null && res.length > 0) { IDECPListElement curr = res[0]; curr.setExported(elem.isExported()); // curr.setAttributesFromExisting(elem); fLibrariesList.replaceElement(elem, curr); if (elem.getEntryKind() == IClasspathEntry.CPE_VARIABLE) { fLibrariesList.refresh(); } } }
From source file:org.eclipse.birt.report.designer.internal.ui.ide.adapters.IDEClassPathBlock.java
License:Open Source License
private IPath[] getUsedContainers(IDECPListElement existing) { ArrayList res = new ArrayList(); List cplist = fLibrariesList.getElements(); for (int i = 0; i < cplist.size(); i++) { IDECPListElement elem = (IDECPListElement) cplist.get(i); if (elem.getEntryKind() == IClasspathEntry.CPE_LIBRARY && (elem != existing)) { IResource resource = elem.getResource(); if (resource instanceof IContainer && !resource.equals(existing)) { res.add(resource.getFullPath()); }//from w w w . ja v a 2s. c o m } } return (IPath[]) res.toArray(new IPath[res.size()]); }
From source file:org.eclipse.birt.report.designer.internal.ui.ide.adapters.IDEClassPathBlock.java
License:Open Source License
private IPath[] getUsedJARFiles(IDECPListElement existing) { List res = new ArrayList(); List cplist = fLibrariesList.getElements(); for (int i = 0; i < cplist.size(); i++) { IDECPListElement elem = (IDECPListElement) cplist.get(i); if (elem.getEntryKind() == IClasspathEntry.CPE_LIBRARY && (elem != existing)) { IResource resource = elem.getResource(); if (resource instanceof IFile) { res.add(resource.getFullPath()); }/* w w w . j a va2s . co m*/ } } return (IPath[]) res.toArray(new IPath[res.size()]); }
From source file:org.eclipse.birt.report.designer.internal.ui.ide.adapters.IDEClassPathBlock.java
License:Open Source License
private static IDECPListElement newCPLibraryElement(IResource res) { return new IDECPListElement(IClasspathEntry.CPE_LIBRARY, res.getFullPath(), res); }
From source file:org.eclipse.birt.report.designer.internal.ui.ide.adapters.IDEClassPathBlock.java
License:Open Source License
private IDECPListElement[] openExtJarFileDialog(IDECPListElement existing) { if (existing == null) { IPath[] selected = BuildPathDialogAccess.chooseExternalJAREntries(getShell()); if (selected != null) { ArrayList res = new ArrayList(); for (int i = 0; i < selected.length; i++) { res.add(new IDECPListElement(IClasspathEntry.CPE_LIBRARY, selected[i], null)); }//w w w . j a va 2 s.com return (IDECPListElement[]) res.toArray(new IDECPListElement[res.size()]); } } else { IPath path = existing.getPath(); IPath configured = BuildPathDialogAccess.configureExternalJAREntry(getShell(), path); if (configured != null) { return new IDECPListElement[] { new IDECPListElement(IClasspathEntry.CPE_LIBRARY, configured, null) }; } } return null; }
From source file:org.eclipse.birt.report.designer.internal.ui.ide.adapters.IDEClassPathBlock.java
License:Open Source License
private IDECPListElement[] openExternalClassFolderDialog(IDECPListElement existing) { if (existing == null) { IPath[] selected = BuildPathDialogAccess.chooseExternalClassFolderEntries(getShell()); if (selected != null) { ArrayList res = new ArrayList(); for (int i = 0; i < selected.length; i++) { res.add(new IDECPListElement(IClasspathEntry.CPE_LIBRARY, selected[i], null)); }//from ww w .ja va 2s .c om return (IDECPListElement[]) res.toArray(new IDECPListElement[res.size()]); } } else { IPath configured = BuildPathDialogAccess.configureExternalClassFolderEntries(getShell(), existing.getPath()); if (configured != null) { return new IDECPListElement[] { new IDECPListElement(IClasspathEntry.CPE_LIBRARY, configured, null) }; } } return null; }
From source file:org.eclipse.birt.report.designer.internal.ui.ide.adapters.IDEClassPathBlock.java
License:Open Source License
public boolean isEntryKind(int kind) { return kind == IClasspathEntry.CPE_LIBRARY || kind == IClasspathEntry.CPE_PROJECT || kind == IClasspathEntry.CPE_VARIABLE || kind == IClasspathEntry.CPE_CONTAINER; }
From source file:org.eclipse.birt.report.designer.internal.ui.ide.adapters.IDEClassPathBlock.java
License:Open Source License
private static List readClassPathEntry(String value) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); List retValue = new ArrayList(); if (value == null || value.length() == 0) { return retValue; }//from w w w .j av a 2 s. co m StringTokenizer tokenizer = new StringTokenizer(value, ENTRY_SEPARATOR); // String[] entries = value.split( ENTRY_SEPARATOR ); while (tokenizer.hasMoreTokens()) { String entry = tokenizer.nextToken(); if (entry == null || entry.length() == 0) { continue; } StringTokenizer typeTokenizer = new StringTokenizer(entry, TYPE_SEPARATOR); // String[] types = entry.split( TYPE_SEPARATOR ); if (typeTokenizer.countTokens() != 3) { continue; } int init = 0; IPath path = null; int type = UNKNOW_TYPE; while (typeTokenizer.hasMoreTokens()) { String str = typeTokenizer.nextToken(); if (init == 1) { type = Integer.parseInt(str); } if (init == 2) { path = new Path(str); } init++; } if (type == JAR_TYPE || type == FOL_TYPE) { IResource resource = root.findMember(path); if (resource != null) { retValue.add(newCPLibraryElement(resource)); } } else if (type == EXTJAR_TYPE || type == ADDFOL_TYPE) { retValue.add(new IDECPListElement(IClasspathEntry.CPE_LIBRARY, path, null)); } else if (type == VAR_TYPE) { retValue.add(createCPVariableElement(path)); } else if (type == PROJECT_TYPE) { IResource resource = root.findMember(path); if (resource != null) { retValue.add( new IDECPListElement(IClasspathEntry.CPE_PROJECT, resource.getFullPath(), resource)); } } } return retValue; }