Java Examples for org.eclipse.core.runtime.IPath

The following java examples will help you to understand the usage of org.eclipse.core.runtime.IPath. These source code samples are taken from different open source projects.

Example 1
Project: cdt-tests-runner-master  File: MapEntrySourceContainerType.java View source code
/* (non-Javadoc)
	 * @see org.eclipse.debug.core.sourcelookup.ISourceContainerTypeDelegate#createSourceContainer(java.lang.String)
	 */
public ISourceContainer createSourceContainer(String memento) throws CoreException {
    Node node = parseDocument(memento);
    if (node.getNodeType() == Node.ELEMENT_NODE) {
        Element element = (Element) node;
        if (ELEMENT_NAME.equals(element.getNodeName())) {
            String path = element.getAttribute(BACKEND_PATH);
            IPath backend = new Path(path);
            if (!backend.isValidPath(path)) {
                abort(InternalSourceLookupMessages.MapEntrySourceContainerType_0, null);
            }
            path = element.getAttribute(LOCAL_PATH);
            IPath local = new Path(path);
            if (!local.isValidPath(path)) {
                abort(InternalSourceLookupMessages.MapEntrySourceContainerType_1, null);
            }
            return new MapEntrySourceContainer(backend, local);
        }
        abort(InternalSourceLookupMessages.MapEntrySourceContainerType_2, null);
    }
    abort(InternalSourceLookupMessages.MapEntrySourceContainerType_3, null);
    return null;
}
Example 2
Project: cdt-master  File: MapEntrySourceContainerType.java View source code
/* (non-Javadoc)
	 * @see org.eclipse.debug.core.sourcelookup.ISourceContainerTypeDelegate#createSourceContainer(java.lang.String)
	 */
