Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.ClasspathContainerInitializer


            }
        }

        private boolean isSourceAttachmentPossible(IPath containerPath,
            IJavaProject javaProject) {
            ClasspathContainerInitializer initializer = JavaCore
                .getClasspathContainerInitializer(containerPath
                    .segment(0));
            IStatus status = initializer.getSourceAttachmentStatus(
                containerPath, javaProject);
            if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_NOT_SUPPORTED
                || status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_READ_ONLY) {

                return false;
View Full Code Here


            processRequirementsChanges(monitor);
        }
       
        Path containerPath = new Path(SigilCore.CLASSPATH_CONTAINER_PATH);
        IJavaProject java = getJavaModel();
        ClasspathContainerInitializer init = JavaCore.getClasspathContainerInitializer(SigilCore.CLASSPATH_CONTAINER_PATH);
        ThreadProgressMonitor.setProgressMonitor(monitor);
        try
        {
            init.requestClasspathContainerUpdate(containerPath, java, null);
        }
        finally
        {
            ThreadProgressMonitor.setProgressMonitor(null);
        }
View Full Code Here

  }

  private static void addDeployableAttribute(IJavaProject javaProject, IClasspathAttribute deployableAttribute, IProgressMonitor monitor) throws JavaModelException, CoreException {
    if (javaProject == null) return;
    ClasspathContainerInitializer scalaInitializer = JavaCore.getClasspathContainerInitializer(SCALA_CONTAINER_PATH);
    if (scalaInitializer == null) return;
    IPath scalaContainerPath = Path.fromPortableString(SCALA_CONTAINER_PATH);
    Boolean updateAble = scalaInitializer.canUpdateClasspathContainer(scalaContainerPath, javaProject);
    final IClasspathContainer scalaLibrary = JavaCore.getClasspathContainer(scalaContainerPath, javaProject);
    final IClasspathEntry[] cpEntries = scalaLibrary.getClasspathEntries();

    for(int i = 0; i < cpEntries.length; i++ ) {
      IClasspathEntry cpe = cpEntries[i];
      LinkedHashMap<String, IClasspathAttribute> attrs = new LinkedHashMap<String, IClasspathAttribute>();
      for(IClasspathAttribute attr : cpe.getExtraAttributes()) {
        //Keep all existing attributes except the non_deployable key
        if(!attr.getName().equals(NON_DEPLOYABLE_KEY)) {
          attrs.put(attr.getName(), attr);
        }
      }
      attrs.put(deployableAttribute.getName(), deployableAttribute);
      IClasspathAttribute[] newAttrs = attrs.values().toArray(new IClasspathAttribute[attrs.size()]);
      cpEntries[i] = JavaCore.newLibraryEntry(cpe.getPath(), cpe.getSourceAttachmentPath(),
          cpe.getSourceAttachmentRootPath(), cpe.getAccessRules(), newAttrs, cpe.isExported());
    }

    IClasspathContainer candidateScalaContainer = new IClasspathContainer() {
      public IPath getPath() { return scalaLibrary.getPath(); }
      public IClasspathEntry[] getClasspathEntries() { return cpEntries; }
      public String getDescription() { return scalaLibrary.getDescription(); }
      public int getKind() { return scalaLibrary.getKind(); }
    };

    if (updateAble){
      scalaInitializer.requestClasspathContainerUpdate(scalaContainerPath, javaProject, candidateScalaContainer);
    } else {
      IJavaProject [] jPArray = { javaProject };
      IClasspathContainer[] cpArray = { candidateScalaContainer };
      JavaCore.setClasspathContainer(scalaContainerPath, jPArray, cpArray, null);
    }
View Full Code Here

        case NO_LOCAL_CONTENTS :
          return Messages.bind(Messages.status_noLocalContents, getPath().toString());

        case CP_CONTAINER_PATH_UNBOUND:
          IJavaProject javaProject = (IJavaProject)this.elements[0];
          ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(this.path.segment(0));
          String description = null;
          if (initializer != null) description = initializer.getDescription(this.path, javaProject);
          if (description == null) description = this.path.makeRelative().toString();
          return Messages.bind(Messages.classpath_unboundContainerPath, new String[] {description, javaProject.getElementName()});

        case INVALID_CP_CONTAINER_ENTRY:
          javaProject = (IJavaProject)this.elements[0];
          IClasspathContainer container = null;
          description = null;
          try {
            container = JavaCore.getClasspathContainer(this.path, javaProject);
          } catch(JavaModelException e){
            // project doesn't exist: ignore
          }
          if (container == null) {
             initializer = JavaCore.getClasspathContainerInitializer(this.path.segment(0));
            if (initializer != null) description = initializer.getDescription(this.path, javaProject);
          } else {
            description = container.getDescription();
          }
          if (description == null) description = this.path.makeRelative().toString();
          return Messages.bind(Messages.classpath_invalidContainer, new String[] {description, javaProject.getElementName()});
View Full Code Here

          }
        }
      }

      if(activitiExtensionLibraryPresent == false) {
        ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(JavaCore.USER_LIBRARY_CONTAINER_ID);
        IPath containerPath = new Path(JavaCore.USER_LIBRARY_CONTAINER_ID);
        initializer.requestClasspathContainerUpdate(containerPath.append(ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS),
                null, new IClasspathContainer() {

          @Override
          public IPath getPath() {
            return new Path(JavaCore.USER_LIBRARY_CONTAINER_ID).append(ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS) ;
View Full Code Here

public class UserLibConfigurator {

  public void configure(final String name, final File jarFileOrDir) throws CoreException {
   
    ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(JavaCore.USER_LIBRARY_CONTAINER_ID);
    IPath containerPath = new Path(JavaCore.USER_LIBRARY_CONTAINER_ID);
    initializer.requestClasspathContainerUpdate(
        containerPath.append(name), null,
        getClasspathContainer(name, jarFileOrDir));
  }
View Full Code Here

          }
        }
      }

      if (activitiExtensionLibraryPresent == false) {
        ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(JavaCore.USER_LIBRARY_CONTAINER_ID);
        IPath containerPath = new Path(JavaCore.USER_LIBRARY_CONTAINER_ID);
        initializer.requestClasspathContainerUpdate(containerPath.append(ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS), null, new IClasspathContainer() {

          @Override
          public IPath getPath() {
            return new Path(JavaCore.USER_LIBRARY_CONTAINER_ID).append(ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS);
          }
View Full Code Here

      jproject = root.getJavaProject();
      if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER)
      {
        containerPath = entry.getPath();
        ClasspathContainerInitializer initializer = JavaCore
            .getClasspathContainerInitializer(containerPath.segment(0));
        IClasspathContainer container = JavaCore.getClasspathContainer(
            containerPath, jproject);
        if (initializer == null || container == null)
        {
          return;
        }
        IStatus status = initializer.getSourceAttachmentStatus(containerPath,
            jproject);
        if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_NOT_SUPPORTED)
        {
          return;
        }
View Full Code Here

      jproject = root.getJavaProject();
      if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER)
      {
        containerPath = entry.getPath();
        ClasspathContainerInitializer initializer = JavaCore
            .getClasspathContainerInitializer(containerPath.segment(0));
        IClasspathContainer container = JavaCore.getClasspathContainer(
            containerPath, jproject);
        if (initializer == null || container == null)
        {
          return null;
        }
        IStatus status = initializer.getSourceAttachmentStatus(containerPath,
            jproject);
        if (status.getCode() == ClasspathContainerInitializer.ATTRIBUTE_NOT_SUPPORTED)
        {
          return null;
        }
View Full Code Here

TOP

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

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.