Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IFolder


        Logger pluginLogger = Activator.getDefault().getPluginLogger();

        IJavaProject javaProject = ProjectHelper.asJavaProject(project);

        IFolder outputFolder = (IFolder) project.getWorkspace().getRoot().findMember(javaProject.getOutputLocation());

        if (!outputFolder.getFullPath().isPrefixOf(manifest.getFullPath())) {
            pluginLogger.trace("Ignoring manifest found at {0} since it is not under the output directory at {1}",
                    manifest.getFullPath(), outputFolder.getFullPath());
            return Collections.emptyList();
        }

        List<IFile> missingDescriptors = new ArrayList<IFile>();

        InputStream contents = manifest.getContents();
        try {
            Manifest mf = new Manifest(contents);
            String serviceComponentHeader = mf.getMainAttributes().getValue("Service-Component");
            if (serviceComponentHeader != null) {
                String[] entries = serviceComponentHeader.split(",");
                for (String entry : entries) {
                    entry = entry.trim();

                    if (entry.contains("*")) {
                        pluginLogger.trace("Ignoring wildcard Service-Component entry {0}", entry);
                        continue;
                    }

                    IFile descriptor = outputFolder.getFile(entry);

                    if (descriptor.exists()) {
                        pluginLogger.trace("Found matching resource for Service-Component entry {0}", entry);
                        continue;
                    }
View Full Code Here


        entries.add(JavaRuntime.getDefaultJREContainerEntry());
        for (Artifact artifact : resolvedArtifacts) {
            entries.add(JavaCore.newLibraryEntry(Path.fromOSString(artifact.getFile().getAbsolutePath()), null, null));
        }

        IFolder src = project.getFolder("src");
        src.create(true, true, new NullProgressMonitor());
        entries.add(JavaCore.newSourceEntry(src.getFullPath()));

        javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[entries.size()]), new NullProgressMonitor());

        IFolder bin = project.getFolder("bin");
        if (!bin.exists()) { // TODO - not sure why this exists...
            bin.create(true, true, new NullProgressMonitor());
        }

        javaProject.setOutputLocation(bin.getFullPath(), new NullProgressMonitor());

    }