@Override
public ISourceContainer createSourceContainer(String memento) throws CoreException {
    Node node = parseDocument(memento);
    if (node.getNodeType() == Node.ELEMENT_NODE) {
        Element element = (Element) node;
        if (ELEMENT_NAME.equals(element.getNodeName())) {
            String backend = element.getAttribute(BACKEND_PATH);
            if (backend == null || backend.isEmpty()) {
                abort(InternalSourceLookupMessages.MapEntrySourceContainerType_0, null);
            }
            String path = element.getAttribute(LOCAL_PATH);
            if (path == null) {
                abort(InternalSourceLookupMessages.MapEntrySourceContainerType_1, null);
            }
            IPath local = new Path(path);
            if (!local.isValidPath(path)) {
                abort(InternalSourceLookupMessages.MapEntrySourceContainerType_1, null);
            }
            return new MapEntrySourceContainer(backend, local);
        }
        abort(InternalSourceLookupMessages.MapEntrySourceContainerType_2, null);
    }
    abort(InternalSourceLookupMessages.MapEntrySourceContainerType_3, null);
    return null;
}
Example 3
Project: extFM-Tooling-master  File: MtextAnnotationModelFactory.java View source code
public org.eclipse.jface.text.source.IAnnotationModel createAnnotationModel(org.eclipse.core.runtime.IPath location) {
    org.eclipse.core.resources.IWorkspace workspace = org.eclipse.core.resources.ResourcesPlugin.getWorkspace();
    org.eclipse.core.resources.IWorkspaceRoot root = workspace.getRoot();
    org.eclipse.core.resources.IResource resource = root.findMember(location);
    return new org.feature.multi.perspective.mapping.viewmapping.resource.mtext.ui.MtextAnnotationModel(resource);
}
Example 4
Project: tdq-studio-se-master  File: UpdateMsSqlToJdbcTaskTest.java View source code
private DatabaseConnection createConnectionItem(String name, IFolder folder) {
    IPath createPath = Path.EMPTY;
    if (folder != null) {
        createPath = new Path(folder.getFullPath().lastSegment());
    }
    // connection
    DatabaseConnection createConnection = ConnectionFactory.eINSTANCE.createDatabaseConnection();
    createConnection.setName(name);
    //$NON-NLS-1$
    createConnection.setUsername("UserName");
    //$NON-NLS-1$
    createConnection.setRawPassword("Password");
    //$NON-NLS-1$
    createConnection.setURL("URL");
    //$NON-NLS-1$
    createConnection.setDatabaseType("Microsoft SQL Server 2005/2008");
    createConnection.setContextMode(true);
    // ~connection
    DatabaseConnectionItem createDatabaseConnectionItem = PropertiesFactory.eINSTANCE.createDatabaseConnectionItem();
    org.talend.core.model.properties.Property createDatabaseConnectionProperty = PropertiesFactory.eINSTANCE.createProperty();
    createDatabaseConnectionProperty.setId(EcoreUtil.generateUUID());
    createDatabaseConnectionProperty.setItem(createDatabaseConnectionItem);
    createDatabaseConnectionProperty.setLabel(createConnection.getName());
    createDatabaseConnectionItem.setProperty(createDatabaseConnectionProperty);
    createDatabaseConnectionItem.setConnection(createConnection);
    try {
        ProxyRepositoryFactory.getInstance().create(createDatabaseConnectionItem, createPath, false);
    } catch (PersistenceException e) {
        Assert.fail(e.getMessage());
    }
    return createConnection;
}
Example 5
Project: Eclipse-Postfix-Code-Completion-master  File: ClasspathValidation.java View source code
public void validate() {
    JavaModelManager.PerProjectInfo perProjectInfo;
    try {
        perProjectInfo = this.project.getPerProjectInfo();
    } catch (JavaModelException e) {
        IProject resource = this.project.getProject();
        if (resource.isAccessible()) {
            this.project.flushClasspathProblemMarkers(true, true, true);
            JavaBuilder.removeProblemsAndTasksFor(resource);
        }
        return;
    }
    // use synchronized block to ensure consistency
    IClasspathEntry[] rawClasspath;
    IPath outputLocation;
    IJavaModelStatus status;
    synchronized (perProjectInfo) {
        rawClasspath = perProjectInfo.rawClasspath;
        outputLocation = perProjectInfo.outputLocation;
        // status has been set during POST_CHANGE
        status = perProjectInfo.rawClasspathStatus;
    }
    // update classpath format problems
    this.project.flushClasspathProblemMarkers(/*cycle*/
    false, /*format*/
    true, /*overlapping*/
    false);
    if (!status.isOK())
        this.project.createClasspathProblemMarker(status);
    // update overlapping output problem markers 
    this.project.flushClasspathProblemMarkers(/*cycle*/
    false, /*format*/
    false, /*overlapping*/
    true);
    // update resolved classpath problems
    this.project.flushClasspathProblemMarkers(/*cycle*/
    false, /*format*/
    false, /*overlapping*/
    false);
    if (rawClasspath != JavaProject.INVALID_CLASSPATH && outputLocation != null) {
        for (int i = 0; i < rawClasspath.length; i++) {
            status = ClasspathEntry.validateClasspathEntry(this.project, rawClasspath[i], /*src attach*/
            false, /*not referred by a container*/
            false);
            if (!status.isOK()) {
                this.project.createClasspathProblemMarker(status);
            }
        }
        status = ClasspathEntry.validateClasspath(this.project, rawClasspath, outputLocation);
        if (status.getCode() != IStatus.OK)
            this.project.createClasspathProblemMarker(status);
    }
}
Example 6
Project: CodingSpectator-master  File: FileStatusContextViewer.java View source code
private IDocument getDocument(IFile file) {
    ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
    IPath path = file.getFullPath();
    try {
        try {
            manager.connect(path, LocationKind.IFILE, new NullProgressMonitor());
            ITextFileBuffer buffer = manager.getTextFileBuffer(path, LocationKind.IFILE);
            if (buffer != null) {
                return buffer.getDocument();
            }
        } finally {
            manager.disconnect(path, LocationKind.IFILE, new NullProgressMonitor());
        }
    } catch (CoreException e) {
        RefactoringUIPlugin.log(e);
    }
    return new Document(RefactoringUIMessages.FileStatusContextViewer_error_reading_file);
}
Example 7
Project: eclipse.jdt.core-master  File: TestExternalLibContainerInitializer.java View source code
public void initialize(final IPath containerName, IJavaProject project) throws CoreException {
    IPath ws = ResourcesPlugin.getWorkspace().getRoot().getLocation();
    final IPath containerPath = ws.append("../TestContainer/");
    IClasspathContainer container = new IClasspathContainer() {

        public IPath getPath() {
            return containerName;
        }

        public int getKind() {
            return IClasspathContainer.K_APPLICATION;
        }

        public String getDescription() {
            return "Test Container";
        }

        public IClasspathEntry[] getClasspathEntries() {
            if (TestExternalLibContainerInitializer.this.entries == null) {
                TestExternalLibContainerInitializer.this.entries = new IClasspathEntry[] { JavaCore.newLibraryEntry(containerPath, null, null) };
            }
            return TestExternalLibContainerInitializer.this.entries;
        }
    };
    JavaCore.setClasspathContainer(containerName, new IJavaProject[] { project }, new IClasspathContainer[] { container }, null);
}
Example 8
Project: windowtester-master  File: ClasspathContainerInitializer.java View source code
/**
	 * Binds a classpath container to a <code>IClasspathContainer</code> for a given
	 * project, or silently fails if unable to do so.
	 * 
	 * @see org.eclipse.jdt.core.ClasspathContainerInitializer#initialize(org.eclipse.core.runtime.IPath,
	 *      org.eclipse.jdt.core.IJavaProject)
	 */
