Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.IClasspathEntry


  public String[] getClassPaths(IJavaProject javaProject, String projectLocation)
      throws JavaModelException {
    IClasspathEntry[] classPathEntries = javaProject.getRawClasspath();
    String[] classPaths = new String[classPathEntries.length + 1];
    for (int i = 0; i < classPathEntries.length; i++) {
      IClasspathEntry classPathEntry = classPathEntries[i];
      String classPathString = null;
      IPath outputPath = classPathEntry.getOutputLocation();
      if (outputPath != null) {
        classPathString = projectLocation + outputPath.toOSString();
      } else {
        IPath classPath = classPathEntry.getPath();
        classPathString = classPath.toOSString();
        if (!classPathString.startsWith(System.getProperty("file.separator"))) {
          classPathString = System.getProperty("file.separator") + classPathString;
        }
        classPathString = projectLocation + classPathString;
View Full Code Here


     
      Bundle bundle;
      URL pluginURL,jarURL,localURL;

      boolean add;
      IClasspathEntry icp=null;
      for (int j=0;j<arrL.size();j++){
        bundle=Platform.getBundle(CommonNames.CORE_PATH);
        pluginURL = bundle.getEntry("/");
        add=true;
        icp=(IClasspathEntry)arrL.get(j);
        //remove 'core' jars
        for (int i=0;i<elements_core.length;i++){
          jarURL= new URL(pluginURL,elements_core[i].getValue());
          localURL=Platform.asLocalURL(jarURL);
          if(((icp).equals(JavaCore.newLibraryEntry(new Path(localURL.getPath()), null, null)))||
              icp.getPath().toString().toLowerCase().endsWith("derby.jar")||
              icp.getPath().toString().toLowerCase().endsWith("derbynet.jar")||
              icp.getPath().toString().toLowerCase().endsWith("derbyclient.jar")||
              icp.getPath().toString().toLowerCase().endsWith("derbytools.jar")){
            add=false;
          }
        }
        if(!add){
          arrL.remove(j);
View Full Code Here

        List/* <IClasspathEntry> */entries = new ArrayList();
        NodeList children = cpEntries.getChildNodes();
        for (int i = 0; i < children.getLength(); i++) {
            Node item = children.item(i);
            if (item.getNodeName().equals(CPENTRY)) {
                IClasspathEntry cpEntry = readCpEntry(item);
                if (cpEntry != null) {
                    entries.add(cpEntry);
                }
            }
        }
View Full Code Here

            } else if (item.getNodeName().equals(ACCESS_RULES)) {
                accessRules = readAccessRules(item);
            }
        }

        IClasspathEntry entry;
        switch (kind) {
            case IClasspathEntry.CPE_PROJECT:
                entry = JavaCore.newProjectEntry(path, accessRules, true, cpAttrs, true);
                break;
            case IClasspathEntry.CPE_LIBRARY:
View Full Code Here

        addPage(containerPage);
    }

    public boolean performFinish() {
        containerPage.finish();
        IClasspathEntry newEntry = containerPage.getSelection();
        IPath path = newEntry.getPath();
        IJavaProject project = containerPage.getProject();
        try {
            IvyClasspathContainerImpl ivycp = new IvyClasspathContainerImpl(project, path,
                    new IClasspathEntry[0], new IClasspathAttribute[0]);
            JavaCore.setClasspathContainer(path, new IJavaProject[] {project},
View Full Code Here

            }

            try {
                boolean refresh = false;
                IvyClasspathContainerImpl ivycp = null;
                IClasspathEntry entry = IvyClasspathContainerHelper.getEntry(containerPath,
                    project);
                IClasspathAttribute[] attributes;
                boolean exported;
                if (entry != null) {
                    attributes = entry.getExtraAttributes();
                    exported = entry.isExported();
                } else {
                    exported = false;
                    attributes = new IClasspathAttribute[0];
                }
View Full Code Here

            final IClasspathAttribute[] attributes, final boolean exported, final IPath updatedPath) {
        Display.getDefault().asyncExec(new Runnable() {
            public void run() {
                try {
                    // update the classpath of the project by updating the IvyDE container
                    IClasspathEntry newEntry = JavaCore.newContainerEntry(updatedPath, null,
                        attributes, exported);
                    IClasspathEntry[] entries;
                    entries = project.getRawClasspath();
                    List newEntries = new ArrayList(Arrays.asList(entries));
                    for (int i = 0; i < newEntries.size(); i++) {
                        IClasspathEntry e = (IClasspathEntry) newEntries.get(i);
                        if (e == entry) {
                            newEntries.set(i, newEntry);
                            break;
                        }
                    }
View Full Code Here

            cpes = ivycp.getClasspathEntries();
        }
        List resolved = new ArrayList(cpes.length);
        List projects = new ArrayList();
        for (int i = 0; i < cpes.length; i++) {
            IClasspathEntry cpe = cpes[i];
            if (cpe.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
                IProject p = ResourcesPlugin.getWorkspace().getRoot()
                        .getProject(cpe.getPath().segment(0));
                IJavaProject jp = JavaCore.create(p);
                if (!projects.contains(jp)) {
                    projects.add(jp);
                    IRuntimeClasspathEntry classpath = JavaRuntime
                            .newProjectRuntimeClasspathEntry(jp);
                    resolved.add(classpath);
                    IRuntimeClasspathEntry[] entries = JavaRuntime.resolveRuntimeClasspathEntry(
                        classpath, jp);
                    for (int j = 0; j < entries.length; j++) {
                        IRuntimeClasspathEntry e = entries[j];
                        if (!resolved.contains(e)) {
                            resolved.add(entries[j]);
                        }
                    }
                }
            } else if (cpe.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
                IRuntimeClasspathEntry e = JavaRuntime.newArchiveRuntimeClasspathEntry(cpe
                        .getPath());
                if (!resolved.contains(e)) {
                    resolved.add(e);
                }
            }
View Full Code Here

        Properties newProps = new Properties();

        IClasspathEntry[] newEntries = containerSuggestion.getClasspathEntries();
        for (int i = 0; i < newEntries.length; i++) {
            IClasspathEntry entry = newEntries[i];
            if (IClasspathEntry.CPE_LIBRARY == entry.getEntryKind()) {
                String path = entry.getPath().toPortableString();
                if (entry.getSourceAttachmentPath() != null) {
                    newProps.put(path + SRC_SUFFIX, entry.getSourceAttachmentPath()
                            .toPortableString());
                }
                if (entry.getSourceAttachmentRootPath() != null) {
                    newProps.put(path + SRCROOT_SUFFIX, entry.getSourceAttachmentRootPath()
                            .toPortableString());
                }
                String javadocUrl = getJavadocLocation(entry);
                if (javadocUrl != null) {
                    newProps.put(path + DOC_SUFFIX, javadocUrl);
                }
            }
        }

        IvyClasspathContainerImpl ivycp = (IvyClasspathContainerImpl) IvyClasspathContainerHelper
                .getContainer(containerPath, project);
        if (ivycp == null) {
            IvyDEMessage
                    .error("The IvyDE container could not be found. Aborting updating attachements.");
            // something wrong happened, give up
            return;
        }
        IClasspathEntry[] existingEntries = ivycp.getClasspathEntries();
        for (int i = 0; i < existingEntries.length; i++) {
            IClasspathEntry entry = existingEntries[i];
            if (IClasspathEntry.CPE_LIBRARY == entry.getEntryKind()) {
                String path = entry.getPath().toPortableString();
                String value = (String) prop.get(path + SRC_SUFFIX);
                if (value != null && entry.getSourceAttachmentPath() != null
                        && value.equals(entry.getSourceAttachmentPath().toPortableString())) {
                    newProps.remove(path + SRC_SUFFIX);
                }
                value = (String) prop.get(path + SRCROOT_SUFFIX);
                if (value != null && entry.getSourceAttachmentRootPath() != null
                        && value.equals(entry.getSourceAttachmentRootPath().toPortableString())) {
                    newProps.remove(path + SRCROOT_SUFFIX);
                }
            }
        }
View Full Code Here

     * @param cpc
     *            the container to transform into an IvyClasspathContainer
     * @return the IvyClasspathContainer is such, null, if not
     */
    public static IvyClasspathContainerImpl jdt2IvyCPC(ClassPathContainer cpc) {
        IClasspathEntry entry = cpc.getClasspathEntry();
        try {
            IClasspathContainer icp = JavaCore.getClasspathContainer(entry.getPath(),
                cpc.getJavaProject());
            if (icp instanceof IvyClasspathContainerImpl) {
                return (IvyClasspathContainerImpl) icp;
            }
        } catch (JavaModelException e) {
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.IClasspathEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.