Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IFolder


        IResource member = container.findMember(path);
        if (member != null && member.exists()) {
          collector.add(member);
        }
      } else if (nonJavaResource instanceof IFolder) {
        IFolder folder = (IFolder) nonJavaResource;
        IResource[] members = null;
        try {
          members = folder.members();
        } catch (CoreException e) {
          // ignore
        }
        if (members != null) {
          addNonJavaResources(members, container, rootPathSegmentCounts, collector);
View Full Code Here


    IResource resource = null;
    if (location != null) {
      resource = workspace.getRoot().findMember(location);
    }
    if (resource != null && resource.getType() == IResource.FOLDER) {
      IFolder folder = (IFolder) resource;
      // only changes if it actually existed
      IClasspathEntry[] classpath = this.project.getExpandedClasspath();
      for (int i = 0; i < classpath.length; i++) {
        IClasspathEntry entry = classpath[i];
        IPath path = classpath[i].getPath();
        if (entry.getEntryKind() != IClasspathEntry.CPE_PROJECT && path.isPrefixOf(location) && !path.equals(location)) {
          IPackageFragmentRoot[] roots = this.project.computePackageFragmentRoots(classpath[i]);
          PackageFragmentRoot root = (PackageFragmentRoot) roots[0];
          // now the output location becomes a package fragment - along with any subfolders
          ArrayList folders = new ArrayList();
          folders.add(folder);
          collectAllSubfolders(folder, folders);
          Iterator elements = folders.iterator();
          int segments = path.segmentCount();
          while (elements.hasNext()) {
            IFolder f = (IFolder) elements.next();
            IPath relativePath = f.getFullPath().removeFirstSegments(segments);
            String[] pkgName = relativePath.segments();
            IPackageFragment pkg = root.getPackageFragment(pkgName);
            if (!Util.isExcluded(pkg))
              fragments.add(pkg);
          }
View Full Code Here

        SubMonitor progress = SubMonitor.convert(monitor, work);

        for (String subPath : subPaths) {
            if (subPath.endsWith("/")) {
                IPath destinationPath = new Path(subPath).makeRelativeTo(sourcePrefix);
                IFolder folder = destination.getFolder(destinationPath);
                if (!folder.exists())
                    folder.create(true, true, null);
                copyBundleEntries(sourceBundle, subPath, sourcePrefix, destination, progress.newChild(1, SubMonitor.SUPPRESS_NONE));
                progress.setWorkRemaining(--work);
            } else {
                copyBundleEntry(sourceBundle, subPath, sourcePrefix, destination, progress.newChild(1, SubMonitor.SUPPRESS_NONE));
                progress.setWorkRemaining(--work);
View Full Code Here

        SubMonitor progress = SubMonitor.convert(monitor, 5);
        IProject project = javaProject.getProject();
        BuildPathsBlock.addJavaNature(project, progress.newChild(1));

        // Create the source folder
        IFolder srcFolder = project.getFolder("src");
        if (!srcFolder.exists()) {
            srcFolder.create(true, true, progress.newChild(1));
        }
        progress.setWorkRemaining(3);

        // Create the output location
        IFolder outputFolder = project.getFolder("bin");
        if (!outputFolder.exists())
            outputFolder.create(true, true, progress.newChild(1));
        outputFolder.setDerived(true);
        progress.setWorkRemaining(2);

        // Set the output location
        javaProject.setOutputLocation(outputFolder.getFullPath(), progress.newChild(1));

        // Create classpath entries
        IClasspathEntry[] classpath = new IClasspathEntry[2];
        classpath[0] = JavaCore.newSourceEntry(srcFolder.getFullPath());
        classpath[1] = JavaCore.newContainerEntry(new Path("org.eclipse.jdt.launching.JRE_CONTAINER"));
View Full Code Here

                    throw new IOException("Could not create directory " + target);
                }
            }

            // Tell Eclipse what we did...
            IFolder targetFolder = myProject.getFolder(calculateTargetDirPath(model));
            targetFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
        } catch (Exception e) {
            throw new CoreException(new Status(IStatus.ERROR, PLUGIN_ID, 0, "Build Error!", e));
        }
    }
View Full Code Here

        if (built.length > 0)
            Central.invalidateIndex();

        // Make sure Eclipse knows about the changed files (should already have
        // been done?)
        IFolder targetFolder = getProject().getFolder(calculateTargetDirPath(model));
        targetFolder.refreshLocal(IResource.DEPTH_INFINITE, null);

        // Report errors
        createBuildMarkers(model);

        return built.length > 0;
View Full Code Here

                    throw new IOException("Could not create directory " + target);
                }
            }

            // Tell Eclipse what we did...
            IFolder targetFolder = myProject.getFolder(calculateTargetDirPath(model));
            targetFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
        } catch (Exception e) {
            throw new CoreException(new Status(IStatus.ERROR, PLUGIN_ID, 0, "Build Error!", e));
        }
    }
View Full Code Here

        if (built.length > 0)
            Central.invalidateIndex();

        // Make sure Eclipse knows about the changed files (should already have
        // been done?)
        IFolder targetFolder = getProject().getFolder(calculateTargetDirPath(model));
        targetFolder.refreshLocal(IResource.DEPTH_INFINITE, null);

        // Report errors
        createBuildMarkers(model);

        return built.length > 0;
View Full Code Here

        return root.findFilesForLocationURI(javaFile.toURI());
    }

    public static File toFile(IWorkspaceRoot root, IPath path) {
        IFile wsfile;
        IFolder wsfolder;

        if ((wsfile = root.getFile(path)).exists()) {
            IPath location = wsfile.getLocation();
            if (location != null)
                return location.toFile();
        }

        if ((wsfolder = root.getFolder(path)).exists()) {
            IPath location = wsfolder.getLocation();
            if (location != null)
                return location.toFile();
        }

        return path.toFile();
View Full Code Here

        public boolean visit(IResourceDelta delta) throws CoreException {
          if (delta.getResource() instanceof IContainer) {
            return true;
          }
          IProject p = delta.getResource().getProject();
          IFolder syncDir = getSyncDir(p);
          if (syncDir==null) {
            return false;
          }
          toBeRefreshed.add(syncDir.getProject());
          return true;
        }
      });
      if (toBeRefreshed.size()==0) {
        return;
View Full Code Here

TOP

Related Classes of org.eclipse.core.resources.IFolder

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.