public AddJarFileToIndex(IFile resource, IndexLocation indexFile, IndexManager manager, final boolean updateIndex) { super(resource.getFullPath(), manager); this.resource = resource; this.indexFileURL = indexFile; this.forceIndexUpdate = updateIndex; } public AddJarFileToIndex(IPath jarPath, IndexLocation indexFile, IndexManager manager) {
public AddJarFileToIndex(IFile resource, IndexLocation indexFile, IndexManager manager, final boolean updateIndex) { super(resource.getFullPath(), manager); this.resource = resource; this.indexFileURL = indexFile; this.forceIndexUpdate = updateIndex; } public AddJarFileToIndex(IPath jarPath, IndexLocation indexFile, IndexManager manager) {
public AddJrtToIndex(IFile resource, IndexLocation indexFile, IndexManager manager, final boolean updateIndex) { super(resource.getFullPath(), manager); this.resource = resource; this.indexFileURL = indexFile; this.forceIndexUpdate = updateIndex; } public AddJrtToIndex(IPath jrtPath, IndexLocation indexFile, IndexManager manager, final boolean updateIndex) {
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof SourceFile)) return false; SourceFile f = (SourceFile) o; return this.sourceLocation == f.sourceLocation && this.resource.getFullPath().equals(f.resource.getFullPath()); }
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof SourceFile)) return false; SourceFile f = (SourceFile) o; return this.sourceLocation == f.sourceLocation && this.resource.getFullPath().equals(f.resource.getFullPath()); }
protected URI getContainerRelativeURI(IFile aFile) { IPath path = WorkbenchResourceHelperBase.getPathFromContainers(inputContainers, aFile.getFullPath()); if (path != null) return URI.createURI(path.toString()); return null; }
public void run(IProgressMonitor monitor) throws CoreException { monitor.beginTask(ActionMessages.AddToClasspathAction_progressMessage, files.length); for (int i= 0; i < files.length; i++) { monitor.subTask(files[i].getFullPath().toString()); IJavaProject project= JavaCore.create(files[i].getProject()); addToClassPath(project, files[i].getFullPath(), new SubProgressMonitor(monitor, 1)); } }
protected URI convertPathToURI(IPath modelObjectPath) { // TODO find a better way to getplatformURI IPath path = getComponent().getRootFolder().getFile(modelObjectPath).getUnderlyingFile().getFullPath(); return URI.createURI("platform:/resource/" + path.toString()); } });
/** * Notification before a compile that a unit is about to be compiled. */ public void aboutToCompile(SourceFile unit) { String message = Messages.bind(Messages.build_compiling, unit.resource.getFullPath().removeLastSegments(1).makeRelative().toString()); subTask(message); }
/** * shouldContinueAndMakeFileEditable method comment. */ public boolean shouldContinueAndMakeFileEditable(org.eclipse.core.resources.IFile aFile) { if (aFile == null) return false; String error = WTPResourceHandler.getString("Unable_to_save_read-only_f_ERROR_", new Object[]{aFile.getFullPath()}); //$NON-NLS-1$ = "Unable to save read-only file: " Logger.getLogger().logError(error); return false; } }
private InputStream createInputStream(IFile propertiesFile) throws CoreException { ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager(); if (manager != null) { ITextFileBuffer buffer= manager.getTextFileBuffer(propertiesFile.getFullPath(), LocationKind.IFILE); if (buffer != null) { return new ByteArrayInputStream(buffer.getDocument().get().getBytes()); } } return propertiesFile.getContents(); }
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); }
private InputStream createInputStream(IFile propertiesFile) throws CoreException { ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager(); if (manager != null) { ITextFileBuffer buffer= manager.getTextFileBuffer(propertiesFile.getFullPath(), LocationKind.IFILE); if (buffer != null) { return new ByteArrayInputStream(buffer.getDocument().get().getBytes()); } } return propertiesFile.getContents(); }
protected void saveToIFile(IFile iFile, InputStream in) throws Exception { validateEdit(iFile); if (iFile.exists()) iFile.setContents(in, true, true, null); else { mkdirs(iFile.getFullPath().removeLastSegments(1), ResourcesPlugin.getWorkspace().getRoot()); iFile.create(in, true, null); } }
private static String getFileContents(IFile file) throws CoreException { ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager(); IPath path= file.getFullPath(); manager.connect(path, LocationKind.IFILE, new NullProgressMonitor()); try { return manager.getTextFileBuffer(path, LocationKind.IFILE).getDocument().get(); } finally { manager.disconnect(path, LocationKind.IFILE, new NullProgressMonitor()); } }
/** * Trigger addition of a resource to an index * Note: the actual operation is performed in background */ public void addBinary(IFile resource, IPath containerPath) { if (JavaCore.getPlugin() == null) return; SearchParticipant participant = SearchEngine.getDefaultSearchParticipant(); SearchDocument document = participant.getDocument(resource.getFullPath().toString()); IndexLocation indexLocation = computeIndexLocation(containerPath); scheduleDocumentIndexing(document, containerPath, indexLocation, participant); } /**
/** * Trigger addition of a resource to an index * Note: the actual operation is performed in background */ public void addBinary(IFile resource, IPath containerPath) { if (JavaCore.getPlugin() == null) return; SearchParticipant participant = SearchEngine.getDefaultSearchParticipant(); SearchDocument document = participant.getDocument(resource.getFullPath().toString()); IndexLocation indexLocation = computeIndexLocation(containerPath); scheduleDocumentIndexing(document, containerPath, indexLocation, participant); } /**
protected static void saveFileIfNeeded(IFile file, IProgressMonitor pm) throws CoreException { ITextFileBuffer buffer= FileBuffers.getTextFileBufferManager().getTextFileBuffer(file.getFullPath(), LocationKind.IFILE); if (buffer != null && buffer.isDirty() && buffer.isStateValidated() && buffer.isSynchronized()) { pm.beginTask("", 2); //$NON-NLS-1$ buffer.commit(new SubProgressMonitor(pm, 1), false); file.refreshLocal(IResource.DEPTH_ONE, new SubProgressMonitor(pm, 1)); } pm.done(); } }
protected static void saveFileIfNeeded(IFile file, IProgressMonitor pm) throws CoreException { ITextFileBuffer buffer= FileBuffers.getTextFileBufferManager().getTextFileBuffer(file.getFullPath(), LocationKind.IFILE); if (buffer != null && buffer.isDirty() && buffer.isStateValidated() && buffer.isSynchronized()) { pm.beginTask("", 2); //$NON-NLS-1$ buffer.commit(new SubProgressMonitor(pm, 1), false); file.refreshLocal(IResource.DEPTH_ONE, new SubProgressMonitor(pm, 1)); } pm.done(); } }
private boolean isOutOfDate(FileMatch match) { if (match.getCreationTimeStamp() != match.getFile().getModificationStamp()) return true; ITextFileBufferManager bm= FileBuffers.getTextFileBufferManager(); ITextFileBuffer fb= bm.getTextFileBuffer(match.getFile().getFullPath(), LocationKind.IFILE); if (fb != null && fb.isDirty()) return true; return false; }