/** * Performs a git clone to a temporary location and then copies the files over top the already * generated project. This is because git cannot clone into an existing directory. * * @param monitor * @throws Exception */ protected void cloneAfter(IProgressMonitor monitor) throws Exception { SubMonitor sub = SubMonitor.convert(monitor, Messages.AbstractNewProjectWizard_CloningFromGitMsg, 100); // clone to tmp dir then copy files over top the project! File tmpFile = File.createTempFile("delete_me", "tmp"); // $NON-NLS-1$ //$NON-NLS-2$ File dest = new File(tmpFile.getParent(), "git_clone_tmp"); // $NON-NLS-1$ GitExecutable.instance() .clone( selectedTemplate.getLocation(), Path.fromOSString(dest.getAbsolutePath()), true, sub.newChild(85)); IFileStore tmpClone = EFS.getStore(dest.toURI()); // Wipe the .git folder before copying? Wipe the .project file before copying? IFileStore dotGit = tmpClone.getChild(".git"); // $NON-NLS-1$ dotGit.delete(EFS.NONE, sub.newChild(2)); IFileStore dotProject = tmpClone.getChild(IProjectDescription.DESCRIPTION_FILE_NAME); if (dotProject.fetchInfo().exists()) { dotProject.delete(EFS.NONE, sub.newChild(1)); } // OK, copy the cloned template's contents over IFileStore projectStore = EFS.getStore(newProject.getLocationURI()); tmpClone.copy(projectStore, EFS.OVERWRITE, sub.newChild(9)); // Now get rid of the temp clone! tmpClone.delete(EFS.NONE, sub.newChild(3)); sub.done(); }
private static IFileEditorInput getFileStorage(int index) throws CoreException { String filename = getBatchDateString(); filename += (index > 0 ? "_" + index : "") + ".tcl"; IFolder templateFolder = SicsVisualBatchViewer.getProjectFolder( SicsVisualBatchViewer.EXPERIMENT_PROJECT, FOLDER_TEMPLATE); IFile templateFile = templateFolder.getFile(FILE_TEMPLATE); IFolder folder = SicsVisualBatchViewer.getProjectFolder( SicsVisualBatchViewer.EXPERIMENT_PROJECT, SicsVisualBatchViewer.AUTOSAVE_FOLDER); IFileEditorInput input = new FileEditorInput(folder.getFile(filename)); if (input.exists()) { return getFileStorage(index++); } else { try { byte[] read = null; if (templateFile.exists()) { long size = EFS.getStore(templateFile.getLocationURI()).fetchInfo().getLength(); // long size = templateFolder.getLocation().toFile().length(); read = new byte[(int) size]; InputStream inputStream = templateFile.getContents(); inputStream.read(read); } else { read = new byte[0]; templateFile.create(new ByteArrayInputStream(read), IResource.ALLOW_MISSING_LOCAL, null); } input.getFile().create(new ByteArrayInputStream(read), IResource.ALLOW_MISSING_LOCAL, null); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } return input; }
@Override protected StandardDiagramLayout initLayoutModel() { StandardDiagramLayout layoutModel = null; try { String fileName = computeLayoutFileName(this.editorInput); if (fileName != null) { final XmlResourceStore resourceStore; if (this.editorInput instanceof IFileEditorInput) { IFileEditorInput fileInput = (IFileEditorInput) this.editorInput; IFolder layoutFolder = (IFolder) fileInput.getFile().getParent(); IFile layoutFile = layoutFolder.getFile(fileName); resourceStore = new XmlResourceStore(new WorkspaceFileResourceStore(layoutFile)); } else if (this.editorInput instanceof FileStoreEditorInput) { FileStoreEditorInput fileStoreInput = (FileStoreEditorInput) this.editorInput; IFileStore store = EFS.getStore(fileStoreInput.getURI()); File localFile = store.toLocalFile(EFS.NONE, null); // if no local file is available, obtain a cached file if (localFile == null) localFile = store.toLocalFile(EFS.CACHE, null); if (localFile == null) throw new IllegalArgumentException(); File layoutFile = new File(localFile.getParentFile(), fileName); resourceStore = new XmlResourceStore(new FileResourceStore(layoutFile)); } else { throw new IllegalStateException(); } layoutModel = StandardDiagramLayout.TYPE.instantiate(new RootXmlResource(resourceStore)); } } catch (Exception e) { Sapphire.service(LoggingService.class).log(e); } return layoutModel; }
private static IFileStore getFileStore(String filename) { try { return EFS.getStore((new Path(filename).toFile().toURI())); } catch (CoreException e) { } return null; }
/* * (non-Javadoc) * @see com.aptana.index.core.IIndexFileContributor#contributeFiles(java.net.URI) */ public Set<IFileStore> getFiles(URI containerURI) { IContainer[] containers = ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI(containerURI); Set<IFileStore> result = new HashSet<IFileStore>(); if (containers != null && containers.length > 0) { for (IContainer container : containers) { if (container instanceof IProject) { IProject project = (IProject) container; Set<BuildPathEntry> entries = BuildPathManager.getInstance().getBuildPaths(project); if (entries != null) { for (BuildPathEntry entry : entries) { try { IFileStore fileStore = EFS.getStore(entry.getPath()); result.add(fileStore); } catch (CoreException e) { IdeLog.logError(BuildPathCorePlugin.getDefault(), e.getMessage(), e); } } } } } } return result; }
public void testIndexWithEmptyContent() throws Exception { File tmpDir = null; try { String src = "\n"; // Generate some files to index! tmpDir = new File( FileUtil.getTempDirectory().toOSString(), "testIndexWithEmptyContent" + System.currentTimeMillis()); tmpDir.mkdirs(); File coffeeFile = new File(tmpDir, "index_me.coffee"); IOUtil.write(new FileOutputStream(coffeeFile), src); IFileStore fileStore = EFS.getStore(coffeeFile.toURI()); BuildContext context = new FileStoreBuildContext(fileStore); IProgressMonitor monitor = new NullProgressMonitor(); indexer.index(context, null, monitor); } finally { // Clean up the generated files! FileUtil.deleteRecursively(tmpDir); } }
private long getContainerTimestamp(TypeNameMatch match) { try { IType type = match.getType(); IResource resource = type.getResource(); if (resource != null) { URI location = resource.getLocationURI(); if (location != null) { IFileInfo info = EFS.getStore(location).fetchInfo(); if (info.exists()) { // The element could be removed from the build path. So check // if the Java element still exists. IJavaElement element = JavaCore.create(resource); if (element != null && element.exists()) return info.getLastModified(); } } } else { // external JAR IPackageFragmentRoot root = match.getPackageFragmentRoot(); if (root.exists()) { IFileInfo info = EFS.getLocalFileSystem().getStore(root.getPath()).fetchInfo(); if (info.exists()) { return info.getLastModified(); } } } } catch (CoreException e) { // Fall through } return IResource.NULL_STAMP; }
/** * Returns true for: - non-hidden projects - non-RDT projects - projects that does not have remote * systems temporary nature - projects that are located remotely */ public boolean isCandidate(IProject project) { boolean a = false; boolean b = false; boolean c = false; boolean d = false; a = !project.isHidden(); try { // b = !project.hasNature(RemoteNature.REMOTE_NATURE_ID); try { ServiceModelManager.getInstance().getConfigurations(project); } catch (ProjectNotConfiguredException e) { b = true; } c = !project.hasNature("org.eclipse.rse.ui.remoteSystemsTempNature"); // $NON-NLS-1$ IHost host = RSEUtils.getConnection(project.getLocationURI()); if (host != null) { d = !host.getSystemType().isLocal(); } else { IFileStore fileStore = EFS.getStore(project.getLocationURI()); if (fileStore != null) { if (!(fileStore instanceof LocalFile)) { d = true; } } } } catch (CoreException e) { RDTLog.logError(e); } return a && b && c && d; }
@Override protected String computeLayoutFileName(IEditorInput editorInput) throws CoreException, IOException { String fileName = null; if (editorInput instanceof FileEditorInput) { FileEditorInput fileEditorInput = (FileEditorInput) editorInput; IFile ifile = fileEditorInput.getFile(); fileName = ifile.getName(); } else if (editorInput instanceof FileStoreEditorInput) { FileStoreEditorInput fileStoreInput = (FileStoreEditorInput) editorInput; IFileStore store = EFS.getStore(fileStoreInput.getURI()); File localFile = store.toLocalFile(EFS.NONE, null); // if no local file is available, obtain a cached file if (localFile == null) localFile = store.toLocalFile(EFS.CACHE, null); if (localFile == null) throw new IllegalArgumentException(); fileName = localFile.getName(); } if (fileName != null && fileName.endsWith(".xml")) { fileName = fileName.substring(0, fileName.indexOf(".xml")); } if (fileName != null) { fileName += ".layout"; } return fileName; }
protected void createSystemFileContexts(InputContextManager manager, FileStoreEditorInput input) { try { IFileStore store = EFS.getStore(input.getURI()); IEditorInput in = new FileStoreEditorInput(store); manager.putContext(in, new CategoryInputContext(this, in, true)); } catch (CoreException e) { PDEPlugin.logException(e); } }
/** * Creates an editor input using the given file. Note that if there's Eclipse IDE running, the * result will be an {@link org.eclipse.ui.ide.FileStoreEditorInput}; otherwise an instance of * {@link FileEditorInput} will be returned. * * @param file The file * @return A new editor input representing the given file. * @throws CoreException if the creation failed */ public static IEditorInput createFileEditorInput(File file) throws CoreException { if (file == null) throw new IllegalArgumentException("File is null"); // $NON-NLS-1$ Bundle ide = getIDE(); if (ide != null) { IFileStore fileStore = EFS.getStore(file.toURI()); return createFileEditorInput(ide, fileStore); } return new FileEditorInput(file); }
// temp code for grabbing files from filesystem protected IFileStore tempGetFileStore(IPath path) { // first check if we have an alias registered if (path.segmentCount() > 0) { URI alias = aliasRegistry.lookupAlias(path.segment(0)); if (alias != null) try { return EFS.getStore(alias).getFileStore(path.removeFirstSegments(1)); } catch (CoreException e) { LogHelper.log( new Status( IStatus.WARNING, HostingActivator.PI_SERVER_HOSTING, 1, "An error occured when getting file store for path '" + path + "' and alias '" + alias + '\'', e)); //$NON-NLS-1$ //$NON-NLS-2$ // fallback is to try the same path relatively to the root } } // assume it is relative to the root try { return EFS.getStore(rootStoreURI).getFileStore(path); } catch (CoreException e) { LogHelper.log( new Status( IStatus.WARNING, HostingActivator.PI_SERVER_HOSTING, 1, "An error occured when getting file store for path '" + path + "' and root '" + rootStoreURI + '\'', e)); //$NON-NLS-1$ //$NON-NLS-2$ // fallback and return null } return null; }
protected void doFSSetUp() throws Exception { repositoryPath = getRandomLocation(); URI uri = URIUtil.toURI(repositoryPath); // encoded StringBuffer sb = new StringBuffer(); sb.append(GitFileSystem.SCHEME_GIT); sb.append("://test/"); sb.append(uri.toString()); sb.append("?/"); baseStore = EFS.getStore(URI.create(sb.toString())); baseStore.mkdir(EFS.NONE, null); }
/* (non-Javadoc) * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#doSaveDocument(org.eclipse.core.runtime.IProgressMonitor, java.lang.Object, org.eclipse.jface.text.IDocument, boolean) * tau 21.03.2005 */ protected void doSaveDocument( IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException { if (element instanceof IFileEditorInput) { doSaveFileResource(monitor, element, document, overwrite); } else if (element instanceof IAdaptable) { // reuses code from TextFileDocumentProvider to handle external files (195615) // TODO consider converting the super class to TextFileDocumentProvider IAdaptable adaptable = (IAdaptable) element; ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager(); ITextFileBuffer fileBuffer = null; LocationKind locationKind = null; ILocationProvider provider = (ILocationProvider) adaptable.getAdapter(ILocationProvider.class); if (provider instanceof ILocationProviderExtension) { URI uri = ((ILocationProviderExtension) provider).getURI(element); if (ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(uri).length == 0) { IFileStore fileStore = EFS.getStore(uri); manager.connectFileStore(fileStore, getProgressMonitor()); fileBuffer = manager.getFileStoreTextFileBuffer(fileStore); } } if (fileBuffer == null && provider != null) { IPath location = provider.getPath(element); if (location != null) { locationKind = LocationKind.NORMALIZE; manager.connect(location, locationKind, getProgressMonitor()); fileBuffer = manager.getTextFileBuffer(location, locationKind); } } if (fileBuffer != null) { fileBuffer.getDocument().set(document.get()); fileBuffer.commit(null, true); } } // tau 21.03.05 // First attempt show Message Connection through SQLScrapbookEditorInput if (element instanceof SQLScrapbookEditorInput) ((SQLScrapbookEditorInput) element).showMessageConnection(); // Second attempt show Message Connection through sqlEditor IEditorPart editor = PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getActivePage() .findEditor((IEditorInput) element); if ((editor != null) && (editor instanceof SQLEditor)) { ((SQLEditor) editor).refreshConnectionStatus(); } }
/** Checks whether the specified inclusion exists. */ public boolean getInclusionExists(final String path) { if (UNCPathConverter.isUNC(path)) { try { IFileStore store = EFS.getStore(UNCPathConverter.getInstance().toURI(path)); return store.fetchInfo().exists(); } catch (CoreException e) { return false; } } return new File(path).exists(); }
private static File toLocalFile(URI locationURI) { if (locationURI == null) return null; try { IFileStore store = EFS.getStore(locationURI); return store.toLocalFile(0, null); } catch (CoreException ex) { SpringCore.log("Error while converting URI to local file: " + locationURI.toString(), ex); } return null; }
@Test public void testLocalFileProxy() { IRemoteFileProxy fileProxy = null; try { fileProxy = proxyManager.getFileProxy(localProject.getProject()); assertTrue("Should have returned a remote launcher", fileProxy instanceof LocalFileProxy); } catch (CoreException e) { fail("Should have returned a launcher: " + e.getCause()); } /* * Test getDirectorySeparator() */ String ds = fileProxy.getDirectorySeparator(); assertNotNull(ds); /* * Test getResource() */ IFileStore actualFileStore = fileProxy.getResource(localProject.getProject().getLocation().toOSString()); assertNotNull(actualFileStore); IFileStore expectedFileStore = null; try { expectedFileStore = EFS.getStore(localProject.getLocationURI()); } catch (CoreException e) { fail("Unabled to get FileStore to local project: " + e.getMessage()); } assertEquals("FileStore to local project folder diverge", expectedFileStore, actualFileStore); assertTrue(actualFileStore.fetchInfo().isDirectory()); actualFileStore = fileProxy.getResource("/filenotexits"); assertNotNull(actualFileStore); IFileInfo fileInfo = actualFileStore.fetchInfo(); assertNotNull(fileInfo); assertFalse(fileInfo.exists()); /* * Test getWorkingDir() */ URI workingDir = fileProxy.getWorkingDir(); assertNotNull(workingDir); assertEquals(localProject.getLocationURI(), workingDir); /* * Test toPath() */ assertEquals( localProject.getProject().getLocation().toOSString(), fileProxy.toPath(localProject.getLocationURI())); }
public static IFileStore getFileStore(Object input) { IFileStore fileStore = (IFileStore) getAdapter(input, IFileStore.class); if (fileStore == null) { File file = (File) getAdapter(input, File.class); if (file != null) { try { fileStore = EFS.getStore(file.toURI()); } catch (CoreException ignore) { } } } if (fileStore == null) { fileStore = forceFileStore(input); } return fileStore; }
public NonWorkspaceTextFileHandler(IEditorPart part, IActiveDocumentAgentCallback callback) { super(part, callback); if (!(part instanceof ITextEditor)) throw new IllegalArgumentException("part must be an ITextEditor."); if (!(part.getEditorInput() instanceof FileStoreEditorInput)) throw new IllegalArgumentException("part must provide FileStoreEditorInput."); try { text_file_store = EFS.getStore(((FileStoreEditorInput) part.getEditorInput()).getURI()); } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } updateEncodingInfoPrivately(); }
/** * Completes a move after a file transfer. Returns <code>true</code> if the move was successful, * and <code>false</code> otherwise. In case of failure, this method handles setting an * appropriate response. */ private boolean completeMove(HttpServletRequest req, HttpServletResponse resp) throws ServletException { IPath destPath = new Path(getPath()).append(getFileName()); try { IFileStore source = EFS.getStore(new File(getStorageDirectory(), FILE_DATA).toURI()); IFileStore destination = NewFileServlet.getFileStore(destPath); source.move(destination, EFS.OVERWRITE, null); } catch (CoreException e) { String msg = NLS.bind("Failed to complete file transfer on {0}", destPath.toString()); statusHandler.handleRequest( req, resp, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, e)); return false; } return true; }
public IEditorInput getEditorInput(IPath p, IProject project) { IFile f = getFileForPath(p, project); if (f != null && f.exists()) { return new FileEditorInput(f); } if (p.isAbsolute()) { File file = p.toFile(); if (file.exists()) { try { IFileStore ifs = EFS.getStore(file.toURI()); return new FileStoreEditorInput(ifs); } catch (CoreException _) { Activator.getDefault().getLog().log(_.getStatus()); } } } return findFileInCommonSourceLookup(p); }
/** * Grabs the list of {@link IBuildPathEntry}s for a project and make sure the indices for them are * up-to-date. * * @param monitor */ private void indexProjectBuildPaths(IProgressMonitor monitor) { IProject project = getProjectHandle(); Set<IBuildPathEntry> entries = getBuildPathManager().getBuildPaths(project); SubMonitor sub = SubMonitor.convert(monitor, entries.size()); for (IBuildPathEntry entry : entries) { try { IFileStore fileStore = EFS.getStore(entry.getPath()); if (fileStore != null) { if (fileStore.fetchInfo().isDirectory()) { new IndexContainerJob(entry.getDisplayName(), entry.getPath()).run(sub.newChild(1)); } else { new IndexFileJob(entry.getDisplayName(), entry.getPath()).run(sub.newChild(1)); } } } catch (Throwable e) { IdeLog.logError(BuildPathCorePlugin.getDefault(), e); } } }
@SuppressWarnings("unchecked") private static IFileStore forceFileStore(Object adaptable) { if (!(isInplementation(adaptable, "org.eclipse.ui.IURIEditorInput"))) // $NON-NLS-1$ return null; Class clazz = adaptable.getClass(); try { // For 'org.eclipse.ui.IURIEditorInput': // we don't directly depend on org.eclipse.ui.ide, // so we have to count on reflection. // FIXME design an extension point for this Method method = clazz.getMethod("getURI"); // $NON-NLS-1$ // if (method.isAccessible()) { Object result = method.invoke(adaptable); if (result instanceof URI) { return EFS.getStore((URI) result); } // } } catch (Throwable ignore) { } return null; }
private IEditorInput findFileInCommonSourceLookup(IPath path) { try { AbstractSourceLookupDirector director = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector(); ISourceContainer[] c = director.getSourceContainers(); for (ISourceContainer sourceContainer : c) { Object[] o = sourceContainer.findSourceElements(path.toOSString()); for (Object object : o) { if (object instanceof IFile) { return new FileEditorInput((IFile)object); } else if (object instanceof LocalFileStorage) { LocalFileStorage storage = (LocalFileStorage) object; IFileStore ifs = EFS.getStore(storage.getFile().toURI()); return new FileStoreEditorInput(ifs); } } } } catch (Exception _) { // do nothing } return null; }
/** * Write the contents of the file to the tar archive. * * @param entry * @param contents * @exception java.io.IOException * @exception org.eclipse.core.runtime.CoreException */ private void write(TarEntry entry, IFile contents) throws IOException, CoreException { final URI location = contents.getLocationURI(); if (location == null) { throw new FileNotFoundException(contents.getFullPath().toOSString()); } InputStream contentStream = contents.getContents(false); entry.setSize(EFS.getStore(location).fetchInfo().getLength()); outputStream.putNextEntry(entry); try { int n; byte[] readBuffer = new byte[4096]; while ((n = contentStream.read(readBuffer)) > 0) { outputStream.write(readBuffer, 0, n); } } finally { if (contentStream != null) { contentStream.close(); } } outputStream.closeEntry(); }
/** * Returns the root location where user data files for the given user are stored. In some * configurations this location might be shared across users, so clients will need to ensure * resulting files are segmented appropriately by user. */ public static IFileStore getUserHome(String userId) { URI platformLocationURI = Activator.getDefault().getRootLocationURI(); IFileStore root = null; try { root = EFS.getStore(platformLocationURI); } catch (CoreException e) { // this is fatal, we can't access the platform instance location throw new Error("Failed to access platform instance location", e); // $NON-NLS-1$ } // consult layout preference String layout = PreferenceHelper.getString(ServerConstants.CONFIG_FILE_LAYOUT, "flat") .toLowerCase(); //$NON-NLS-1$ if ("usertree".equals(layout) && userId != null) { // $NON-NLS-1$ // the user-tree layout organises projects by the user who created it String userPrefix = userId.substring(0, Math.min(2, userId.length())); return root.getChild(userPrefix).getChild(userId); } // default layout is a flat list of projects at the root return root; }
protected void perfValidate(String filename, int iterations) throws Exception { // read in the file URL url = FileLocator.find( Platform.getBundle(JSCorePlugin.PLUGIN_ID), Path.fromPortableString("performance/" + filename), null); File file = ResourceUtil.resourcePathToFile(url); IFileStore fileStore = EFS.getStore(file.toURI()); // Ok now actually validate the thing, the real work for (int i = 0; i < iterations; i++) { EditorTestHelper.joinBackgroundActivities(); // Force a re-parse every time so we're comparing apples to apples for JSLint BuildContext context = new FileStoreBuildContext(fileStore) { @Override protected ParseResult parse( String contentType, IParseState parseState, WorkingParseResult working) throws Exception { if (reparseEveryTime()) { return new JSParser().parse(parseState); } return super.parse(contentType, parseState, working); } }; // Don't measure reading in string... context.getContents(); startMeasuring(); validator.buildFile(context, null); stopMeasuring(); } commitMeasurements(); assertPerformance(); }
public void testLinkedFolderInVirtualFolder_FileStoreURI() { IPath folderLocation = getRandomLocation(); IFolder folder = existingVirtualFolderInExistingProject.getFolder(getUniqueString()); try { folder.createLink(folderLocation, IResource.ALLOW_MISSING_LOCAL, getMonitor()); } catch (CoreException e) { fail("1.0", e); } assertTrue("2.0", folder.exists()); assertEquals("3.0", folderLocation, folder.getLocation()); assertTrue("4.0", !folderLocation.toFile().exists()); // Check file store URI for the linked resource try { IFileStore fs = EFS.getStore(existingVirtualFolderInExistingProject.getLocationURI()); fs = fs.getChild(folder.getName()); assertNotNull("5.0", fs); assertNotNull("6.0", fs.toURI()); } catch (CoreException e) { fail("7.0", e); } }
@Override protected IBaseModel createModel(IEditorInput input) throws CoreException { BundleModel model = null; boolean isReconciling = input instanceof IFileEditorInput; IDocument document = getDocumentProvider().getDocument(input); model = new BundleModel(document, isReconciling); if (input instanceof IFileEditorInput) { IFile file = ((IFileEditorInput) input).getFile(); model.setUnderlyingResource(file); model.setCharset(file.getCharset()); } else if (input instanceof IURIEditorInput) { IFileStore store = EFS.getStore(((IURIEditorInput) input).getURI()); model.setInstallLocation(store.getParent().getParent().toString()); model.setCharset(getDefaultCharset()); } else if (input instanceof JarEntryEditorInput) { File file = (File) ((JarEntryEditorInput) input).getAdapter(File.class); model.setInstallLocation(file.toString()); model.setCharset(getDefaultCharset()); } else { model.setCharset(getDefaultCharset()); } model.load(); return model; }
@Override public boolean visit(final IResource resource) { if (resource == null || !resource.isAccessible()) { return false; } final URI resourceLocation = resource.getLocationURI(); resourcename = resource.getName(); if (resourcename == null || resourcename.startsWith(DOT)) { return false; } try { URI resolved = resource.getWorkspace().getPathVariableManager().resolveURI(resourceLocation); IFileStore store = EFS.getStore(resolved); IFileInfo fileInfo = store.fetchInfo(); if (!fileInfo.exists()) { ErrorReporter.logError( "The resource `" + resource.getFullPath() + "' points to a non-existing location."); return false; } } catch (CoreException e) { ErrorReporter.logExceptionStackTrace(e); return false; } switch (resource.getType()) { case IResource.FILE: if (!ResourceExclusionHelper.isDirectlyExcluded((IFile) resource) && !helper.isExcludedByRegexp(resourcename)) { boolean inExcluded = false; IPath resourceFullPath = resource.getFullPath(); for (int i = 0; i < excludedFolders.size(); i++) { IPath excludedFolder = excludedFolders.get(i); if (excludedFolder.isPrefixOf(resourceFullPath)) { inExcluded = true; break; } } IFile file = (IFile) resource; if (inExcluded) { excludedFiles.put(resource.getName(), file); return false; } boolean inCentralStorage = false; for (int i = 0; i < centralStorages.size(); i++) { URI centralFolder = centralStorages.get(i); if (centralFolder.getHost() == resourceLocation.getHost() && resourceLocation.getPath().startsWith(centralFolder.getPath())) { inCentralStorage = true; break; } } file = (IFile) resource; if (inCentralStorage) { if (file.getLocation() == null) { centralStorageFiles.put(file.getName(), file); } else { centralStorageFiles.put(file.getLocation().toOSString(), file); } } else { files.put(resourcename, file); } } return false; case IResource.FOLDER: for (IContainer workingDirectory : workingDirectories) { if (workingDirectory.equals(resource)) { return false; } } try { if (ResourceExclusionHelper.isDirectlyExcluded((IFolder) resource) || helper.isExcludedByRegexp(resourcename)) { excludedFolders.add(resource.getFullPath()); } if (TRUE.equals( resource.getPersistentProperty( new QualifiedName( FolderBuildPropertyData.QUALIFIER, FolderBuildPropertyData.CENTRAL_STORAGE_PROPERTY)))) { centralStorages.add(resourceLocation); } } catch (CoreException e) { return false; } break; default: } return true; }