Examples of IRuntimeClasspathEntry


Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

  public void launch() throws CoreException{
    DerbyPlugin plugin = DerbyPlugin.getDefault();

    // constructs a classpath from the default JRE...
    IPath systemLibs = new Path(JavaRuntime.JRE_CONTAINER);
    IRuntimeClasspathEntry systemLibsEntry = JavaRuntime.newRuntimeContainerClasspathEntry(
      systemLibs, IRuntimeClasspathEntry.STANDARD_CLASSES);
    systemLibsEntry.setClasspathProperty(IRuntimeClasspathEntry.BOOTSTRAP_CLASSES);
    //include org.apache.derby.core plugin
    IRuntimeClasspathEntry derbyCPEntry = null;
    List classpath = new ArrayList();
    classpath.add(systemLibsEntry.getMemento());
   
    try {
      ManifestElement[] elements_core, elements_ui;
      elements_core = getElements(CommonNames.CORE_PATH);
      elements_ui=getElements(CommonNames.UI_PATH);
     
      Bundle bundle;
      URL pluginURL,jarURL,localURL;
      bundle=Platform.getBundle(CommonNames.CORE_PATH);
      pluginURL = bundle.getEntry("/");
      for(int i=0;i<elements_core.length;i++){
        if(!elements_core[i].getValue().toLowerCase().endsWith("derbynet.jar")){
          jarURL= new URL(pluginURL,elements_core[i].getValue());
          localURL=Platform.asLocalURL(jarURL);
          derbyCPEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(localURL.getPath()));
          derbyCPEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
          classpath.add(derbyCPEntry.getMemento());
        }
      }
      bundle=Platform.getBundle(CommonNames.CORE_PATH);
      pluginURL = bundle.getEntry("/");
      for(int i=0;i<elements_ui.length;i++){
        if(!elements_ui[i].getValue().toLowerCase().equals("ui.jar")){
          jarURL= new URL(pluginURL,elements_ui[i].getValue());
          localURL=Platform.asLocalURL(jarURL);
          derbyCPEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(localURL.getPath()));
          derbyCPEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
          classpath.add(derbyCPEntry.getMemento());
        }
      }
    }
    catch(Exception e) {
      e.printStackTrace();
View Full Code Here

Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

            // Creating the classpath list
            List<String> classpath = new ArrayList<String>();
            IPath apacheDsLibrariesFolder = ApacheDsPluginUtils.getApacheDsLibrariesFolder();
            for ( String library : ApacheDsPluginUtils.apachedsLibraries )
            {
                IRuntimeClasspathEntry libraryClasspathEntry = JavaRuntime
                    .newArchiveRuntimeClasspathEntry( apacheDsLibrariesFolder.append( library ) );
                libraryClasspathEntry.setClasspathProperty( IRuntimeClasspathEntry.USER_CLASSES );

                classpath.add( libraryClasspathEntry.getMemento() );
            }

            // Setting the classpath type attribute
            workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classpath );