public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
    Path path = new Path(BuildPathUtil.CLASSPATH_CONTAINER_ID);
    IClasspathEntry[] entries = BuildPathUtil.getRuntimeClasspathEntries(project);
    JavaCore.setClasspathContainer(path, new IJavaProject[] { project }, new IClasspathContainer[] { new RuntimeClasspathContainer(entries, path) }, null);
}
Example 9
Project: c4jplugin-master  File: C4JRuntimeContainer.java View source code
/**
	 * Get the c4j.jar classpath entry. This is usually in
	 * plugins/net.sourceforge.c4jplugin.runtime_ <VERSION>/c4j.jar
	 */
public static String getC4JRtClasspath() {
    if (c4jrtPath == null) {
        Bundle runtime = Platform.getBundle("net.sourceforge.c4jplugin.runtime");
        if (runtime != null) {
            URL installLoc = //$NON-NLS-1$
            runtime.getEntry(//$NON-NLS-1$
            "c4j.jar");
            if (installLoc == null) {
                // maybe it's a JARed bundle
                IPath path = new Path(//$NON-NLS-1$
                runtime.getLocation().split(//$NON-NLS-1$
                "@")[1]);
                IPath full = new Path(Platform.getInstallLocation().getURL().getFile()).append(path);
                c4jrtPath = full.toString();
            } else {
                try {
                    c4jrtPath = FileLocator.resolve(installLoc).getFile();
                } catch (IOException e) {
                }
            }
        }
    }
    return c4jrtPath;
}
Example 10
Project: liferay-ide-master  File: NewLiferayWorkspaceOpTests.java View source code
@Test
public void testNewLiferayWorkspaceOp() throws Exception {
    GradleProjectTests.fullImportGradleProject("projects/existingProject");
    NewLiferayWorkspaceOp op = NewLiferayWorkspaceOp.TYPE.instantiate();
    op.setWorkspaceName("existingProject");
    String message = op.validation().message();
    assertNotNull(message);
    assertEquals("A project with that name(ignore case) already exists.", message);
    op.setWorkspaceName("ExistingProject");
    message = op.validation().message();
    assertTrue(message.equals("A project with that name(ignore case) already exists."));
    String projectName = "test-liferay-workspace";
    IPath workspaceLocation = CoreUtil.getWorkspaceRoot().getLocation();
    op.setWorkspaceName(projectName);
    op.setUseDefaultLocation(false);
    op.setLocation(workspaceLocation.toPortableString());
    op.execute(new ProgressMonitor());
    String wsLocation = workspaceLocation.append(projectName).toPortableString();
    File wsFile = new File(wsLocation);
    assertTrue(wsFile.exists());
    assertTrue(LiferayWorkspaceUtil.isValidWorkspaceLocation(wsLocation));
}
Example 11
Project: tern.java-master  File: EclipseProjectScriptPath.java View source code
@Override
public boolean isInScope(IPath path, int resourceType) {
    IProject project = ((IIDETernProject) getOwnerProject()).getProject();
    IPath projectPath = project.getFullPath();
    IPath relativePath = PathUtils.getRelativePath(path, projectPath, resourceType);
    return isInScope(relativePath, EclipsePathAdapter.INSTANCE);
}
Example 12
Project: eclipse.jdt.ui-master  File: FileStatusContextViewer.java View source code
private IDocument getDocument(IFile file) {
    ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
    IPath path = file.getFullPath();
    try {
        try {
            manager.connect(path, LocationKind.IFILE, new NullProgressMonitor());
            ITextFileBuffer buffer = manager.getTextFileBuffer(path, LocationKind.IFILE);
            if (buffer != null) {
                return buffer.getDocument();
            }
        } finally {
            manager.disconnect(path, LocationKind.IFILE, new NullProgressMonitor());
        }
    } catch (CoreException e) {
        RefactoringUIPlugin.log(e);
    }
    return new Document(RefactoringUIMessages.FileStatusContextViewer_error_reading_file);
}
Example 13
Project: aws-toolkit-eclipse-master  File: WTPWarUtils.java View source code
public static IPath exportProjectToWar(IProject project, IPath directory) {
    File tempFile;
    try {
        tempFile = File.createTempFile("aws-eclipse-", ".war", directory.toFile());
    } catch (IOException e) {
        e.printStackTrace();
        throw new RuntimeException("Unable to create web application archive: " + e.getMessage(), e);
    }
    return exportProjectToWar(project, directory, tempFile.getName());
}
Example 14
Project: teiid-designer-master  File: RenameResourceContribution.java View source code
private String resourcePathToHandle(final String project, final IPath resourcePath) {
    if (project != null && project.length() > 0 && resourcePath.segmentCount() != 1)
        if (resourcePath.segment(0).equals(project)) {
            return resourcePath.removeFirstSegments(1).toPortableString();
        }
    return resourcePath.toPortableString();
}
Example 15
Project: erlide-master  File: BeamUtil.java View source code
public static OtpErlangBinary getBeamBinary(final String moduleName, final IPath beamPath) {
    try (FileInputStream s = new FileInputStream(beamPath.toPortableString())) {
        return getBeamBinary(moduleName, s);
    } catch (final IOException e) {
        ErlLogger.warn(e);
        return null;
    }
}
Example 16
Project: tcf-master  File: FileTransferItemValidator.java View source code
public static final Map<String, String> validate(IFileTransferItem item) {
    Assert.isNotNull(item);
    Map<String, String> invalid = new HashMap<String, String>();
    String host = item.getStringProperty(IFileTransferItem.PROPERTY_HOST);
    String target = item.getStringProperty(IFileTransferItem.PROPERTY_TARGET_STRING);
    int direction = (item.getProperty(IFileTransferItem.PROPERTY_DIRECTION) != null ? item.getIntProperty(IFileTransferItem.PROPERTY_DIRECTION) : IFileTransferItem.HOST_TO_TARGET);
    if (host == null || host.trim().length() == 0) {
        if (direction == IFileTransferItem.HOST_TO_TARGET) {
            invalid.put(IFileTransferItem.PROPERTY_HOST, Messages.FileTransferItemValidator_missingFile);
        } else {
            invalid.put(IFileTransferItem.PROPERTY_HOST, Messages.FileTransferItemValidator_missingFileOrDirectory);
        }
    } else {
        IPath hostPath = new Path(host);
        File hostFile = hostPath.toFile();
        if (direction == IFileTransferItem.HOST_TO_TARGET) {
            if (!hostFile.exists() || !hostFile.isFile() || !hostFile.canRead()) {
                invalid.put(IFileTransferItem.PROPERTY_HOST, Messages.FileTransferItemValidator_notExistingFile);
            }
        } else {
            if ((hostFile.isFile() && !hostFile.canWrite()) || (hostFile.isDirectory() && (!hostFile.exists() || !hostFile.canWrite()))) {
                invalid.put(IFileTransferItem.PROPERTY_HOST, Messages.FileTransferItemValidator_notExistingFileOrDirectory);
            }
        }
    }
    if (target == null || target.trim().length() == 0) {
        if (direction == IFileTransferItem.HOST_TO_TARGET) {
            invalid.put(IFileTransferItem.PROPERTY_TARGET_STRING, Messages.FileTransferItemValidator_missingFileOrDirectory);
        } else {
            invalid.put(IFileTransferItem.PROPERTY_TARGET_STRING, Messages.FileTransferItemValidator_missingFile);
        }
    } else {
        IPath targetPath = new Path(target);
        if (direction == IFileTransferItem.HOST_TO_TARGET) {
            if (!targetPath.isValidPath(target)) {
                invalid.put(IFileTransferItem.PROPERTY_TARGET_STRING, Messages.FileTransferItemValidator_invalidFileOrDirectory);
            }
        } else {
            if (!targetPath.isValidPath(target)) {
                invalid.put(IFileTransferItem.PROPERTY_TARGET_STRING, Messages.FileTransferItemValidator_invalidFile);
            }
        }
    }
    return invalid.isEmpty() ? null : invalid;
}
Example 17
Project: eclipse-commons-master  File: ResourceUtils.java View source code
public static IPath replaceExtension(IPath path, String extension) {
    IPath newPath = path.removeFileExtension();
    //$NON-NLS-1$
    final String dot = ".";
    if (path.lastSegment().startsWith(dot)) {
        // addFileExtension() doesn't work with trailing separator
        newPath = newPath.addTrailingSeparator().append(dot + extension);
    } else {
        newPath = newPath.addFileExtension(extension);
    }
    return newPath;
}
Example 18
Project: dltk.ruby-master  File: SourceModuleLookup.java View source code
/**
	 * Lookups [email protected] ISourceModule}s with the specified
	 * <code>modulePath</code>. Returns the array of the matched modules.
	 * 
	 * @param project
	 *            project to lookup
	 * @param modulePath
	 *            the module file name
	 * @param suffix
	 *            optional file name suffix (<code>null</code> if not needed)
	 * @return
	 * @throws ModelException
	 */
