Package org.eclipse.wst.common.componentcore.resources

Examples of org.eclipse.wst.common.componentcore.resources.IVirtualComponent


    if(entries.size() < cp.length) {
      JavaCore.create(project).setRawClasspath(entries.toArray(new IClasspathEntry[entries.size()]), monitor);
    }
   
    IVirtualComponent c = ComponentCore.createComponent(project);
    IVirtualFolder rootFolder = c.getRootFolder();
   
    IPath runtimePath = rootFolder.getRuntimePath();
    rootFolder.removeLink(runtimePath, IVirtualResource.FORCE, monitor);
   
    rootFolder.delete(IVirtualResource.IGNORE_UNDERLYING_RESOURCE, monitor);
View Full Code Here


  @Override
public void convert(IProject project, Model model, IProgressMonitor monitor) throws CoreException {
    if (!accept(project) || !"ear".equals(model.getPackaging())) { //$NON-NLS-1$
      return;
    }
    IVirtualComponent component = ComponentCore.createComponent(project);
    if (component == null) {
      return;
    }

    setEarPlugin(component, model);
View Full Code Here

              return;
            IDataModel model = (IDataModel) cfg;

            if(model.isProperty(IEarFacetInstallDataModelProperties.CONTENT_DIR)){
              IPath earContent = new Path("/" + model.getStringProperty(IEarFacetInstallDataModelProperties.CONTENT_DIR));//$NON-NLS-1$
              final IVirtualComponent c = ComponentCore.createComponent(project, true);
              if (c != null) {
                final IVirtualFolder earroot = c.getRootFolder();
                if (!WTPProjectsUtil.hasLink(project, new Path("/"), earContent, monitor)) {//$NON-NLS-1$
                  earroot.createLink(earContent , 0, null);
                }
                WTPProjectsUtil.setDefaultDeploymentDescriptorFolder(earroot, earContent, monitor);
              }
View Full Code Here

    Set<Action> actions = new LinkedHashSet<Action>();

    installJavaFacet(actions, project, facetedProject);
   
    IVirtualComponent component = ComponentCore.createComponent(project, true);
   
    //MNGECLIPSE-2279 get the context root from the final name of the project, or artifactId by default.
    String contextRoot = getContextRoot(mavenProject, config.getWarName());
   
    IProjectFacetVersion webFv = config.getWebFacetVersion(project);
    IDataModel webModelCfg = getWebModelConfig(warSourceDirectory, contextRoot);
    if(!facetedProject.hasProjectFacet(WebFacetUtils.WEB_FACET)) {
      removeConflictingFacets(facetedProject, webFv, actions);
      actions.add(new IFacetedProject.Action(IFacetedProject.Action.Type.INSTALL, webFv, webModelCfg));
    } else {
      IProjectFacetVersion projectFacetVersion = facetedProject.getProjectFacetVersion(WebFacetUtils.WEB_FACET);    
      if(webFv.getVersionString() != null && !webFv.getVersionString().equals(projectFacetVersion.getVersionString())){
          actions.add(new IFacetedProject.Action(IFacetedProject.Action.Type.VERSION_CHANGE, webFv, webModelCfg));
      }
    }

    String customWebXml = config.getCustomWebXml(project);
   
    if(!actions.isEmpty()) {
      ResourceCleaner fileCleaner = new ResourceCleaner(project, contentFolder);
      try {
        addFoldersToClean(fileCleaner, facade);
        fileCleaner.addFiles(contentFolder.getFile("META-INF/MANIFEST.MF").getProjectRelativePath()); //$NON-NLS-1$
        fileCleaner.addFolder(contentFolder.getFolder("WEB-INF/lib")); //$NON-NLS-1$
        if (customWebXml != null) {
          fileCleaner.addFiles(contentFolder.getFile("WEB-INF/web.xml").getProjectRelativePath()); //$NON-NLS-1$
        }
       
        facetedProject.modify(actions, monitor);
      } finally {
        //Remove any unwanted MANIFEST.MF the Facet installation has created
        fileCleaner.cleanUp();
      }
    }
   
    //MECLIPSEWTP-41 Fix the missing moduleCoreNature
    fixMissingModuleCoreNature(project, monitor);
   
    // MNGECLIPSE-632 remove test sources/resources from WEB-INF/classes
    removeTestFolderLinks(project, mavenProject, monitor, "/WEB-INF/classes"); //$NON-NLS-1$

    addContainerAttribute(project, DEPENDENCY_ATTRIBUTE, monitor);

    //MNGECLIPSE-2279 change the context root if needed
    if (!contextRoot.equals(J2EEProjectUtilities.getServerContextRoot(project))) {
      J2EEProjectUtilities.setServerContextRoot(project, contextRoot);
    }
   
    if (customWebXml != null) {
      linkFileFirst(project, customWebXml, "/WEB-INF/web.xml", monitor); //$NON-NLS-1$
    }

   
    component = ComponentCore.createComponent(project, true);
    if(component != null) {     
      IPath warPath = new Path("/").append(contentFolder.getProjectRelativePath()); //$NON-NLS-1$
      List<IPath> sourcePaths = new ArrayList<IPath>();
      sourcePaths.add(warPath);
      if (!WTPProjectsUtil.hasLink(project, ROOT_PATH, warPath, monitor)) {
        component.getRootFolder().createLink(warPath, IVirtualResource.NONE, monitor);
      }
      //MECLIPSEWTP-22 support web filtered resources. Filtered resources directory must be declared BEFORE
      //the regular web source directory. First resources discovered take precedence on deployment
      IPath filteredFolder = new Path("/").append(WebResourceFilteringConfiguration.getTargetFolder(mavenProject, project)); //$NON-NLS-1$
     
      boolean useBuildDir = MavenWtpPlugin.getDefault().getMavenWtpPreferencesManager().getPreferences(project).isWebMavenArchiverUsesBuildDirectory();
      boolean useWebresourcefiltering = config.getWebResources() != null
                                        && config.getWebResources().length > 0
                                        || config.isFilteringDeploymentDescriptorsEnabled();

      if (useBuildDir || useWebresourcefiltering) {
       
        if (!useBuildDir && useWebresourcefiltering) {
          mavenMarkerManager.addMarker(project, MavenWtpConstants.WTP_MARKER_CONFIGURATION_ERROR_ID,
                                      Messages.markers_mavenarchiver_output_settings_ignored_warning, -1, IMarker.SEVERITY_WARNING);
        }
        sourcePaths.add(filteredFolder);
        WTPProjectsUtil.insertLinkBefore(project, filteredFolder, warPath, new Path("/"), monitor); //$NON-NLS-1$
      } else {
        component.getRootFolder().removeLink(filteredFolder,IVirtualResource.NONE, monitor);
      }

      WTPProjectsUtil.deleteLinks(project, ROOT_PATH, sourcePaths, monitor);
     
      WTPProjectsUtil.setDefaultDeploymentDescriptorFolder(component.getRootFolder(), warPath, monitor);

      addComponentExclusionPatterns(component, config);
     
    }
    WTPProjectsUtil.removeWTPClasspathContainer(project);
View Full Code Here

      throws CoreException {
    if (!ModuleCoreNature.isFlexibleProject(project)) {
      return;
    }
   
    IVirtualComponent component = ComponentCore.createComponent(project,true);
    //if the attempt to create dependencies happens before the project is actually created, abort.
    //this will be created again when the project exists.
    if(component == null){
      return;
    }
    //MECLIPSEWTP-41 Fix the missing moduleCoreNature
    fixMissingModuleCoreNature(project, monitor);
   
    WarPluginConfiguration config = new WarPluginConfiguration(mavenProject, project);
  
    Map<Artifact, String> deployedArtifacts = getDeployedArtifacts(mavenProject.getArtifacts(), config);
   
    List<AbstractDependencyConfigurator> depConfigurators = ExtensionReader.readDependencyConfiguratorExtensions(projectManager,
        MavenPlugin.getMavenRuntimeManager(), mavenMarkerManager);
   
    Set<IVirtualReference> references = new LinkedHashSet<IVirtualReference>();

    List<IMavenProjectFacade> exportedDependencies = getWorkspaceDependencies(project, mavenProject);
   
    for(IMavenProjectFacade dependency : exportedDependencies) {
      String depPackaging = dependency.getPackaging();
      if ("pom".equals(depPackaging) //MNGECLIPSE-744 pom dependencies shouldn't be deployed //$NON-NLS-1$
          || "war".equals(depPackaging) //Overlays are dealt with the overlay configurator //$NON-NLS-1$
          || "zip".equals(depPackaging)) { //$NON-NLS-1$
        continue;
      }
     
      preConfigureDependencyProject(dependency, monitor);
     
      if (!ModuleCoreNature.isFlexibleProject(dependency.getProject())) {
        //Projects unsupported by WTP (ex. adobe flex projects) should not be added as references
        continue;
      }
      MavenProject depMavenProject =  dependency.getMavenProject(monitor);

      IVirtualComponent depComponent = ComponentCore.createComponent(dependency.getProject());
         
      ArtifactKey artifactKey = ArtifactHelper.toArtifactKey(depMavenProject.getArtifact());
      //Get artifact using the proper classifier
      Artifact artifact = ArtifactHelper.getArtifact(mavenProject.getArtifacts(), artifactKey);
      if (artifact == null) {
View Full Code Here

    this.exclusions = exclusionPatterns;
  }
 
  @Override
  public IVirtualFolder getRootFolder() {
    IVirtualComponent component = ComponentCore.createComponent(getProject());
    File archive = getArchive();
    ResourceListVirtualFolder root =null;
    if (component != null && archive != null) {
      IFolder unpackedFolder = getUnpackedArchiveFolder(archive);
      if (isUnpackNeeded(archive, unpackedFolder)) {
View Full Code Here

      return new IVirtualReference[]{};
    }
   
    List<IVirtualReference> selectedRefs = new ArrayList<IVirtualReference>();
    for (IVirtualReference ref  : allReferences) {
      IVirtualComponent component = ref.getReferencedComponent();
      if (component != null) {
        if (component instanceof IOverlayVirtualComponent) {
          if (overlays) {
            selectedRefs.add(ref);
          }
View Full Code Here

  }


  public static void removeTestFolderLinks(IProject project, MavenProject mavenProject, IProgressMonitor monitor,
      String folder) throws CoreException {
    IVirtualComponent component = ComponentCore.createComponent(project);
    if (component == null){
      return;
    }
    IVirtualFolder jsrc = component.getRootFolder().getFolder(folder);
    for(IPath location : MavenProjectUtils.getSourceLocations(project, mavenProject.getTestCompileSourceRoots())) {
      if (location == null) {
    continue;
  }
      jsrc.removeLink(location, 0, monitor);
View Full Code Here

      //The exception shouldn't halt the configuration process.
      ex.printStackTrace();
    }
   
    IFolder folder = null;
    IVirtualComponent component = vFolder.getComponent();
    if (defaultPath == null) {
      IContainer container = vFolder.getUnderlyingFolder();
      if (container instanceof IFolder) {
    folder = (IFolder)container;
    }
    } else if (!defaultPath.isRoot()){
        folder = component.getProject().getFolder(defaultPath);
    }   
    return folder;
 
View Full Code Here

    if (cachedRoot != null && (System.currentTimeMillis() - lastCacheUpdate) < MAX_CACHE){
      return cachedRoot;
    }
   
    if (project != null) {
      IVirtualComponent component = ComponentCore.createComponent(project);
      if (component != null) {
        //FlatVirtualComponent will build the project structure from the definition in .component
        FlatVirtualComponent flatVirtualComponent = new FlatVirtualComponent(component, getOptions());
        IResourceFilter filter = new DynamicResourceFilter(getInclusions(), getExclusions());
        cachedRoot = new CompositeVirtualFolder(flatVirtualComponent, ROOT, filter);
View Full Code Here

TOP

Related Classes of org.eclipse.wst.common.componentcore.resources.IVirtualComponent

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.