View Full Code Here

Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

    IRuntimeClasspathEntry[] entries = 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);
    }

    IRuntimeClasspathEntry[] customEntries =
      computeUnresolvedCustomClasspath(configuration, Plugin.ATTR_WEB_CONTEXT_CUSTOM_CLASSPATH);

    for(IRuntimeClasspathEntry entry:customEntries){
      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) {
          File f =new File(location);
          if(f.exists() && f.isDirectory()){
            locations.add(location);
          }
View Full Code Here

Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

      throws CoreException {

    Set<IRuntimeClasspathEntry> all = new LinkedHashSet<IRuntimeClasspathEntry>(
        entries.length);
    for (int i = 0; i < entries.length; i++) {
      IRuntimeClasspathEntry entry = entries[i];
      IResource resource = entry.getResource();
      if (ignoreProject && resource instanceof IProject) {
        continue;
      }

      if (Plugin.CONTAINER_RJR_JETTY.equals(entry.getVariableName())) {
        all.addAll(Arrays.asList(RunJettyRunLaunchConfigurationUtil
            .loadPackage(configuration,
                IJettyPackageProvider.TYPE_JETTY_BUNDLE)));
      } else if (Plugin.CONTAINER_RJR_JETTY_JNDI.equals(entry
          .getVariableName())) {
        all.addAll(Arrays.asList(RunJettyRunLaunchConfigurationUtil
            .loadPackage(configuration,
                IJettyPackageProvider.TYPE_UTIL)));
      } else {
View Full Code Here

Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

  public IRuntimeClasspathEntry getDelegate() {
    return entry;
  }

  public boolean hasChildren() {
    IRuntimeClasspathEntry delegate = getDelegate();
    if (delegate.getType() == IRuntimeClasspathEntry.ARCHIVE) {
      return false;
    } else {
      return true;
    }
  }
View Full Code Here

Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

  }

  public IRJRClasspathEntry[] getChildren(ILaunchConfiguration configuration) {

    try {
      IRuntimeClasspathEntry delegate = getDelegate();
      if (delegate.getType() == IRuntimeClasspathEntry.PROJECT) {
        List<IRuntimeClasspathEntry> childs;
        IResource ir = delegate.getResource();
        IJavaProject project = JavaCore.create(ir.getProject());
        childs = RunJettyRunClasspathUtil
            .getProjectClasspathsForUserlibs(project, isUnderMavenDependency);
        return create(childs, isUnderMavenDependency);

      } else if (delegate.getType() == IRuntimeClasspathEntry.CONTAINER) {

        // Note: 2011/12/14 Tony:
        // Here the reason we also handle the webapplication container
        // for maven resolving issue is,
        // the web app is impossible to have project as web app .

        // In general case , WTP resolved jars in WEB-INF/lib ,
        // when we have M2E to resolved pom file , sometimes it will
        // load dependency in WEBAPP Container ,

        // yep , it's weird , I mean it should only use existing M2E
        // Container ,
        // but it does happened in some case , I decide to check the
        // project entry in WEB APP Conainer.

        // There shouldn't be proejct entrys in general case, so it
        // should be working fine.
        if (RunJettyRunClasspathResolver.isM2EMavenContainer(delegate)
            || RunJettyRunClasspathResolver
                .isWebAppContainer(delegate)) {
          IClasspathContainer container = JavaCore
              .getClasspathContainer(delegate.getPath(),
                  delegate.getJavaProject());
          if (container == null) {
            return null;
          }
          IClasspathEntry[] cpes = container.getClasspathEntries();
          if (cpes == null || cpes.length == 0) {
View Full Code Here

Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

  private IRJRClasspathEntry[] create(IRuntimeClasspathEntry[] entries,
      boolean maven) {
    ClasspathEntry[] cps = new ClasspathEntry[entries.length];
    for (int i = 0; i < entries.length; i++) {
      IRuntimeClasspathEntry childEntry = entries[i];
      cps[i] = new ClasspathEntry(childEntry, this);
      cps[i].setIsUnderMavenDependency(maven);
      cps[i].setCustom(custom);
    }
    return cps;
View Full Code Here

Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

    refresh();
  }

  public void setEntries(IRuntimeClasspathEntry[] entries) {
    model.cleanRootGroup(UserClassesClasspathModel.USER);
    IRuntimeClasspathEntry entry;
    for (int i = 0; i < entries.length; i++) {
      entry= entries[i];
      switch (entry.getClasspathProperty()) {
        case IRuntimeClasspathEntry.USER_CLASSES:
          model.addEntry(UserClassesClasspathModel.USER, entry);
          break;
      }
    }
View Full Code Here

Examples of org.eclipse.jdt.launching.IRuntimeClasspathEntry

  /* (non-Javadoc)
   * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
   */
  public Image getImage(Object element) {
    IRuntimeClasspathEntry entry = (IRuntimeClasspathEntry)element;
    IResource resource = entry.getResource();
    switch (entry.getType()) {
      case IRuntimeClasspathEntry.PROJECT:
        IJavaElement proj = JavaCore.create(resource);
        if(proj == null) {
          return PlatformUI.getWorkbench().getSharedImages().getImage(SharedImages.IMG_OBJ_PROJECT_CLOSED);
        }
        else {
          return lp.getImage(proj);
        }
      case IRuntimeClasspathEntry.ARCHIVE:
        if (resource instanceof IContainer) {
          return lp.getImage(resource);
        }
        if(resource !=  null && resource.getLocation().toFile().isDirectory()){
          return PlatformUI.getWorkbench().getSharedImages().getImage(
              org.eclipse.ui.ISharedImages.IMG_OBJ_FOLDER);
        }

        boolean external = resource == null;
        boolean source = true ;//(entry.getSourceAttachmentPath() != null && !Path.EMPTY.equals(entry.getSourceAttachmentPath()));
        String key = null;
        if (external) {
          IPath path = entry.getPath();
          if (path != null)
          {
            File file = path.toFile();
            if (file.exists() && file.isDirectory()) {
              key = ISharedImages.IMG_OBJS_PACKFRAG_ROOT;
            } else {
              key = ISharedImages.IMG_OBJS_EXTERNAL_ARCHIVE;
            }
          }

        } else {
          if (source) {
            key = ISharedImages.IMG_OBJS_JAR_WITH_SOURCE;
          } else {
            key = ISharedImages.IMG_OBJS_JAR;
          }
        }
        return JavaUI.getSharedImages().getImage(key);
      case IRuntimeClasspathEntry.VARIABLE:
        return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_ENV_VAR);
      case IRuntimeClasspathEntry.CONTAINER:
                return JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_LIBRARY);
      case IRuntimeClasspathEntry.OTHER:
        IRuntimeClasspathEntry delegate = entry;
        if (entry instanceof ClasspathEntry) {
          delegate = ((ClasspathEntry)entry).getDelegate();
        }
        Image image = lp.getImage(delegate);
        if (image != null) {
View Full Code Here

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) {
          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);
          }
          displayPath.append(segments[segments.length - 1]);

          //getDevice means that's a absolute path.
          if(path.getDevice() != null && !path.toFile().exists()){
            displayPath.append(" (missing) ");
          }
        } 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
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.