public static ISourceModule[] lookup(IScriptProject project, String modulePath, String suffix) throws ModelException {
    final List<ISourceModule> result = new ArrayList<ISourceModule>();
    final IPath path = new Path(modulePath);
    final String fileName = path.lastSegment();
    final String folderPath = path.removeLastSegments(1).toString();
    final IScriptFolder[] folders = project.getScriptFolders();
    for (int i = 0; i < folders.length; ++i) {
        final IScriptFolder folder = folders[i];
        if (folderPath.length() == 0 || folder.getElementName().endsWith(folderPath)) {
            final ISourceModule[] modules = folder.getSourceModules();
            for (int j = 0; j < modules.length; ++j) {
                final ISourceModule module = modules[j];
                final String moduleName = module.getElementName();
                if (fileName.equals(moduleName)) {
                    result.add(module);
                } else if (suffix != null && moduleName.length() == fileName.length() + suffix.length() && moduleName.startsWith(fileName) && moduleName.endsWith(suffix)) {
                    result.add(module);
                }
            }
        }
    }
    return result.toArray(new ISourceModule[result.size()]);
}
Example 19
Project: turmeric-eclipse-master  File: TestWorkspaceUtil.java View source code
/**
	 * @throws java.lang.Exception
	 */
@BeforeClass
public static void setUpBeforeClass() throws Exception {
    IPath workspaceRoot = ResourcesPlugin.getWorkspace().getRoot().getLocation();
    IProgressMonitor monitor = new NullProgressMonitor();
    project = WorkspaceUtil.createProject(TestWorkspaceUtil.class.getSimpleName() + "Project", workspaceRoot, monitor);
    final IProjectDescription description = project.getDescription();
    final List<String> natureIDs = ListUtil.array(description.getNatureIds());
    natureIDs.add(JavaCore.NATURE_ID);
    description.setNatureIds(natureIDs.toArray(new String[0]));
    project.setDescription(description, monitor);
}
Example 20
Project: tmdm-studio-se-master  File: ServerDefRepositoryContentHandler.java View source code
public Resource create(IProject project, Item item, int classifierID, IPath path) throws PersistenceException {
    if (item instanceof MDMServerDefItem) {
        Resource itemResource = xmiResourceManager.createItemResource(project, item, path, ServerDefService.REPOSITORY_TYPE_SERVER_DEF, false);
        itemResource.getContents().add(((MDMServerDefItem) item).getServerDef());
        return itemResource;
    }
    return null;
}
Example 21
Project: EclipseTrader-master  File: LazyStoreProperties.java View source code
/* (non-Javadoc)
     * @see org.eclipsetrader.core.repositories.StoreProperties#getProperty(java.lang.String)
     */
