当前位置: 首页>>代码示例>>Java>>正文


Java IClasspathContainer.getClasspathEntries方法代码示例

本文整理汇总了Java中org.eclipse.jdt.core.IClasspathContainer.getClasspathEntries方法的典型用法代码示例。如果您正苦于以下问题:Java IClasspathContainer.getClasspathEntries方法的具体用法?Java IClasspathContainer.getClasspathEntries怎么用?Java IClasspathContainer.getClasspathEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.core.IClasspathContainer的用法示例。


在下文中一共展示了IClasspathContainer.getClasspathEntries方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hasChanges

import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
public boolean hasChanges(IClasspathContainer oldContainer) {
	if (oldContainer == null || (oldContainer.getKind() == IClasspathContainer.K_SYSTEM) != fIsSystemLibrary) {
		return true;
	}
	IClasspathEntry[] oldEntries= oldContainer.getClasspathEntries();
	if (fChildren.size() != oldEntries.length) {
		return true;
	}
	for (int i= 0; i < oldEntries.length; i++) {
		CPListElement child= fChildren.get(i);
		if (!child.getClasspathEntry().equals(oldEntries[i])) {
			return true;
		}
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:CPUserLibraryElement.java

示例2: getAppEngineServerRuntimeClasspathEntries

import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
static IClasspathEntry[] getAppEngineServerRuntimeClasspathEntries(IProject project) {
  IJavaProject javaProject = JavaCore.create(project);
  IPath containerPath = new Path(
      "org.eclipse.jst.server.core.container/com.google.cloud.tools.eclipse.appengine.standard.runtimeClasspathProvider");
  try {
    for (IClasspathEntry entry : javaProject.getRawClasspath()) {
      if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER
          && containerPath.isPrefixOf(entry.getPath())) {
        // resolve and return the entries
        IClasspathContainer container =
            JavaCore.getClasspathContainer(entry.getPath(), javaProject);
        return container.getClasspathEntries();
      }
    }
  } catch (JavaModelException ex) {
    fail(ex.toString());
    /* NOTREACHED */
  }
  fail("AppEngine Server Runtime classpath container not found");
  return null;
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:22,代码来源:NewMavenBasedAppEngineProjectWizardTest.java

示例3: convertContainer

import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
private static void convertContainer(IClasspathEntry entry, IJavaProject project, Map<IPath, String> oldLocationMap) {
	try {
		IClasspathContainer container= JavaCore.getClasspathContainer(entry.getPath(), project);
		if (container == null) {
			return;
		}

		IClasspathEntry[] entries= container.getClasspathEntries();
		boolean hasChange= false;
		for (int i= 0; i < entries.length; i++) {
			IClasspathEntry curr= entries[i];
			IClasspathEntry updatedEntry= getConvertedEntry(curr, project, oldLocationMap);
			if (updatedEntry != null) {
				entries[i]= updatedEntry;
				hasChange= true;
			}
		}
		if (hasChange) {
			BuildPathSupport.requestContainerUpdate(project, container, entries);
		}
	} catch (CoreException e) {
		// ignore
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:JavaDocLocations.java

示例4: updateContainerClasspath

import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
private static void updateContainerClasspath(IJavaProject jproject, IPath containerPath, IClasspathEntry newEntry, String[] changedAttributes, IProgressMonitor monitor) throws CoreException {
	IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, jproject);
	if (container == null) {
		throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, IStatus.ERROR, "Container " + containerPath + " cannot be resolved", null));  //$NON-NLS-1$//$NON-NLS-2$
	}
	IClasspathEntry[] entries= container.getClasspathEntries();
	IClasspathEntry[] newEntries= new IClasspathEntry[entries.length];
	for (int i= 0; i < entries.length; i++) {
		IClasspathEntry curr= entries[i];
		if (curr.getEntryKind() == newEntry.getEntryKind() && curr.getPath().equals(newEntry.getPath())) {
			newEntries[i]= getUpdatedEntry(curr, newEntry, changedAttributes, jproject);
		} else {
			newEntries[i]= curr;
		}
	}
	requestContainerUpdate(jproject, container, newEntries);
	monitor.worked(1);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:BuildPathSupport.java

示例5: CPUserLibraryElement

import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
public CPUserLibraryElement(String name, IClasspathContainer container, IJavaProject project) {
	fName= name;
	fChildren= new ArrayList<CPListElement>();
	if (container != null) {
		IClasspathEntry[] entries= container.getClasspathEntries();
		CPListElement[] res= new CPListElement[entries.length];
		for (int i= 0; i < res.length; i++) {
			IClasspathEntry curr= entries[i];
			CPListElement elem= CPListElement.createFromExisting(this, curr, project);
			//elem.setAttribute(CPListElement.SOURCEATTACHMENT, curr.getSourceAttachmentPath());
			//elem.setAttribute(CPListElement.JAVADOC, JavaUI.getLibraryJavadocLocation(curr.getPath()));
			fChildren.add(elem);
		}
		fIsSystemLibrary= container.getKind() == IClasspathContainer.K_SYSTEM;
	} else {
		fIsSystemLibrary= false;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:CPUserLibraryElement.java

示例6: findEntryInContainer

import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
public static IClasspathEntry findEntryInContainer(IClasspathContainer container, IPath libPath) {
  if (container == null || libPath == null) {
    return null;
  }
  for (IClasspathEntry cpe : container.getClasspathEntries()) {
    IClasspathEntry resolved = JavaCore.getResolvedClasspathEntry(cpe);
    if (resolved != null && libPath.equals(resolved.getPath())) {
      return cpe;
    }
  }
  return null;
}
 
开发者ID:fbricon,项目名称:pde.source.lookup,代码行数:13,代码来源:ClasspathUtils.java

示例7: testGetClasspathEntries

import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
public void testGetClasspathEntries() throws JavaModelException {
  IClasspathEntry[] expectedCpEntries = specificRuntime.getClasspathEntries();
  IClasspathContainer specificRuntimeContainer = getClasspathContainer(
      specificRuntime, getTestProject(), SdkClasspathContainer.Type.NAMED);
  IClasspathEntry[] actualCpEntries = specificRuntimeContainer.getClasspathEntries();
  assertEquals(expectedCpEntries.length, actualCpEntries.length);

  for (int i = 0; i < actualCpEntries.length; i++) {
    assertEquals(expectedCpEntries[i].getPath(), actualCpEntries[i].getPath());
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:12,代码来源:GWTRuntimeContainerTest.java

示例8: updateClasspathContainer

import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
@Override
protected SdkClasspathContainer<GwtSdk> updateClasspathContainer(IPath containerPath, GwtSdk sdk, String description,
    IJavaProject project, IClasspathContainer containerSuggestion) {

  // TODO: Persist the changes to the container

  return new GWTRuntimeContainer(containerPath, sdk, containerSuggestion.getClasspathEntries(), description);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:9,代码来源:GWTRuntimeContainerInitializer.java

示例9: findEntryInContainer

import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
/**
 * Finds an entry in a container. <code>null</code> is returned if the entry can not be found
 * @param container The container
 * @param libPath The path of the library to be found
 * @return IClasspathEntry A classpath entry from the container of
 * <code>null</code> if the container can not be modified.
 */
public static IClasspathEntry findEntryInContainer(IClasspathContainer container, IPath libPath) {
	IClasspathEntry[] entries= container.getClasspathEntries();
	for (int i= 0; i < entries.length; i++) {
		IClasspathEntry curr= entries[i];
		IClasspathEntry resolved= JavaCore.getResolvedClasspathEntry(curr);
		if (resolved != null && libPath.equals(resolved.getPath())) {
			return curr; // return the real entry
		}
	}
	return null; // attachment not possible
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:JavaModelUtil.java

示例10: removeSystemContainers

import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
private void removeSystemContainers(List<IClasspathEntry> resolvedClasspath) throws JavaModelException {
	IClasspathEntry[] rawClasspath = project.getRawClasspath();
	
	for (IClasspathEntry classpathEntry : rawClasspath) {
		if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
			IClasspathContainer container = JavaCore.getClasspathContainer(classpathEntry.getPath(), project);
			if (container.getKind() != IClasspathContainer.K_APPLICATION) {
				for (IClasspathEntry containerEntry : container.getClasspathEntries()) {
					resolvedClasspath.remove(containerEntry);
				}
			}
		}
	}
}
 
开发者ID:tsvetan-stoyanov,项目名称:launchpi,代码行数:15,代码来源:ClasspathResolver.java

示例11: getFramework

import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
/**
 * Attempts to determine the framework based on the contents and nature of
 * the project. Returns null if no framework was determined.
 * @param project
 * @return Framework type or null if framework was not determined.
 * @deprecated kept for reference as to how application type was being
 * determined from a Java project for legacy v1 CF servers. v2 Servers no
 * longer require a framework for an application, as frameworks have been
 * replaced with buildpacks.
 */
protected String getFramework(IProject project) {
	if (project != null) {
		IJavaProject javaProject = DockerFoundryProjectUtil.getJavaProject(project);
		if (javaProject != null) {
			if (DockerFoundryProjectUtil.hasNature(project, DockerFoundryConstants.GRAILS_NATURE)) {
				return DockerFoundryConstants.GRAILS;
			}

			// in case user has Grails projects without the nature
			// attached
			if (project.isAccessible() && project.getFolder("grails-app").exists() //$NON-NLS-1$
					&& project.getFile("application.properties").exists()) { //$NON-NLS-1$
				return DockerFoundryConstants.GRAILS;
			}

			IClasspathEntry[] entries;
			boolean foundSpringLibrary = false;
			try {
				entries = javaProject.getRawClasspath();
				for (IClasspathEntry entry : entries) {
					if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
						if (isLiftLibrary(entry)) {
							return DockerFoundryConstants.LIFT;
						}
						if (isSpringLibrary(entry)) {
							foundSpringLibrary = true;
						}
					}
					else if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
						IClasspathContainer container = JavaCore
								.getClasspathContainer(entry.getPath(), javaProject);
						if (container != null) {
							for (IClasspathEntry childEntry : container.getClasspathEntries()) {
								if (isLiftLibrary(childEntry)) {
									return DockerFoundryConstants.LIFT;
								}
								if (isSpringLibrary(childEntry)) {
									foundSpringLibrary = true;
								}
							}
						}
					}
				}
			}
			catch (JavaModelException e) {
				// Log the error but don't throw it again as there may be
				// other ways to detect the framework
				DockerFoundryPlugin.log(new Status(IStatus.WARNING, DockerFoundryPlugin.PLUGIN_ID,
						"Unexpected error during auto detection of application type", e)); //$NON-NLS-1$
			}

			if (DockerFoundryProjectUtil.isSpringProject(project)) {
				return DockerFoundryConstants.SPRING;
			}

			if (foundSpringLibrary) {
				return DockerFoundryConstants.SPRING;
			}
		}
	}
	return null;
}
 
开发者ID:osswangxining,项目名称:dockerfoundry,代码行数:73,代码来源:JavaWebApplicationDelegate.java

示例12: getChildProjects

import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
private void getChildProjects(IJavaProject jproject, Vector projects,
        boolean exportedOnly) {

    IClasspathEntry[] cpes = jproject.readRawClasspath();
    if (cpes != null) {
        for (int i = 0; i < cpes.length; i++) {
            IClasspathEntry cpe = JavaCore
                    .getResolvedClasspathEntry(cpes[i]);
            if (cpe == null) {
                System.err.println("Error: cpes[" + i + "]=" + cpes[i]
                        + " does not resolve");
                continue;
            }
            int kind = cpe.getEntryKind();
            String name = relPath(cpe.getPath());
            if (kind == IClasspathEntry.CPE_CONTAINER) {
                try {
                    IClasspathContainer container = JavaCore
                            .getClasspathContainer(cpe.getPath(), jproject);
                    if ((container.getKind() == IClasspathContainer.K_APPLICATION)
                            || (container.getKind() == IClasspathContainer.K_SYSTEM)) {
                        IClasspathEntry[] cpes2 = container
                                .getClasspathEntries();
                        for (int j = 0; j < cpes2.length; j++) {
                            IClasspathEntry cpe2 = cpes2[j];
                            int kind2 = cpe2.getEntryKind();
                            String name2 = relPath(cpe2.getPath());
                            if (name2 == null) {
                                System.err
                                        .println("invalid classpath entry: "
                                                + cpe2.toString());
                            } else {
                                if (kind2 == IClasspathEntry.CPE_PROJECT) {
                                    if (!exportedOnly || cpe2.isExported()) {
                                        if (!projects.contains(name2)) {
                                            IJavaProject jChildProject2 = jproject
                                                    .getJavaModel()
                                                    .getJavaProject(name2);
                                            projects.add(jChildProject2);
                                            getChildProjects(
                                                    jChildProject2,
                                                    projects, true);
                                        }
                                    }
                                }
                            }
                        }
                    }
                } catch (JavaModelException e) {
                }
            } else if (kind == IClasspathEntry.CPE_PROJECT) {
                if (name == null) {
                    System.err.println("invalid classpath entry: "
                            + cpe.toString());
                } else {
                    if (!exportedOnly || cpe.isExported()) {
                        if (!projects.contains(name)) {
                            IJavaProject jChildProject = jproject
                                    .getJavaModel().getJavaProject(name);
                            projects.add(jChildProject);
                            getChildProjects(jChildProject, projects, true);
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:thahn0720,项目名称:agui_eclipse_plugin,代码行数:69,代码来源:BuildFatJar.java

示例13: getChildProjects

import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
public void getChildProjects(Vector projects, boolean exportedOnly) {

        IClasspathEntry[] cpes = this.getRawClasspathEntries();
        if (cpes != null) {
            for (int i = 0; i < cpes.length; i++) {
                IClasspathEntry cpe = JavaCore
                        .getResolvedClasspathEntry(cpes[i]);
                if (cpe == null) {
                    System.err.println("Error: cpes[" + i + "]=" + cpes[i]
                            + " does not resolve");
                    continue;
                }
                int kind = cpe.getEntryKind();
                String name = relPath(cpe.getPath());
                if (kind == IClasspathEntry.CPE_CONTAINER) {
                    try {
                        IClasspathContainer container = JavaCore
                                .getClasspathContainer(cpe.getPath(), jproject);
                        if ((container.getKind() == IClasspathContainer.K_APPLICATION)
                                || (container.getKind() == IClasspathContainer.K_SYSTEM)) {
                            IClasspathEntry[] cpes2 = container
                                    .getClasspathEntries();
                            for (int j = 0; j < cpes2.length; j++) {
                                IClasspathEntry cpe2 = cpes2[j];
                                int kind2 = cpe2.getEntryKind();
                                String name2 = relPath(cpe2.getPath());
                                if (name2 == null) {
                                    System.err
                                            .println("invalid classpath entry: "
                                                    + cpe2.toString());
                                } else {
                                    if (kind2 == IClasspathEntry.CPE_PROJECT) {
                                        if (!exportedOnly || cpe2.isExported()) {
                                            if (!projects.contains(name2)) {
                                                IJavaProject jChildProject2 = jproject
                                                        .getJavaModel()
                                                        .getJavaProject(name2);
                                                JProjectConfiguration jpcChild2 = new JProjectConfiguration(
                                                        jChildProject2, null);
                                                projects.add(jpcChild2);
                                                jpcChild2.getChildProjects(
                                                        projects, true);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    } catch (JavaModelException e) {
                    }
                } else if (kind == IClasspathEntry.CPE_PROJECT) {
                    if (name == null) {
                        System.err.println("invalid classpath entry: "
                                + cpe.toString());
                    } else {
                        if (!exportedOnly || cpe.isExported()) {
                            if (!projects.contains(name)) {
                                IJavaProject jChildProject = jproject
                                        .getJavaModel().getJavaProject(name);
                                JProjectConfiguration jpcChild = new JProjectConfiguration(
                                        jChildProject, null);
                                projects.add(jpcChild);
                                jpcChild.getChildProjects(projects, true);
                            }
                        }
                    }
                }
            }
        }
    }
 
开发者ID:thahn0720,项目名称:agui_eclipse_plugin,代码行数:71,代码来源:JProjectConfiguration.java

示例14: containerPutIfInitializingWithSameEntries

import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
public boolean containerPutIfInitializingWithSameEntries(
    IPath containerPath, IJavaProject[] projects, IClasspathContainer[] respectiveContainers) {
  int projectLength = projects.length;
  if (projectLength != 1) return false;
  final IClasspathContainer container = respectiveContainers[0];
  IJavaProject project = projects[0];
  //        // optimize only if initializing, otherwise we are in a regular setContainer(...) call
  if (!containerIsInitializationInProgress(project, containerPath)) return false;
  IClasspathContainer previousContainer =
      containerGetDefaultToPreviousSession(project, containerPath);
  if (container == null) {
    if (previousContainer == null) {
      containerPut(project, containerPath, null);
      return true;
    }
    return false;
  }
  final IClasspathEntry[] newEntries = container.getClasspathEntries();
  if (previousContainer == null)
    if (newEntries.length == 0) {
      containerPut(project, containerPath, container);
      return true;
    } else {
      if (CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE)
        verbose_missbehaving_container(
            containerPath,
            projects,
            respectiveContainers,
            container,
            newEntries,
            null /*no old entries*/);
      return false;
    }
  final IClasspathEntry[] oldEntries = previousContainer.getClasspathEntries();
  if (oldEntries.length != newEntries.length) {
    if (CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE)
      verbose_missbehaving_container(
          containerPath, projects, respectiveContainers, container, newEntries, oldEntries);
    return false;
  }
  for (int i = 0, length = newEntries.length; i < length; i++) {
    if (newEntries[i] == null) {
      if (CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE)
        verbose_missbehaving_container(project, containerPath, newEntries);
      return false;
    }
    if (!newEntries[i].equals(oldEntries[i])) {
      if (CP_RESOLVE_VERBOSE || CP_RESOLVE_VERBOSE_FAILURE)
        verbose_missbehaving_container(
            containerPath, projects, respectiveContainers, container, newEntries, oldEntries);
      return false;
    }
  }
  containerPut(project, containerPath, container);
  return true;
}
 
开发者ID:eclipse,项目名称:che,代码行数:57,代码来源:JavaModelManager.java

示例15: CPListElement

import org.eclipse.jdt.core.IClasspathContainer; //导入方法依赖的package包/类
public CPListElement(Object parent, IJavaProject project, int entryKind, IPath path, boolean newElement, IResource res, IPath linkTarget) {
	fProject= project;

	fEntryKind= entryKind;
	fPath= path;
	fOrginalPath= newElement ? null : path;
	fLinkTarget= linkTarget;
	fOrginalLinkTarget= linkTarget;
	fChildren= new ArrayList<Object>();
	fResource= res;
	fIsExported= false;

	fIsMissing= false;
	fCachedEntry= null;
	fParentContainer= parent;

	switch (entryKind) {
		case IClasspathEntry.CPE_SOURCE:
			createAttributeElement(OUTPUT, null, true);
			createAttributeElement(INCLUSION, new Path[0], true);
			createAttributeElement(EXCLUSION, new Path[0], true);
			createAttributeElement(NATIVE_LIB_PATH, null, false);
			createAttributeElement(IGNORE_OPTIONAL_PROBLEMS, null, false);
			break;
		case IClasspathEntry.CPE_LIBRARY:
		case IClasspathEntry.CPE_VARIABLE:
			createAttributeElement(SOURCEATTACHMENT, null, true);
			createAttributeElement(JAVADOC, null, false);
			createAttributeElement(SOURCE_ATTACHMENT_ENCODING, null, false);
			createAttributeElement(NATIVE_LIB_PATH, null, false);
			createAttributeElement(ACCESSRULES, new IAccessRule[0], true);
			break;
		case IClasspathEntry.CPE_PROJECT:
			createAttributeElement(ACCESSRULES, new IAccessRule[0], true);
			createAttributeElement(COMBINE_ACCESSRULES, Boolean.FALSE, true); // not rendered
			createAttributeElement(NATIVE_LIB_PATH, null, false);
			break;
		case IClasspathEntry.CPE_CONTAINER:
			createAttributeElement(ACCESSRULES, new IAccessRule[0], true);
			try {
				IClasspathContainer container= JavaCore.getClasspathContainer(fPath, fProject);
				if (container != null) {
					IClasspathEntry[] entries= container.getClasspathEntries();
					if (entries != null) { // catch invalid container implementation
						for (int i= 0; i < entries.length; i++) {
							IClasspathEntry entry= entries[i];
							if (entry != null) {
								CPListElement curr= createFromExisting(this, entry, fProject);
								fChildren.add(curr);
							} else {
								JavaPlugin.logErrorMessage("Null entry in container '" + fPath + "'");  //$NON-NLS-1$//$NON-NLS-2$
							}
						}
					} else {
						JavaPlugin.logErrorMessage("container returns null as entries: '" + fPath + "'");  //$NON-NLS-1$//$NON-NLS-2$
					}
				}
			} catch (JavaModelException e) {
			}
			createAttributeElement(NATIVE_LIB_PATH, null, false);
			break;
		default:
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:65,代码来源:CPListElement.java


注:本文中的org.eclipse.jdt.core.IClasspathContainer.getClasspathEntries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。