Java Code Examples for org.eclipse.jdt.core.JavaCore#newVariableEntry()
The following examples show how to use
org.eclipse.jdt.core.JavaCore#newVariableEntry() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaUtils.java From developer-studio with Apache License 2.0 | 5 votes |
public static IClasspathEntry createClassPathEntry(IPath path) { IClasspathEntry newLibraryEntry; if (path.toFile().exists()){ newLibraryEntry = JavaCore.newLibraryEntry(path, null, null,true); }else{ //Assume it is a variable contained entry newLibraryEntry = JavaCore.newVariableEntry(path, null, null,true); } return newLibraryEntry; }
Example 2
Source File: NewJavaProjectPreferencePage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private static IClasspathEntry getJREVariableEntry() { return JavaCore.newVariableEntry(new Path("JRE_LIB"), new Path("JRE_SRC"), new Path("JRE_SRCROOT")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ }
Example 3
Source File: IDECPListElement.java From birt with Eclipse Public License 1.0 | 4 votes |
private IClasspathEntry newClasspathEntry( ) { IClasspathAttribute[] extraAttributes = new IClasspathAttribute[0]; switch ( fEntryKind ) { case IClasspathEntry.CPE_SOURCE : return JavaCore.newSourceEntry( fPath, null, null, null, extraAttributes ); case IClasspathEntry.CPE_LIBRARY : { return JavaCore.newLibraryEntry( fPath, null, null, null, extraAttributes, isExported( ) ); } case IClasspathEntry.CPE_PROJECT : { return JavaCore.newProjectEntry( fPath, null, false, extraAttributes, isExported( ) ); } case IClasspathEntry.CPE_CONTAINER : { return JavaCore.newContainerEntry( fPath, null, extraAttributes, isExported( ) ); } case IClasspathEntry.CPE_VARIABLE : { return JavaCore.newVariableEntry( fPath, null, null, null, extraAttributes, isExported( ) ); } default : return null; } }
Example 4
Source File: JavaProjectHelper.java From spotbugs with GNU Lesser General Public License v2.1 | 3 votes |
/** * Adds a variable entry with source attachment to a IJavaProject. Can * return null if variable can not be resolved. * * @param jproject * The parent project * @param path * The variable path * @param sourceAttachPath * The source attachment path (variable path) * @param sourceAttachRoot * The source attachment root path (variable path) * @return The added package fragment root * @throws JavaModelException */ public static IPackageFragmentRoot addVariableEntry(IJavaProject jproject, IPath path, IPath sourceAttachPath, IPath sourceAttachRoot) throws JavaModelException { IClasspathEntry cpe = JavaCore.newVariableEntry(path, sourceAttachPath, sourceAttachRoot); addToClasspath(jproject, cpe); IPath resolvedPath = JavaCore.getResolvedVariablePath(path); if (resolvedPath != null) { return jproject.getPackageFragmentRoot(resolvedPath.toString()); } return null; }