Examples of IRuntimeClasspathEntry


Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

  /* (non-Javadoc)
   * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
   */
  public String getText(Object element) {
    IRuntimeClasspathEntry entry = (IRuntimeClasspathEntry)element;
    switch (entry.getType()) {
      case IRuntimeClasspathEntry.PROJECT:
        IResource res = entry.getResource();
        IJavaElement proj = JavaCore.create(res);
        if(proj == null) {
          return entry.getPath().lastSegment();
        }
        else {
          return lp.getText(proj);
        }
      case IRuntimeClasspathEntry.ARCHIVE:
        IPath path = entry.getPath();
        if (path == null) {
                    return MessageFormat.format("Invalid path: {0}", new Object[]{"null"}); //$NON-NLS-1$
                }
                if (!path.isAbsolute() || !path.isValidPath(path.toString())) {
          return MessageFormat.format("Invalid path: {0}", new Object[]{path.toOSString()});
        }
        String[] segments = path.segments();
        StringBuffer displayPath = new StringBuffer();
        if (segments.length > 0) {
          displayPath.append(segments[segments.length - 1]);
          displayPath.append(" - "); //$NON-NLS-1$
          String device = path.getDevice();
          if (device != null) {
            displayPath.append(device);
          }
          displayPath.append(File.separator);
          for (int i = 0; i < segments.length - 1; i++) {
            displayPath.append(segments[i]).append(File.separator);
          }
        } else {
          displayPath.append(path.toOSString());
        }
        return displayPath.toString();
      case IRuntimeClasspathEntry.VARIABLE:
        path = entry.getPath();
        IPath srcPath = entry.getSourceAttachmentPath();
        StringBuffer buf = new StringBuffer(path.toString());
        if (srcPath != null) {
          buf.append(" ["); //$NON-NLS-1$
          buf.append(srcPath.toString());
          IPath rootPath = entry.getSourceAttachmentRootPath();
          if (rootPath != null) {
            buf.append(IPath.SEPARATOR);
            buf.append(rootPath.toString());
          }
          buf.append(']');
        }
        // append JRE name if we can compute it
        if (path.equals(new Path(JavaRuntime.JRELIB_VARIABLE)) && fLaunchConfiguration != null) {
          try {
            IVMInstall vm = JavaRuntime.computeVMInstall(fLaunchConfiguration);
            buf.append(" - "); //$NON-NLS-1$
            buf.append(vm.getName());
          } catch (CoreException e) {
          }
        }
        return buf.toString();
      case IRuntimeClasspathEntry.CONTAINER:
        path = entry.getPath();
        if (fLaunchConfiguration != null) {
          try {
            IJavaProject project = null;
            try {
              project = JavaRuntime.getJavaProject(fLaunchConfiguration);
            } catch (CoreException e) {
            }
            if (project == null) {
            } else {
              IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), project);
              if (container != null) {
                if(container.getDescription().startsWith("Persisted container")){
                  return container.getPath().toString();
                }else{
                  return container.getDescription();
                }
              }
            }
          } catch (CoreException e) {
          }
        }
        return entry.getPath().toString();
      case IRuntimeClasspathEntry.OTHER:
        IRuntimeClasspathEntry delegate = entry;
        if (entry instanceof ClasspathEntry) {
          delegate = ((ClasspathEntry)entry).getDelegate();
        }
        String name = lp.getText(delegate);
        if (name == null || name.length() == 0) {
View Full Code Here

Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

      classPath =
          iConf.getAttribute(
              IJavaLaunchConfigurationConstants.ATTR_CLASSPATH,
              new ArrayList());
      IPath confIPath = new Path(confDir.getAbsolutePath());
      IRuntimeClasspathEntry cpEntry =
          JavaRuntime.newArchiveRuntimeClasspathEntry(confIPath);
      classPath.add(0, cpEntry.getMemento());
      iConf.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH,
          classPath);

    } catch (CoreException e) {
      e.printStackTrace();
View Full Code Here

Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

      List<String> classPath = new ArrayList<String>();
      IResource resource = type.getResource();
      IJavaProject project =
          (IJavaProject) resource.getProject().getNature(JavaCore.NATURE_ID);
      IRuntimeClasspathEntry cpEntry =
          JavaRuntime.newDefaultProjectClasspathEntry(project);
      classPath.add(0, cpEntry.getMemento());

      iConfWC.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH,
          classPath);

    } catch (CoreException e) {
View Full Code Here

Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

      classPath =
          iConf.getAttribute(
              IJavaLaunchConfigurationConstants.ATTR_CLASSPATH,
              new ArrayList());
      IPath confIPath = new Path(confDir.getAbsolutePath());
      IRuntimeClasspathEntry cpEntry =
          JavaRuntime.newArchiveRuntimeClasspathEntry(confIPath);
      classPath.add(0, cpEntry.getMemento());
      iConf.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH,
          classPath);
      iConf.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, mainPage.argumentsText.getText());

    } catch (CoreException e) {
View Full Code Here

Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

  public UserClassesClasspathModel createClasspathModel(ILaunchConfiguration configuration)
      throws Exception {
    UserClassesClasspathModel theModel= new UserClassesClasspathModel("Default Jetty Classpath","Custom Jetty Classpath");
    IRuntimeClasspathEntry[] entries= getClasspathProvider().computeUnresolvedJettyClasspath(configuration);
    for (int i = 0; i < entries.length; i++) {
      IRuntimeClasspathEntry entry = entries[i];
      switch (entry.getClasspathProperty()) {
        case IRuntimeClasspathEntry.USER_CLASSES:
          theModel.addEntry(UserClassesClasspathModel.USER, entry);
          break;
      }
    }
View Full Code Here

Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

      RunJettyRunClasspathUtil.filterWebInfLibs(JavaRuntime.computeUnresolvedRuntimeClasspath(proj),configuration);


    // Remove JRE entry/entries.

    IRuntimeClasspathEntry stdJreEntry = JavaRuntime
        .computeJREEntry(configuration);
    IRuntimeClasspathEntry projJreEntry = JavaRuntime.computeJREEntry(proj);
    List<IRuntimeClasspathEntry> entryList = new ArrayList<IRuntimeClasspathEntry>(
        entries.length);

    for (int i = 0; i < entries.length; i++) {
      IRuntimeClasspathEntry entry = entries[i];
      if (entry.equals(stdJreEntry))
        continue;
      if (entry.equals(projJreEntry))
        continue;
      entryList.add(entry);
    }

    // Resolve the entries to actual file/folder locations.

    entries = entryList.toArray(new IRuntimeClasspathEntry[0]);

    entries = RunJettyRunClasspathResolver.resolveClasspath(entries, configuration);

    // entries = JavaRuntime.resolveRuntimeClasspath(entries,
    // configuration);

    Set<String> locations = new LinkedHashSet<String>();
    for (int i = 0; i < entries.length; i++) {
      IRuntimeClasspathEntry entry = entries[i];
      if (entry.getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) {
        String location = entry.getLocation();
        if (location != null) {
          locations.add(location);
        }
      }
    }
View Full Code Here

Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

    return false;
  }
  private Set<String> searchUserClass(IRuntimeClasspathEntry[] entries) {
    Set<String> locations = new LinkedHashSet<String>();
    for (int i = 0; i < entries.length; i++) {
      IRuntimeClasspathEntry entry = entries[i];
      if (entry.getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) {
        String location = entry.getLocation();
        if (location != null) {
          locations.add(location);
        }
      }
    }
View Full Code Here

Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

      RunJettyRunClasspathUtil.filterWebInfLibs(JavaRuntime.computeUnresolvedRuntimeClasspath(proj),configuration);


    // Remove JRE entry/entries.

    IRuntimeClasspathEntry stdJreEntry = JavaRuntime
        .computeJREEntry(configuration);
    IRuntimeClasspathEntry projJreEntry = JavaRuntime.computeJREEntry(proj);
    List<IRuntimeClasspathEntry> entryList = new ArrayList<IRuntimeClasspathEntry>(
        entries.length);

    for (int i = 0; i < entries.length; i++) {
      IRuntimeClasspathEntry entry = entries[i];
      if (entry.equals(stdJreEntry))
        continue;
      if (entry.equals(projJreEntry))
        continue;
      entryList.add(entry);
    }

    // Resolve the entries to actual file/folder locations.

    entries = entryList.toArray(new IRuntimeClasspathEntry[0]);

    entries = RunJettyRunClasspathResolver.resolveClasspath(entries, configuration);

    // entries = JavaRuntime.resolveRuntimeClasspath(entries,
    // configuration);

    Set<String> locations = new LinkedHashSet<String>();
    for (int i = 0; i < entries.length; i++) {
      IRuntimeClasspathEntry entry = entries[i];
      if (entry.getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) {
        String location = entry.getLocation();
        if (location != null) {
          locations.add(location);
        }
      }
    }
View Full Code Here

Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

      for (File f : flibs.listFiles()) {
        if(f.getName().endsWith(".jar")){
        try {
          URL file = new URL(installUrl, libpath+"/"+f.getName());
          URL fileUrl = FileLocator.toFileURL(file);
          IRuntimeClasspathEntry rcpe = JavaRuntime
              .newArchiveRuntimeClasspathEntry(new Path(fileUrl
                  .getFile()));
          entries.add(rcpe);
        } catch (IOException e) {
          Plugin.logError(e);
View Full Code Here

Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

  private void addArchiveEntry(List<IRuntimeClasspathEntry> entries,
      URL bundleUrl) {

    try {
      URL fileUrl = FileLocator.toFileURL(bundleUrl);
      IRuntimeClasspathEntry rcpe = JavaRuntime
          .newArchiveRuntimeClasspathEntry(new Path(fileUrl.getFile()));
      entries.add(rcpe);
      return;
    } catch (IOException e) {
      Plugin.logError(e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.