@Override public boolean canCreateReader() { if (storage == null || (storage instanceof IFile && !((IFile) storage).isAccessible())) { return false; } return true; } };
protected boolean targetExists(IStorage storage) { IFile file= (IFile)storage; return file != null && file.isAccessible(); }
protected boolean targetExists(IStorage storage) { IFile file= (IFile)storage; return file != null && file.isAccessible(); }
IAdaptable firstElement = (IAdaptable) treeSelection.getFirstElement(); IFile file = (IFile) firstElement.getAdapter(IFile.class); if (file != null && file.isAccessible()) { // Use getContents API .... }
private long getModificationStamp(IPath filePath) { IFile f = getFile(filePath); if (f != null && f.isAccessible()) { return f.getModificationStamp(); } File file = filePath.toFile(); if (file.exists()) return file.lastModified(); return IResource.NULL_STAMP; }
private Iterable<Pair<IStorage, IProject>> getStorages(IFile file) { if (file == null || !file.isAccessible()) { return emptySet(); } return singleton(Tuples.<IStorage,IProject>create(file, file.getProject())); }
public static long computeModificationStamp(IFile file) { if (file == null) return FileAdapter.FILE_NOT_LOADED; if(!file.isAccessible()){ return FileAdapter.FILE_INACCESSIBLE; } long currentStamp = file.getModificationStamp(); IPath path = file.getLocation(); if (path != null) return path.toFile().lastModified(); return currentStamp; }
/** * Tells whether a manifest is available. * * @return <code>true</code> if the manifest is generated or the provided one is accessible */ public boolean isManifestAccessible() { if (isManifestGenerated()) return true; IFile file= getManifestFile(); return file != null && file.isAccessible(); }
private CMDocument buildCMDocumentFromDirectory(File file) { IFile[] foundFilesForLocation = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(file.getPath())); for (int i = 0; i < foundFilesForLocation.length; i++) { if (foundFilesForLocation[i].isAccessible() && foundFilesForLocation[i].getType() == IResource.FOLDER) { return buildCMDocumentFromFolder(foundFilesForLocation[i].getFullPath()); } } return null; }
/** * Tells whether a manifest is available. * * @return <code>true</code> if the manifest is generated or the provided one is accessible */ public boolean isManifestAccessible() { if (isManifestGenerated()) return true; IFile file= getManifestFile(); return file != null && file.isAccessible(); }
private void setPomFile(IProject project) { if(project.isAccessible()) { IFile pomFile = project.getFile(IMavenConstants.POM_FILE_NAME); if(pomFile != null && pomFile.isAccessible()) { this.pomFile = pomFile; } } }
/** * Tells whether a manifest is available. * * @return <code>true</code> if the manifest is generated or the provided one is accessible */ public boolean isManifestAccessible() { if (isManifestGenerated()) return true; IFile file= getManifestFile(); return file != null && file.isAccessible(); }
public boolean fileExists() { IFile file = ((WorkspaceFileDiffResult)getDiffResult()).getTargetFile(); return file != null && file.isAccessible(); }
private void saveManifest() throws CoreException, IOException { ByteArrayOutputStream manifestOutput= new ByteArrayOutputStream(); Manifest manifest= fJarPackage.getManifestProvider().create(fJarPackage); manifest.write(manifestOutput); ByteArrayInputStream fileInput= new ByteArrayInputStream(manifestOutput.toByteArray()); IFile manifestFile= fJarPackage.getManifestFile(); if (manifestFile.isAccessible()) { if (fJarPackage.allowOverwrite() || JarPackagerUtil.askForOverwritePermission(fParentShell, manifestFile.getFullPath().toString())) manifestFile.setContents(fileInput, true, true, null); } else manifestFile.create(fileInput, true, null); }
@Override public boolean isEditable() { IFile file = ((WorkspaceFileDiffResult)getHunkResult().getDiffResult()).getTargetFile(); return file != null && file.isAccessible(); }
private void saveManifest() throws CoreException, IOException { ByteArrayOutputStream manifestOutput= new ByteArrayOutputStream(); Manifest manifest= fJarPackage.getManifestProvider().create(fJarPackage); manifest.write(manifestOutput); ByteArrayInputStream fileInput= new ByteArrayInputStream(manifestOutput.toByteArray()); IFile manifestFile= fJarPackage.getManifestFile(); if (manifestFile.isAccessible()) { if (fJarPackage.allowOverwrite() || JarPackagerUtil.askForOverwritePermission(fParentShell, manifestFile.getFullPath(), false)) manifestFile.setContents(fileInput, true, true, null); } else manifestFile.create(fileInput, true, null); }
private void saveManifest() throws CoreException, IOException { ByteArrayOutputStream manifestOutput= new ByteArrayOutputStream(); Manifest manifest= fJarPackage.getManifestProvider().create(fJarPackage); manifest.write(manifestOutput); ByteArrayInputStream fileInput= new ByteArrayInputStream(manifestOutput.toByteArray()); IFile manifestFile= fJarPackage.getManifestFile(); if (manifestFile.isAccessible()) { if (fJarPackage.allowOverwrite() || JarPackagerUtil.askForOverwritePermission(fParentShell, manifestFile.getFullPath(), false)) manifestFile.setContents(fileInput, true, true, null); } else manifestFile.create(fileInput, true, null); }
public boolean apply(Pair<IStorage, IProject> input) { IStorage storage = input.getFirst(); if (storage instanceof IFile) { IFile file = (IFile) storage; return file.isAccessible() && (!validateEdit || !file.isReadOnly() || workspace.validateEdit(new IFile[] { file }, null).isOK()); } return false; } });
/** * Checks if a {@link IFile} should/can be processed * * @return <code>true</code> if file is accessible and not hidden */ public final boolean shouldProcess(final IFile file) { return file.isAccessible() && file.getProject().isAccessible() && !file.getProject().isHidden(); }
protected FileInfo createFileInfo(Object element) throws CoreException { if (JAVA_PROPERTIES_FILE_CONTENT_TYPE == null || !(element instanceof IFileEditorInput)) return null; IFileEditorInput input= (IFileEditorInput)element; IFile file= input.getFile(); if (file == null || !file.isAccessible()) return null; IContentDescription description= file.getContentDescription(); if (description == null || description.getContentType() == null || !description.getContentType().isKindOf(JAVA_PROPERTIES_FILE_CONTENT_TYPE)) return null; return super.createFileInfo(element); }