private void deleteResource(IFile resource) { // delete the resource try { // System.out.println("Obsolete Jar!! " + resource.getName()); resource.delete(true, null); } catch (Exception e) { // e.printStackTrace(); } }
@Override public void deleteFile(String fileName) { try { IFile file = root.getFile(new Path(fileName)); file.delete(true, new NullProgressMonitor()); } catch (CoreException e) { throw new RuntimeException(e); } }
protected static void deleteFile(IFile aFile) throws CoreException { if (aFile != null && aFile.exists()) aFile.delete(true, null); }
public static void delete(String platformResourcePath, Map<?, ?> options) throws IOException { IFile file = workspaceRoot.getFile(new Path(platformResourcePath)); try { file.delete(true, null); } catch (CoreException exception) { throw new Resource.IOWrappedException(exception); } }
public static void delete(String platformResourcePath, Map<?, ?> options) throws IOException { IFile file = workspaceRoot.getFile(new Path(platformResourcePath)); try { file.delete(true, null); } catch (CoreException exception) { throw new Resource.IOWrappedException(exception); } }
@Override void delete() throws CoreException { if (fFile.exists()) { fFile.delete(false, null); } P2TargetUtils.deleteProfile(this); }
public static void delete(IFile file) { if (notExists(file)) { return; } try { file.delete(true, null); } catch (CoreException ce) { LiferayCore.logWarning(ce); } }
public static IFile copyFileToWorkspace(Plugin srcPlugin, String srcFilePath, IFile destFile) throws IOException, CoreException { Bundle bundle = srcPlugin.getBundle(); URL bundleUrl = bundle.getResource(srcFilePath); URL fileUrl = FileLocator.toFileURL(bundleUrl); InputStream openStream = new BufferedInputStream(fileUrl.openStream()); if (destFile.exists()) { destFile.delete(true, null); } destFile.create(openStream, true, null); return destFile; } }
public static IFile copyFileToWorkspace(Plugin srcPlugin, String srcFilePath, IFile destFile) throws IOException, CoreException { Bundle bundle = srcPlugin.getBundle(); URL bundleUrl = bundle.getResource(srcFilePath); URL fileUrl = FileLocator.toFileURL(bundleUrl); InputStream openStream = new BufferedInputStream(fileUrl.openStream()); if (destFile.exists()) { destFile.delete(true, null); } destFile.create(openStream, true, null); return destFile; } }
/** * @since 2.3 */ public void deleteFile(IFile file, IProgressMonitor monitor) throws CoreException { IFileCallback callBack = getCallBack(); if ((callBack == null || callBack.beforeFileDeletion(file)) && file.exists()) { IFile traceFile = getTraceFile(file); file.delete(IResource.KEEP_HISTORY, monitor); if (traceFile != null && traceFile.exists()) { traceFile.delete(IResource.KEEP_HISTORY, monitor); } } }
protected void removeClassFile(IPath typePath, IContainer outputFolder) throws CoreException { if (typePath.lastSegment().indexOf('$') == -1) { // is not a nested type this.newState.removeQualifiedTypeName(typePath.toString()); // add dependents even when the type thinks it does not exist to be on the safe side if (JavaBuilder.DEBUG) System.out.println("Found removed type " + typePath); //$NON-NLS-1$ addDependentsOf(typePath, true); // when member types are removed, their enclosing type is structurally changed } IFile classFile = outputFolder.getFile(typePath.addFileExtension(SuffixConstants.EXTENSION_class)); if (classFile.exists()) { if (JavaBuilder.DEBUG) System.out.println("Deleting class file of removed type " + typePath); //$NON-NLS-1$ classFile.delete(IResource.FORCE, null); } }
protected void removeClassFile(IPath typePath, IContainer outputFolder) throws CoreException { if (typePath.lastSegment().indexOf('$') == -1) { // is not a nested type this.newState.removeQualifiedTypeName(typePath.toString()); // add dependents even when the type thinks it does not exist to be on the safe side if (JavaBuilder.DEBUG) System.out.println("Found removed type " + typePath); //$NON-NLS-1$ addDependentsOf(typePath, true); // when member types are removed, their enclosing type is structurally changed } IFile classFile = outputFolder.getFile(typePath.addFileExtension(SuffixConstants.EXTENSION_class)); if (classFile.exists()) { if (JavaBuilder.DEBUG) System.out.println("Deleting class file of removed type " + typePath); //$NON-NLS-1$ classFile.delete(IResource.FORCE, null); } }
protected void removeClassFile(IPath typePath, IContainer outputFolder) throws CoreException { if (typePath.lastSegment().indexOf('$') == -1) { // is not a nested type this.newState.removeQualifiedTypeName(typePath.toString()); // add dependents even when the type thinks it does not exist to be on the safe side if (JavaBuilder.DEBUG) System.out.println("Found removed type " + typePath); //$NON-NLS-1$ addDependentsOf(typePath, true); // when member types are removed, their enclosing type is structurally changed } IFile classFile = outputFolder.getFile(typePath.addFileExtension(SuffixConstants.EXTENSION_class)); if (classFile.exists()) { if (JavaBuilder.DEBUG) System.out.println("Deleting class file of removed type " + typePath); //$NON-NLS-1$ classFile.delete(IResource.FORCE, null); } }
@Override public void deleteConfigurationItem(String path) throws Exception, ReadOnlyConfigurationException { // Obtain the file IFile file = this.project.getFile(Path.fromPortableString(path)); // Do nothing if file not exists if (!(file.exists())) { return; } // Delete the file file.delete(true, this.monitor); }
public Change perform(IProgressMonitor pm) throws CoreException { try { pm.beginTask(NLSChangesMessages.deleteFile_deleting_resource, 1); IFile file= ResourcesPlugin.getWorkspace().getRoot().getFile(fPath); Assert.isNotNull(file); Assert.isTrue(file.exists()); Assert.isTrue(!file.isReadOnly()); fSource= getSource(file); CreateFileChange undo= createUndoChange(file, fPath, file.getModificationStamp(), fSource); file.delete(true, true, pm); return undo; } finally { pm.done(); } }
protected Change doDelete(IProgressMonitor pm) throws CoreException { IFile file= getFile(); Assert.isNotNull(file); Assert.isTrue(file.exists()); pm.beginTask("", 3); //$NON-NLS-1$ saveFileIfNeeded(file, new SubProgressMonitor(pm, 1)); ResourceDescription resourceDescription = ResourceDescription.fromResource(file); file.delete(false, true, new SubProgressMonitor(pm, 1)); resourceDescription.recordStateFromHistory(file, new SubProgressMonitor(pm, 1)); pm.done(); return new UndoDeleteResourceChange(resourceDescription); } }
protected void refreshLocal(IProgressMonitor monitor) throws CoreException { IProject project = fManifestFile.getProject(); project.refreshLocal(IResource.DEPTH_ONE, monitor); IFile file = project.getFile("dev.properties"); //$NON-NLS-1$ if (file.exists()) file.delete(true, false, monitor); project.refreshLocal(IResource.DEPTH_ONE, monitor); }
@Override protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { create(file.getParent()); file.delete(true, monitor()); file.create(new StringInputStream(s), true, monitor()); }
@Override protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { create(file.getParent()); file.delete(true, monitor()); file.create(new StringInputStream(s), true, monitor()); }
protected final IStatus createLinkedArchive(IProject project, String linkedFileName, File archiveFile, String linkedPathVariable, IProgressMonitor monitor) throws CoreException { IFile linkedJarFile = null; IPath pathToArchive = getLinkedPath(archiveFile, linkedPathVariable); linkedJarFile = project.getFile(linkedFileName); if (linkedJarFile.exists()) { if (isOverwriteIfNecessary()) linkedJarFile.delete(true, true, new SubProgressMonitor(monitor, 1)); else return J2EEPlugin.createErrorStatus(0, NLS.bind(EARCreationResourceHandler.CreateProjectWithLinkedJarOperation_File_already_exists_0_, linkedJarFile.getFullPath()), null); } linkedJarFile.createLink(pathToArchive, IResource.ALLOW_MISSING_LOCAL, new SubProgressMonitor(monitor, 1)); addLibraryToClasspath(project, linkedJarFile, monitor); return Status.OK_STATUS; }