Package org.eclipse.egit.core.op

Examples of org.eclipse.egit.core.op.RemoveFromIndexOperation


  public Object execute(ExecutionEvent event) throws ExecutionException {
    final IPath[] sel = getSelectedLocations(event);
    if (sel.length == 0)
      return null;

    final RemoveFromIndexOperation removeOperation = new RemoveFromIndexOperation(Arrays.asList(sel));
    Job job = new Job(UIText.RemoveFromIndexAction_removingFiles) {
      @Override
      protected IStatus run(IProgressMonitor monitor) {
        try {
          removeOperation.execute(monitor);
        } catch (CoreException e) {
          return Activator.createErrorStatus(e.getStatus()
              .getMessage(), e);
        } finally {
          monitor.done();
        }

        return Status.OK_STATUS;
      }

      @Override
      public boolean belongsTo(Object family) {
        if (JobFamilies.REMOVE_FROM_INDEX.equals(family))
          return true;

        return super.belongsTo(family);
      }
    };
    job.setUser(true);
    job.setRule(removeOperation.getSchedulingRule());
    job.schedule();

    return null;
  }
View Full Code Here


    // given
    IFile file1 = createFileInRepo("a.txt");
    new AddToIndexOperation(asList(file1)).execute(null);

    // when
    new RemoveFromIndexOperation(Arrays.asList(file1.getLocation())).execute(null);

    // then
    assertTrue(testRepo.removedFromIndex(file1.getLocation()
        .toPortableString()));
  }
View Full Code Here

    IFile file2 = createFileInRepo("sub/b.txt");
    IFolder container = project.getProject().getFolder("sub");
    new AddToIndexOperation(asList(file1, file2)).execute(null);

    // when
    new RemoveFromIndexOperation(asList(container.getLocation())).execute(null);

    // then
    assertTrue(testRepo.removedFromIndex(file1.getLocation().toPortableString()));
    assertTrue(testRepo.removedFromIndex(file2.getLocation().toPortableString()));
  }
View Full Code Here

        new ByteArrayInputStream("other text".getBytes(project.project
            .getDefaultCharset())), 0, null);
    new AddToIndexOperation(asList(file1)).execute(null);

    // when
    new RemoveFromIndexOperation(asList(file1.getLocation())).execute(null);

    // then
    assertTrue(testRepo.removedFromIndex(file1.getLocation().toPortableString()));
  }
View Full Code Here

        new ByteArrayInputStream("other text".getBytes(project.project
            .getDefaultCharset())), 0, null);
    new AddToIndexOperation(addResources).execute(null);

    // when
    new RemoveFromIndexOperation(asList(container.getLocation())).execute(null);

    // then
    assertTrue(testRepo.removedFromIndex(file1.getLocation().toPortableString()));
    assertTrue(testRepo.removedFromIndex(file2.getLocation().toPortableString()));
  }
View Full Code Here

        new ByteArrayInputStream("other text".getBytes(project.project
            .getDefaultCharset())), 0, null);
    new AddToIndexOperation(addResources).execute(null);

    // when
    new RemoveFromIndexOperation(asList(container.getLocation())).execute(null);

    // then
    assertTrue(testRepo.removedFromIndex(file1.getLocation().toPortableString()));
    assertTrue(testRepo.removedFromIndex(file2.getLocation().toPortableString()));
  }
View Full Code Here

    IFile fileRepo2 = testUtils.addFileToProject(project2.getProject(), "2.txt", "content");
    new AddToIndexOperation(asList(fileRepo1)).execute(null);
    new AddToIndexOperation(asList(fileRepo2)).execute(null);

    // when
    new RemoveFromIndexOperation(Arrays.asList(fileRepo1.getLocation(), fileRepo2.getLocation())).execute(null);

    // then
    assertTrue(testRepo.removedFromIndex(fileRepo1.getLocation()
        .toPortableString()));
    assertTrue(testRepo.removedFromIndex(fileRepo2.getLocation()
View Full Code Here

    IFile file = testUtils.addFileToProject(project.getProject(), "file.txt", "content");
    new AddToIndexOperation(asList(file)).execute(null);

    assertTrue(testRepo.inIndex(file.getLocation().toString()));

    new RemoveFromIndexOperation(Arrays.asList(file.getLocation())).execute(null);

    assertFalse(testRepo.inIndex(file.getLocation().toString()));
    assertTrue(file.getLocation().toFile().exists());
  }
View Full Code Here

TOP

Related Classes of org.eclipse.egit.core.op.RemoveFromIndexOperation

Copyright © 2018 www.massapicom. 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.