Java Code Examples for org.eclipse.core.resources.IContainer#refreshLocal()
The following examples show how to use
org.eclipse.core.resources.IContainer#refreshLocal() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JDTUtils.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
public static IResource getFileOrFolder(String uriString) { IFile file = findFile(uriString); // This may return IFile even when uriString really describes a IContainer IContainer parent = file == null ? null : file.getParent(); if (parent == null) { return file; } try { parent.refreshLocal(DEPTH_ONE, null); } catch (CoreException e) { // Ignore } if (parent.findMember(file.getName()) instanceof IFolder) { return findFolder(uriString); } return file; }
Example 2
Source File: NavigatorResourceDropAssistant.java From gama with GNU General Public License v3.0 | 6 votes |
@Override public IStatus handlePluginTransferDrop(final IStructuredSelection aDragSelection, final Object aDropTarget) { final IContainer target = getActualTarget(ResourceManager.getResource(aDropTarget)); final IResource[] resources = getSelectedResources(aDragSelection); final MoveFilesAndFoldersOperation operation = new MoveFilesAndFoldersOperation(getShell()); operation.copyResources(resources, target); if (target != null && target.isAccessible()) { try { target.refreshLocal(IResource.DEPTH_ONE, null); } catch (final CoreException e) {} } return Status.OK_STATUS; }
Example 3
Source File: ResourceDropAdapterAssistant.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
public IStatus handlePluginTransferDrop(IStructuredSelection aDragSelection, Object aDropTarget) { IContainer target = getActualTarget((IResource) aDropTarget); IResource[] resources = getSelectedResources(aDragSelection); MoveFilesAndFoldersOperation operation = new MoveFilesAndFoldersOperation( getShell()); operation.copyResources(resources, target); if (target != null && target.isAccessible()) { try { target.refreshLocal(IResource.DEPTH_ONE, null); } catch (CoreException e) { } } return Status.OK_STATUS; }
Example 4
Source File: H5Wizard.java From dawnsci with Eclipse Public License 1.0 | 6 votes |
private void doFinish(IContainer container, String h5Name, IProgressMonitor monitor) { NexusFile nxfile = null; try { monitor.beginTask("Create " + h5Name, 5); final IFile file = container instanceof IFolder ? ((IFolder) container).getFile(h5Name) : ((IProject) container).getFile(h5Name); nxfile = ServiceHolder.getNexusFileFactory().newNexusFile(file.getLocation().toOSString()); nxfile.createAndOpenToWrite(); monitor.worked(1); container.refreshLocal(IResource.DEPTH_ONE, monitor); } catch (Exception ne) { logger.error("Cannot create sequence", ne); } finally { if (nxfile != null) { try { nxfile.close(); } catch (NexusException e) { logger.error("Error closing file:", e.getMessage()); } } } }
Example 5
Source File: ResourceDropAdapterAssistant.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
public IStatus handlePluginTransferDrop(IStructuredSelection aDragSelection, Object aDropTarget) { IContainer target = getActualTarget((IResource) aDropTarget); IResource[] resources = getSelectedResources(aDragSelection); MoveFilesAndFoldersOperation operation = new MoveFilesAndFoldersOperation( getShell()); operation.copyResources(resources, target); if (target != null && target.isAccessible()) { try { target.refreshLocal(IResource.DEPTH_ONE, null); } catch (CoreException e) { } } return Status.OK_STATUS; }
Example 6
Source File: PyResourceDropAdapterAssistant.java From Pydev with Eclipse Public License 1.0 | 6 votes |
@Override public IStatus handlePluginTransferDrop(IStructuredSelection aDragSelection, Object aDropTarget) { aDropTarget = getActual(aDropTarget); IContainer target = getActualTarget((IResource) aDropTarget); IResource[] resources = getSelectedResources(aDragSelection); MoveFilesAndFoldersOperation operation = new MoveFilesAndFoldersOperation(getShell()); operation.copyResources(resources, target); if (target != null && target.isAccessible()) { try { target.refreshLocal(IResource.DEPTH_ONE, null); } catch (CoreException e) { } } return Status.OK_STATUS; }
Example 7
Source File: N4JSBuilderParticipant.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * @see #refreshOutputFolders(org.eclipse.xtext.builder.IXtextBuilderParticipant.IBuildContext, Map, * IProgressMonitor) */ protected void refreshOutputFolders(IProject project, Map<String, OutputConfiguration> outputConfigurations, IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, outputConfigurations.size()); for (OutputConfiguration config : outputConfigurations.values()) { SubMonitor child = subMonitor.newChild(1); IContainer container = getContainer(project, config.getOutputDirectory()); if (null != container) { container.refreshLocal(IResource.DEPTH_INFINITE, child); } } }
Example 8
Source File: JDTUtils.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
public static void createFolders(IContainer folder, IProgressMonitor monitor) throws CoreException { if (!folder.exists() && folder instanceof IFolder) { IContainer parent = folder.getParent(); createFolders(parent, monitor); folder.refreshLocal(IResource.DEPTH_ZERO, monitor); if (!folder.exists()) { ((IFolder)folder).create(true, true, monitor); } } }
Example 9
Source File: JDTUtils.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
public static boolean isFolder(String uriString) { IFile fakeFile = findFile(uriString); // This may return IFile even when uriString really describes a IContainer IContainer parent = fakeFile == null ? null : fakeFile.getParent(); if (parent == null) { return false; } if (!parent.isSynchronized(DEPTH_ONE)) { try { parent.refreshLocal(DEPTH_ONE, null); } catch (CoreException e) { // Ignore } } return (parent.findMember(fakeFile.getName()) instanceof IFolder); }
Example 10
Source File: GWTCompileRunner.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
/** * @param processReceiver optional, receives the process after it is started */ public static void compile(IJavaProject javaProject, IPath warLocation, GWTCompileSettings settings, OutputStream consoleOutputStream, IProcessReceiver processReceiver) throws IOException, InterruptedException, CoreException, OperationCanceledException { IProject project = javaProject.getProject(); if (settings.getEntryPointModules().isEmpty()) { // Nothing to compile, so just return. return; } int processStatus = ProcessUtilities.launchProcessAndWaitFor( computeCompilerCommandLine(javaProject, warLocation, settings), project.getLocation().toFile(), consoleOutputStream, processReceiver); /* * Do a refresh on the war folder if it's in the workspace. This ensures * that Eclipse sees the generated artifacts from the GWT compile, and * doesn't complain about stale resources during subsequent file searches. */ if (warLocation != null) { for (IContainer warFolder : ResourcesPlugin.getWorkspace().getRoot() .findContainersForLocationURI(URIUtil.toURI(warLocation))) { warFolder.refreshLocal(IResource.DEPTH_INFINITE, null); } } if (processStatus != 0) { if (processReceiver != null && processReceiver.hasDestroyedProcess()) { PrintWriter printWriter = new PrintWriter(consoleOutputStream); printWriter.println("GWT compilation terminated by the user."); printWriter.flush(); throw new OperationCanceledException(); } else { throw new CoreException(new Status(IStatus.ERROR, GWTPlugin.PLUGIN_ID, "GWT compilation failed")); } } }
Example 11
Source File: OperationManager.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Ends a batch of operations. Pending changes are committed only when the * number of calls to endOperation() balances those to beginOperation(). */ public void endOperation(boolean refresh, Set<IResource> refreshResourceList, boolean refreshLocal) throws SVNException { try { if (lock.getNestingCount() == 1) { svnClient.removeNotifyListener(this); if (operationNotifyListener != null) { operationNotifyListener.clear(); //Clear progress information svnClient.setProgressListener(null); } if (refreshResourceList != null) { FilteringContainerList folderList = new FilteringContainerList(refreshResourceList); for (IContainer resource : folderList) { SVNProviderPlugin.getPlugin().getStatusCacheManager().refreshStatus((IContainer)resource, true); } IResource[] resources = new IResource[refreshResourceList.size()]; refreshResourceList.toArray(resources); SVNProviderPlugin.broadcastModificationStateChanges(resources); } if (refreshLocal) { FilteringContainerList foldersToRefresh = new FilteringContainerList(localRefreshList); for (IContainer folder : foldersToRefresh) { try { folder.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); } catch (CoreException e) {} } } } } finally { lock.release(); operationNotifyListener = null; localRefreshList = new LinkedHashSet<IResource>(); } }
Example 12
Source File: Py2To3.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@Override protected void afterRun(int resourcesAffected) { for (IContainer c : this.refresh) { try { c.refreshLocal(IResource.DEPTH_INFINITE, null); } catch (CoreException e) { Log.log(e); } } clearRunInput(); }
Example 13
Source File: LangCoreTestResources.java From goclipse with Eclipse Public License 1.0 | 5 votes |
public static void createFolderFromCoreTestsResource(String resourcePath, IContainer destFolder) throws CoreException { File destFolder_File = destFolder.getLocation().toFile(); copyFolderContentsFromCoreTestsResource(resourcePath, destFolder_File); destFolder.refreshLocal(IResource.DEPTH_INFINITE, null); assertTrue(destFolder.exists()); }
Example 14
Source File: ResourceDropAdapterAssistant.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
public IStatus handleDrop(CommonDropAdapter aDropAdapter, DropTargetEvent aDropTargetEvent, Object aTarget) { if (Policy.DEBUG_DND) { System.out .println("ResourceDropAdapterAssistant.handleDrop (begin)"); //$NON-NLS-1$ } // alwaysOverwrite = false; if (aTarget == null || aDropTargetEvent.data == null) { return Status.CANCEL_STATUS; } IStatus status = null; IResource[] resources = null; TransferData currentTransfer = aDropAdapter.getCurrentTransfer(); if (LocalSelectionTransfer.getTransfer().isSupportedType( currentTransfer)) { resources = getSelectedResources(); } else if (ResourceTransfer.getInstance().isSupportedType( currentTransfer)) { resources = (IResource[]) aDropTargetEvent.data; } if (FileTransfer.getInstance().isSupportedType(currentTransfer)) { status = performFileDrop(aDropAdapter, aDropTargetEvent.data); } else if (resources != null && resources.length > 0) { if ((aDropAdapter.getCurrentOperation() == DND.DROP_COPY) || (aDropAdapter.getCurrentOperation() == DND.DROP_LINK)) { if (Policy.DEBUG_DND) { System.out .println("ResourceDropAdapterAssistant.handleDrop executing COPY."); //$NON-NLS-1$ } status = performResourceCopy(aDropAdapter, getShell(), resources); } else { if (Policy.DEBUG_DND) { System.out .println("ResourceDropAdapterAssistant.handleDrop executing MOVE."); //$NON-NLS-1$ } status = performResourceMove(aDropAdapter, resources); } } openError(status); IContainer target = getActualTarget((IResource) aTarget); if (target != null && target.isAccessible()) { try { target.refreshLocal(IResource.DEPTH_ONE, null); } catch (CoreException e) { } } return status; }
Example 15
Source File: ResourceDropAdapterAssistant.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
public IStatus handleDrop(CommonDropAdapter aDropAdapter, DropTargetEvent aDropTargetEvent, Object aTarget) { if (Policy.DEBUG_DND) { System.out .println("ResourceDropAdapterAssistant.handleDrop (begin)"); //$NON-NLS-1$ } // alwaysOverwrite = false; if (aTarget == null || aDropTargetEvent.data == null) { return Status.CANCEL_STATUS; } IStatus status = null; IResource[] resources = null; TransferData currentTransfer = aDropAdapter.getCurrentTransfer(); if (LocalSelectionTransfer.getTransfer().isSupportedType( currentTransfer)) { resources = getSelectedResources(); } else if (ResourceTransfer.getInstance().isSupportedType( currentTransfer)) { resources = (IResource[]) aDropTargetEvent.data; } if (FileTransfer.getInstance().isSupportedType(currentTransfer)) { status = performFileDrop(aDropAdapter, aDropTargetEvent.data); } else if (resources != null && resources.length > 0) { if ((aDropAdapter.getCurrentOperation() == DND.DROP_COPY) || (aDropAdapter.getCurrentOperation() == DND.DROP_LINK)) { if (Policy.DEBUG_DND) { System.out .println("ResourceDropAdapterAssistant.handleDrop executing COPY."); //$NON-NLS-1$ } status = performResourceCopy(aDropAdapter, getShell(), resources); } else { if (Policy.DEBUG_DND) { System.out .println("ResourceDropAdapterAssistant.handleDrop executing MOVE."); //$NON-NLS-1$ } status = performResourceMove(aDropAdapter, resources); } } openError(status); IContainer target = getActualTarget((IResource) aTarget); if (target != null && target.isAccessible()) { try { target.refreshLocal(IResource.DEPTH_ONE, null); } catch (CoreException e) { } } return status; }
Example 16
Source File: PyResourceDropAdapterAssistant.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public IStatus handleDrop(CommonDropAdapter aDropAdapter, DropTargetEvent aDropTargetEvent, Object aTarget) { // aTarget = getActual(aTarget); if (DEBUG) { System.out.println("ResourceDropAdapterAssistant.handleDrop (begin)"); //$NON-NLS-1$ } // alwaysOverwrite = false; if (getCurrentTarget(aDropAdapter) == null || aDropTargetEvent.data == null) { return Status.CANCEL_STATUS; } IStatus status = null; IResource[] resources = null; TransferData currentTransfer = aDropAdapter.getCurrentTransfer(); if (LocalSelectionTransfer.getTransfer().isSupportedType(currentTransfer)) { resources = getSelectedResources(); } else if (ResourceTransfer.getInstance().isSupportedType(currentTransfer)) { resources = (IResource[]) aDropTargetEvent.data; } if (FileTransfer.getInstance().isSupportedType(currentTransfer)) { status = performFileDrop(aDropAdapter, aDropTargetEvent.data); } else if (resources != null && resources.length > 0) { if (aDropAdapter.getCurrentOperation() == DND.DROP_COPY) { if (DEBUG) { System.out.println("ResourceDropAdapterAssistant.handleDrop executing COPY."); //$NON-NLS-1$ } status = performResourceCopy(aDropAdapter, getShell(), resources); } else { if (DEBUG) { System.out.println("ResourceDropAdapterAssistant.handleDrop executing MOVE."); //$NON-NLS-1$ } status = performResourceMove(aDropAdapter, resources); } } openError(status); IContainer target = getActualTarget((IResource) getCurrentTarget(aDropAdapter)); if (target != null && target.isAccessible()) { try { target.refreshLocal(IResource.DEPTH_ONE, null); } catch (CoreException e) { } } return status; }