public void refreshWorkspaceFile(IProgressMonitor monitor) throws CoreException { if (workspaceFile != null) workspaceFile.refreshLocal(IResource.DEPTH_ONE, monitor); }
public void refreshWorkspaceFile(IProgressMonitor monitor) throws CoreException { if (workspaceFile != null) workspaceFile.refreshLocal(IResource.DEPTH_ONE, monitor); }
/** * Refreshes the given file resource. * * @param file the file to be refreshed * @param monitor the progress monitor * @throws org.eclipse.core.runtime.CoreException if the refresh fails * @since 3.0 */ protected void refreshFile(IFile file, IProgressMonitor monitor) throws CoreException { try { file.refreshLocal(IResource.DEPTH_INFINITE, monitor); } catch (OperationCanceledException x) { } }
/** * Refreshes the given file resource. * * @param file the file to be refreshed * @param monitor the progress monitor * @throws org.eclipse.core.runtime.CoreException if the refresh fails * @since 3.0 */ protected void refreshFile(IFile file, IProgressMonitor monitor) throws CoreException { try { file.refreshLocal(IResource.DEPTH_INFINITE, monitor); } catch (OperationCanceledException x) { } }
private void syncIfNecessary(IFile result) { if (!result.isSynchronized(IResource.DEPTH_ZERO)) { try { result.refreshLocal(IResource.DEPTH_ZERO, monitor); } catch(CoreException c) { // ignore } } }
/** * Refreshes the given file. * * @param monitor the progress monitor */ protected void refreshFile(IProgressMonitor monitor) { try { fFile.refreshLocal(IResource.DEPTH_INFINITE, monitor); } catch (OperationCanceledException x) { } catch (CoreException x) { handleCoreException(x); } }
/** * Refreshes the given file. * * @param monitor the progress monitor */ protected void refreshFile(IProgressMonitor monitor) { try { fFile.refreshLocal(IResource.DEPTH_INFINITE, monitor); } catch (OperationCanceledException x) { // Ignore } catch (CoreException x) { handleCoreException(x); } }
protected void primRefreshFiles(List someFiles) throws CoreException { int size = someFiles.size(); IFile file = null; for (int i = 0; i < size; i++) { file = (IFile) someFiles.get(i); if (!file.isSynchronized(IResource.DEPTH_ZERO)) file.refreshLocal(IResource.DEPTH_ONE, null); else refreshResource(file); } }
/** * Make sure that all files that are about to be loaded are synchronized with the file system */ private void synchronizeResources(Collection<URI> toLoad) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); for(URI uri : toLoad) { Path path = new Path(uri.toPlatformString(true)); IFile file = root.getFile(path); try { if(!file.isSynchronized(IResource.DEPTH_ZERO)) { file.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor()); } } catch (CoreException e) { throw new RuntimeException(e); } } }
public void run(IProgressMonitor monitor) throws InvocationTargetException { try { operation.execute(monitor); String content = operation.getPatchContent(); if (file != null) { writeToFile(file, content); IFile[] files = ResourcesPlugin.getWorkspace() .getRoot() .findFilesForLocationURI(file.toURI()); for (int i = 0; i < files.length; i++) files[i].refreshLocal(IResource.DEPTH_ZERO, monitor); } else copyToClipboard(content); } catch (IOException e) { throw new InvocationTargetException(e); } catch (CoreException e) { throw new InvocationTargetException(e); } } });
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(); } else { pm.beginTask("", 1); //$NON-NLS-1$ pm.worked(1); pm.done(); } } }
private 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(); } else { pm.beginTask("", 1); //$NON-NLS-1$ pm.worked(1); pm.done(); } }
private 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(); } else { pm.beginTask("", 1); //$NON-NLS-1$ pm.worked(1); pm.done(); } }
public InputStream createPlatformResourceInputStream(String platformResourcePath) throws IOException { IFile file = WORKSPACE_ROOT.getFile(new Path(platformResourcePath)); try { if (!file.isSynchronized(IResource.DEPTH_ONE)) { try { File iofile = file.getFullPath().toFile(); if (iofile.exists() || file.exists()) file.refreshLocal(IResource.DEPTH_ONE, null); } catch (CoreException ce) { if (ce.getStatus().getCode() != IResourceStatus.WORKSPACE_LOCKED) throw ce; } } // CHANGED from <no-args> to <true> [94015] return file.getContents(true); } catch (CoreException exception) { throw new Resource.IOWrappedException(exception); } }
@Override public void run() { IJavaProject javaProject= m_workingProject != null ? m_workingProject : JDTUtil.getJavaProjectContext(); if(null == javaProject) { return; } PreferenceStoreUtil storage= TestNGPlugin.getPluginPreferenceStore(); IPath filePath= new Path(storage.getOutputDirectoryPath(javaProject).toOSString() + "/index.html"); IProgressMonitor progressMonitor= new NullProgressMonitor(); IFile file= ResourcesPlugin.getWorkspace().getRoot().getFile(filePath); if(null == file) return; try { file.refreshLocal(IResource.DEPTH_ZERO, progressMonitor); openEditor(file); } catch(CoreException cex) { TestNGPlugin.log(cex); // nothing I can do about it } } }
/** * @param model * @param importId * @throws CoreException */ private static void addImportToPDEModel(IPluginModel model, String importId) throws CoreException { IPluginImport importNode = model.getPluginFactory().createImport(); importNode.setId(importId); model.getPluginBase().add(importNode); IFile manifestFile = (IFile) model.getUnderlyingResource(); manifestFile.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); }
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(); } }
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(); } }
@Override public void reload(IProgressMonitor monitor) { try { m_file.refreshLocal(IResource.DEPTH_ZERO, monitor); } catch (CoreException e) { SdkLog.warning("Could not refresh file '{}'.", m_file.getLocation().toOSString(), e); } try (InputStream io = m_file.getContents()) { parseResource(io); } catch (Exception e) { SdkLog.error("cold not reload translation file: {}", m_file.getName(), e); } }