View Full Code Here

                    }

                    current = (IContainer) container;
                } else {

                    IFolder newFolder = ((IContainer) current).getFolder(Path.fromPortableString(currentSegment));
                    newFolder.create(true, true, new NullProgressMonitor());
                    current = newFolder;
                }
            }

            IFile file = current.getFile(Path.fromPortableString(fileLocation.segments()[fileLocation
View Full Code Here

        FileInfo info = createFileInfo(resource);
        Activator.getDefault().getPluginLogger().trace("For {0} built fileInfo {1}", resource, info);

        File syncDirectoryAsFile = ProjectUtil.getSyncDirectoryFullPath(resource.getProject()).toFile();
        IFolder syncDirectory = ProjectUtil.getSyncDirectory(resource.getProject());

        Filter filter = ProjectUtil.loadFilter(resource.getProject());

        ResourceProxy resourceProxy = null;

        if (serializationManager.isSerializationFile(resource.getLocation().toOSString())) {
            InputStream contents = null;
            try {
                IFile file = (IFile) resource;
                contents = file.getContents();
                String resourceLocation = file.getFullPath().makeRelativeTo(syncDirectory.getFullPath())
                        .toPortableString();
                resourceProxy = serializationManager.readSerializationData(resourceLocation, contents);
                normaliseResourceChildren(file, resourceProxy, syncDirectory, repository);


                // TODO - not sure if this 100% correct, but we definitely should not refer to the FileInfo as the
                // .serialization file, since for nt:file/nt:resource nodes this will overwrite the file contents
                String primaryType = (String) resourceProxy.getProperties().get(Repository.JCR_PRIMARY_TYPE);
                if (Repository.NT_FILE.equals(primaryType)) {
                    // TODO move logic to serializationManager
                    File locationFile = new File(info.getLocation());
                    String locationFileParent = locationFile.getParent();
                    int endIndex = locationFileParent.length() - ".dir".length();
                    File actualFile = new File(locationFileParent.substring(0, endIndex));
                    String newLocation = actualFile.getAbsolutePath();
                    String newName = actualFile.getName();
                    String newRelativeLocation = actualFile.getAbsolutePath().substring(
                            syncDirectoryAsFile.getAbsolutePath().length());
                    info = new FileInfo(newLocation, newRelativeLocation, newName);

                    Activator.getDefault().getPluginLogger()
                            .trace("Adjusted original location from {0} to {1}", resourceLocation, newLocation);

                }

            } catch (IOException e) {
                Activator.getDefault().getPluginLogger().warn(e.getMessage(), e);
                return null;
            } finally {
                IOUtils.closeQuietly(contents);
            }
        } else {

            // TODO - move logic to serializationManager
            // possible .dir serialization holder
            if (resource.getType() == IResource.FOLDER && resource.getName().endsWith(".dir")) {
                IFolder folder = (IFolder) resource;
                IResource contentXml = folder.findMember(".content.xml");
                // .dir serialization holder ; nothing to process here, the .content.xml will trigger the actual work
                if (contentXml != null && contentXml.exists()
                        && serializationManager.isSerializationFile(contentXml.getLocation().toOSString())) {
                    return null;
                }
View Full Code Here

            return null;
        }

        IProject project = resource.getProject();

        IFolder syncFolder = project.getFolder(ProjectUtil.getSyncDirectoryValue(project));

        IPath relativePath = resource.getFullPath().makeRelativeTo(syncFolder.getFullPath());

        FileInfo info = new FileInfo(resource.getLocation().toOSString(), relativePath.toOSString(), resource.getName());

        Activator.getDefault().getPluginLogger().trace("For {0} built fileInfo {1}", resource, info);
View Full Code Here

        return filter.filter(contentSyncRoot, repositoryPath);
    }

    private String getRepositoryPathForDeletedResource(IResource resource, File contentSyncRoot) {
        IFolder syncFolder = ProjectUtil.getSyncDirectory(resource.getProject());
        IPath relativePath = resource.getFullPath().makeRelativeTo(syncFolder.getFullPath());

        String absFilePath = new File(contentSyncRoot, relativePath.toOSString()).getAbsolutePath();
        String filePath = serializationManager.getBaseResourcePath(absFilePath);

        IPath osPath = Path.fromOSString(filePath);
        String repositoryPath = serializationManager.getRepositoryPath(osPath.makeRelativeTo(syncFolder.getLocation())
                .makeAbsolute().toPortableString());

        Activator.getDefault().getPluginLogger()
                .trace("Repository path for deleted resource {0} is {1}", resource, repositoryPath);
View Full Code Here

        logger.trace("Found plain nt:folder candidate at {0}, trying to find a covering resource for it",
                changedResource.getProjectRelativePath());
        // don't use isRoot() to prevent infinite loop when the final path is '//'
        while (serializationFilePath.segmentCount() != 0) {
            serializationFilePath = serializationFilePath.removeLastSegments(1);
            IFolder folderWithPossibleSerializationFile = (IFolder) syncDirectory.findMember(serializationFilePath);
            if (folderWithPossibleSerializationFile == null) {
                logger.trace("No folder found at {0}, moving up to the next level", serializationFilePath);
                continue;
            }
View Full Code Here

        if (ignoredFileNames.contains(resource.getName())) {
            return null;
        }

        IFolder syncDirectory = ProjectUtil.getSyncDirectory(resource.getProject());

        Filter filter = ProjectUtil.loadFilter(syncDirectory.getProject());

        if (filter != null) {
            FilterResult filterResult = getFilterResult(resource, filter);
            if (filterResult == FilterResult.DENY || filterResult == FilterResult.PREREQUISITE) {
                return null;
View Full Code Here

            if (!contentProject) {
                return false;
            }

            IFolder syncDirectory = ProjectUtil.getSyncDirectory(project);
            if (syncDirectory == null) {
                return false;
            }

            return syncDirectory.getFullPath().isPrefixOf(resource.getFullPath());
        }

        return false;
    }
View Full Code Here

                        "The support bundle was not found, please install it via the server properties page."));
            }

            IJavaProject javaProject = ProjectHelper.asJavaProject(project);

            IFolder outputFolder = (IFolder) project.getWorkspace().getRoot().findMember(javaProject.getOutputLocation());
            IPath outputLocation = outputFolder.getLocation();
            //ensure the MANIFEST.MF exists - if it doesn't then let the publish fail with a warn (instead of an error)
            IResource manifest = outputFolder.findMember("META-INF/MANIFEST.MF");
            if (manifest==null) {
                Activator.getDefault().getPluginLogger().warn("Project "+project+" does not have a META-INF/MANIFEST.MF (yet) - not publishing this time");
                Activator.getDefault().issueConsoleLog("InstallBundle", outputFolder.getLocation().toOSString(), "Project "+project+" does not have a META-INF/MANIFEST.MF (yet) - not publishing this time");
                monitor.done();
                setModulePublishState(module, IServer.PUBLISH_STATE_FULL);
                return;
            }
           
            monitor.worked(1);

            //TODO SLING-3767:
            //osgiClient must have a timeout!!!
            if ( installLocally ) {
                osgiClient.installLocalBundle(outputLocation.toOSString());
                monitor.worked(3);
            } else {

                JarBuilder builder = new JarBuilder();
                InputStream bundle = builder.buildJar(outputFolder);
                monitor.worked(1);
               
                osgiClient.installLocalBundle(bundle, outputFolder.getLocation().toOSString());
                monitor.worked(2);
            }

            setModulePublishState(module, IServer.PUBLISH_STATE_NONE);
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.