@Override
public Object getProperty(String name) {
    if (IPropertyConstants.BARS.equals(name) || IPropertyConstants.SPLITS.equals(name)) {
        if (getProperties().get(name) == null) {
            IPath path = LocalRepository.getInstance().getLocation().append(LocalRepository.SECURITIES_HISTORY_FILE);
            path.toFile().mkdirs();
            HistoryType historyType = (HistoryType) unmarshal(HistoryType.class, path.append(String.valueOf(id) + ".xml").toFile());
            if (historyType != null) {
                getProperties().put(IPropertyConstants.BARS, historyType.toArray());
                getProperties().put(IPropertyConstants.SPLITS, historyType.getSplits());
            }
        }
    }
    return super.getProperty(name);
}
Example 22
Project: platform_tools_motodev-master  File: ElementTreeValidator.java View source code
/* (non-Javadoc)
     * @see org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator#isSelectedValid(java.lang.Object)
     */
@Override
public boolean isSelectedValid(Object element) {
    boolean isValid = false;
    try {
        if (element instanceof IJavaProject) {
            IJavaProject jproject = (IJavaProject) element;
            IPath path = jproject.getProject().getFullPath();
            isValid = (jproject.findPackageFragmentRoot(path) != null);
        } else if (element instanceof IPackageFragmentRoot) {
            IPackageFragmentRoot packageFragmentRoot = (IPackageFragmentRoot) element;
            boolean isSrc = (packageFragmentRoot.getKind() == IPackageFragmentRoot.K_SOURCE);
            boolean isGen = packageFragmentRoot.getElementName().equals(IAndroidConstants.GEN_SRC_FOLDER) && (packageFragmentRoot.getParent() instanceof IJavaProject);
            isValid = isSrc && !isGen;
        } else {
            isValid = true;
        }
    } catch (JavaModelException e) {
        StudioLogger.error(ElementTreeValidator.class, e.getLocalizedMessage(), e);
    }
    return isValid;
}
Example 23
Project: xmind-master  File: BundleResourceFinder.java View source code
public static BundleResource resolve(BundleResource res) {
    IPath path = res.getPath();
    if (path.isEmpty() || path.isRoot()) {
        path = Path.EMPTY;
    }
    BundleResource result;
    String first = path.segment(0);
    if (first == null || !first.startsWith("$")) {
        //$NON-NLS-1$
        result = find(res.getBundle(), path);
    } else {
        path = path.removeFirstSegments(1);
        if ("$nl$".equalsIgnoreCase(first)) {
            //$NON-NLS-1$
            result = resolveByNL(res.getBundle(), path);
        } else if ("$os$".equalsIgnoreCase(first)) {
            //$NON-NLS-1$
            result = resolveByOS(res.getBundle(), path);
        } else if ("$ws$".equalsIgnoreCase(first)) {
            //$NON-NLS-1$
            result = resolveByWS(res.getBundle(), path);
        } else {
            result = find(res.getBundle(), path);
        }
    }
    return result;
}
Example 24
Project: pmd-eclipse-plugin-master  File: AbstractResourceView.java View source code
/* @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent) */
public void resourceChanged(IResourceChangeEvent event) {
    try {
        event.getDelta().accept(new IResourceDeltaVisitor() {

            public boolean visit(final IResourceDelta delta) throws CoreException {
                // find the resource for the path of the current page
                IPath path = getResourcePath();
                if (delta.getFullPath().equals(path)) {
                    Display.getDefault().asyncExec(new Runnable() {

                        public void run() {
                            refresh(delta.getResource());
                        }
                    });
                    return false;
                }
                return true;
            }
        });
    } catch (CoreException e) {
        PMDPlugin.getDefault().logError(StringKeys.ERROR_CORE_EXCEPTION, e);
    }
}
Example 25
Project: substeps-eclipse-plugin-master  File: IsFeatureFolderPredicateTest.java View source code
@Test
public void returnsTrueIfFeatureFile() {
    final IFolder folder = context.mock(IFolder.class);
    final IPath folderPath = context.mock(IPath.class, "folderPath");
    final IProject project = context.mock(IProject.class);
    final IPath featureFolderPath = context.mock(IPath.class, "featureFolderPath");
    context.checking(new Expectations() {

        {
            oneOf(folder).getProject();
            will(returnValue(project));
            oneOf(projectManager).featureFolderFor(project);
            will(returnValue(featureFolderPath));
            oneOf(folder).getFullPath();
            will(returnValue(folderPath));
            oneOf(featureFolderPath).isPrefixOf(folderPath);
            will(returnValue(true));
        }
    });
    assertTrue(predicate.forModel(folder));
}