Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IWorkspaceRoot.findMember()


      String format, IProgressMonitor monitor)
          throws CoreException {
    // create a sample file
    monitor.beginTask(NLS.bind(WizardMessages.NewCamelXMLWizard_beginTaskMessage, fileName), 2);
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    IResource resource = root.findMember(new Path(containerName));
    if (!resource.exists() || !(resource instanceof IContainer)) {
      throw (new CoreException(Activator.getLogger().createStatus(IStatus.ERROR, IStatus.ERROR, "RouteContainer \"" + containerName + "\" does not exist.", null)));
    }
    IContainer container = (IContainer) resource;
    final IFile file = container.getFile(new Path(fileName));
View Full Code Here


    IProgressMonitor monitor)
    throws CoreException {
    // create a sample file
    monitor.beginTask(NLS.bind(WizardMessages.NewCamelXMLWizard_beginTaskMessage, fileName), 2);
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    IResource resource = root.findMember(new Path(containerName));
    if (!resource.exists() || !(resource instanceof IContainer)) {
      throw (new CoreException(Activator.getLogger().createStatus(IStatus.ERROR, IStatus.ERROR, "RouteContainer \"" + containerName + "\" does not exist.", null)));
    }
    IContainer container = (IContainer) resource;
    final IFile file = container.getFile(new Path(fileName));
View Full Code Here

        IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();

        for (int i = 0; i < copyResources.length; i++) {
            IResource source = copyResources[i];
            IPath newDestinationPath = destinationPath.append(source.getName());
            IResource newDestination = workspaceRoot.findMember(newDestinationPath);
            IFolder folder;

            if (newDestination == null) {
                continue;
            }
View Full Code Here

        for (int i = 0; i < resources.length; i++) {
            IResource source = resources[i];
            IPath destinationPath = destination.append(source.getName());
            IWorkspace workspace = source.getWorkspace();
            IWorkspaceRoot workspaceRoot = workspace.getRoot();
            IResource existing = workspaceRoot.findMember(destinationPath);
            if (source.getType() == IResource.FOLDER && existing != null) {
                // the resource is a folder and it exists in the destination,
                // copy the
                // children of the folder.
                if (homogenousResources(source, existing)) {
View Full Code Here

        for (int i = 0; i < sourceResources.length; i++) {
            final IResource sourceResource = sourceResources[i];
            final IPath destinationPath = destination.getFullPath().append(sourceResource.getName());
            final IPath sourcePath = sourceResource.getFullPath();

            IResource newResource = workspaceRoot.findMember(destinationPath);
            if (newResource != null && destinationPath.isPrefixOf(sourcePath)) {
                displayError(NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_overwriteProblem,
                        destinationPath, sourcePath));

                canceled = true;
View Full Code Here

        // Check for overwrite conflicts
        for (int i = 0; i < sourceResources.length; i++) {
            final IResource source = sourceResources[i];
            final IPath destinationPath = destination.getFullPath().append(source.getName());

            IResource newResource = workspaceRoot.findMember(destinationPath);
            if (newResource != null) {
                if (overwrite != IDialogConstants.YES_TO_ALL_ID
                        || (newResource.getType() == IResource.FOLDER && homogenousResources(source, destination) == false)) {
                    overwrite = checkOverwrite(source, newResource);
                }
View Full Code Here

        // Checks only required if this is an exisiting container path.
        boolean copyWithAutoRename = false;
        IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
        if (root.exists(destinationPath)) {
            IContainer container = (IContainer) root.findMember(destinationPath);
            // If we're copying to the source container then perform
            // auto-renames on all resources to avoid name collisions.
            if (isDestinationSameAsSource(copyResources, container) && canPerformAutoRename()) {
                copyWithAutoRename = true;
            } else {
View Full Code Here

    private void copyFileStores(final IFileStore[] stores, final IPath destinationPath, IProgressMonitor monitor) {
        // Checks only required if this is an exisiting container path.
        IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
        if (root.exists(destinationPath)) {
            IContainer container = (IContainer) root.findMember(destinationPath);

            performFileImport(stores, container, monitor);
        }
    }
View Full Code Here

                //try to get relative to the workspace
                IContainer container = null;
                IResource r = null;
                try {
                    r = root.findMember(p);
                } catch (Exception e) {
                    Log.log(e);
                }

                if (!(r instanceof IContainer) && !(r instanceof IFile)) {
View Full Code Here

                if (!(r instanceof IContainer) && !(r instanceof IFile)) {

                    //If we didn't find the file, let's try to sync things, as this can happen if the workspace
                    //is still not properly synchronized.
                    String firstSegment = p.segment(0);
                    IResource firstSegmentResource = root.findMember(firstSegment);
                    if (!(firstSegmentResource instanceof IContainer) && !(firstSegmentResource instanceof IFile)) {
                        //we cannot even get the 1st part... let's do sync
                        long currentTimeMillis = System.currentTimeMillis();
                        if (doFullSynchAt == -1 || currentTimeMillis > doFullSynchAt) {
                            doFullSynchAt = currentTimeMillis + (60 * 2 * 1000); //do a full synch at most once every 2 minutes
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.