Tabnine Logo
DeleteFileAction
Code IndexAdd Tabnine to your IDE (free)

How to use
DeleteFileAction
in
net.groboclown.p4.server.api.commands.file

Best Java code snippets using net.groboclown.p4.server.api.commands.file.DeleteFileAction (Showing top 20 results out of 315)

origin: groboclown/p4ic4idea

MoveFileAction ex = (MoveFileAction) existing;
if (ex.getSourceFile().equals(added.getFile())) {
if (ex.getTargetFile().equals(added.getFile())) {
      " followed by delete of " + added.getFile() + " into a single delete of the source");
      actionFactory.create(new DeleteFileAction(ex.getSourceFile(), ex.getChangelistId())),
if (! ex.getFile().equals(added.getFile())) {
  return KEEP_BOTH_CONTINUE;
if (ex.getChangelistId().equals(added.getChangelistId())) {
  LOG.info("Duplicate delete request in " + ex.getChangelistId() + " against file " +
      ex.getFile() + " curated to keep the original.");
  return KEEP_EXISTING_REMOVE_ADDED_STOP;
LOG.info("Duplicate delete request for file " + ex.getFile() + " resolved to use changelist " +
    added.getChangelistId());
return KEEP_ADDED_REMOVE_EXISTING_CONTINUE;
origin: groboclown/p4ic4idea

@NotNull
@Override
public String[] getDisplayParameters() {
  if (changelistId != null) {
    return new String[] { changeId(changelistId) };
  }
  return EMPTY;
}
origin: groboclown/p4ic4idea

public DeleteFileAction(@NotNull FilePath file, P4ChangelistId changelistId) {
  this(createActionId(DeleteFileAction.class), file, changelistId);
}
origin: groboclown/p4ic4idea

@Override
protected void performDeletion(List<FilePath> filesToDelete) {
  VcsFileUtil.markFilesDirty(myProject, filesToDelete);
  final List<VirtualFile> affectedFiles = filesToDelete.stream().map(FilePath::getVirtualFile)
      .collect(Collectors.toList());
      Map<ClientServerRef, P4ChangelistId> activeChangelistIds = getActiveChangelistIds();
  for (FilePath filePath : filesToDelete) {
    ClientConfigRoot root = getClientFor(filePath);
    if (root != null) {
      P4ChangelistId id = getActiveChangelistFor(root, activeChangelistIds);
      if (LOG.isDebugEnabled()) {
        LOG.debug("Opening for delete: " + filePath + " (@" + id + ")");
      }
      P4ServerComponent
      .perform(myProject, root.getClientConfig(),
          new DeleteFileAction(filePath, id))
      .whenAnyState(() -> {
        if (LOG.isDebugEnabled()) {
          LOG.debug("Completed call to delete file " + filesToDelete);
        }
      });
    } else {
      LOG.info("Skipped deleting " + filePath + "; not under known P4 client");
    }
  }
}
origin: groboclown/p4ic4idea

private DeleteFileResult deleteFile(IClient client, ClientConfig config, DeleteFileAction action)
    throws P4JavaException {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Running delete against the server for " + action.getFile());
  List<IFileSpec> files = FileSpecBuildUtil.escapedForFilePaths(action.getFile());
  OpenFileStatus status = new OpenFileStatus(cmd.getFileDetailsForOpenedSpecs(client.getServer(), files, 1000));
  status.throwIfError();
    LOG.info("Skipping delete on file already open for delete: " + action.getFile());
    return new DeleteFileResult(
        config,
    LOG.info("Reverting files open for edit in preparation for delete: " + action.getFile() + "; results = " +
        MessageStatusUtil.getMessages(res, "\n"));
    MessageStatusUtil.throwIfError(res);
  List<IFileSpec> res = cmd.deleteFiles(client, files, action.getChangelistId());
origin: groboclown/p4ic4idea

    actionFactory.create(new DeleteFileAction(existing.getSourceFile(),
        existing.getChangelistId())),
    false);
LOG.debug("Remove existing action `delete " + existing.getFile() +
    "` because of a later move for the same file.");
origin: groboclown/p4ic4idea

LOG.info("Delete for file " + ex.getFile() + " removed due to later request to edit the file");
origin: groboclown/p4ic4idea

@Test
void curateFile_move_deleteTgt() {
  SimplePendingActionFactory actionFactory = new SimplePendingActionFactory(REF_A1);
  PendingActionCurator curator = new PendingActionCurator(actionFactory);
  Map<String, MockVirtualFile> fs = MockVirtualFileSystem.createTree(
      "a.txt", "abc",
      "b.txt", "def"
  );
  MockVirtualFile srcFile = fs.get("a.txt");
  MockVirtualFile tgtFile = fs.get("b.txt");
  List<ActionStore.PendingAction> actions = new ArrayList<>();
  P4ChangelistIdImpl cl1 = new P4ChangelistIdImpl(100, REF_A1);
  P4ChangelistIdImpl cl2 = new P4ChangelistIdImpl(100, REF_A1);
  ActionStore.PendingAction moveFile = ActionStore.createPendingAction(REF_A1,
      new MoveFileAction(srcFile.asFilePath(), tgtFile.asFilePath(), cl1));
  actions.add(moveFile);
  ActionStore.PendingAction deleteFile = ActionStore.createPendingAction(REF_A1,
      new DeleteFileAction(tgtFile.asFilePath(), cl2));
  curator.curateActionList(deleteFile, actions);
  assertSize(1, actionFactory.created);
  ActionStore.PendingAction created = actionFactory.created.get(0);
  assertContainsExactly(actions, created);
  assertNull(created.serverAction);
  assertNotNull(created.clientAction);
  assertEquals(created.clientAction.getClass(), DeleteFileAction.class);
  DeleteFileAction createdDelete = (DeleteFileAction) created.clientAction;
  assertEquals(cl1, createdDelete.getChangelistId());
}
origin: groboclown/p4ic4idea

  return ((AddEditAction) action).getChangelistId();
case DELETE_FILE:
  return ((DeleteFileAction) action).getChangelistId();
case REVERT_FILE:
  return null;
origin: groboclown/p4ic4idea

@Test
void curateFile_delete_delete_sameCl() {
  PendingActionCurator.PendingActionFactory actionFactory = mock(PendingActionCurator.PendingActionFactory.class);
  PendingActionCurator curator = new PendingActionCurator(actionFactory);
  List<ActionStore.PendingAction> actions = new ArrayList<>();
  P4ChangelistIdImpl cl1 = new P4ChangelistIdImpl(100, REF_A1);
  Map<String, MockVirtualFile> fs = MockVirtualFileSystem.createTree(
      "a.txt", "abc"
  );
  MockVirtualFile f1 = fs.get("a.txt");
  ActionStore.PendingAction firstDelete = ActionStore.createPendingAction(REF_A1,
      new DeleteFileAction(f1.asFilePath(), cl1));
  actions.add(firstDelete);
  ActionStore.PendingAction secondDelete = ActionStore.createPendingAction(REF_A1,
      new DeleteFileAction(f1.asFilePath(), cl1));
  curator.curateActionList(secondDelete, actions);
  // The first delete should be curated, so that the intention of the second delete's changelist is maintained.
  assertContainsExactly(actions, firstDelete);
}
origin: groboclown/p4ic4idea

P4LocalFileImpl.Builder builder = files.get(a.getFile());
if (builder == null) {
  builder = new P4LocalFileImpl.Builder()
      .withLocal(a.getFile())
      .withHave(new P4Revision(-1));
  files.put(a.getFile(), builder);
    .withChangelist(a.getChangelistId());
break;
origin: groboclown/p4ic4idea

return performFileAction(config, action, fileAction.getFile(), null,
    P4FileAction.DELETE);
origin: groboclown/p4ic4idea

actions.add(moveFile);
ActionStore.PendingAction deleteFile = ActionStore.createPendingAction(REF_A1,
    new DeleteFileAction(tgt.asFilePath(), cl2));
assertEquals(createdDelete.clientAction.getClass(), DeleteFileAction.class);
DeleteFileAction deleteAction = (DeleteFileAction) createdDelete.clientAction;
assertEquals(src.asFilePath(), deleteAction.getFile());
assertEquals(cl1, deleteAction.getChangelistId());
assertContainsExactly(actions, addFile, createdDelete);
origin: groboclown/p4ic4idea

@Test
void curateFile_delete_delete_diffCl() {
  PendingActionCurator.PendingActionFactory actionFactory = mock(PendingActionCurator.PendingActionFactory.class);
  PendingActionCurator curator = new PendingActionCurator(actionFactory);
  List<ActionStore.PendingAction> actions = new ArrayList<>();
  P4ChangelistIdImpl cl1 = new P4ChangelistIdImpl(100, REF_A1);
  P4ChangelistIdImpl cl2 = new P4ChangelistIdImpl(101, REF_A1);
  Map<String, MockVirtualFile> fs = MockVirtualFileSystem.createTree(
      "a.txt", "abc"
  );
  MockVirtualFile f1 = fs.get("a.txt");
  ActionStore.PendingAction firstDelete = ActionStore.createPendingAction(REF_A1,
      new DeleteFileAction(f1.asFilePath(), cl1));
  actions.add(firstDelete);
  ActionStore.PendingAction secondDelete = ActionStore.createPendingAction(REF_A1,
      new DeleteFileAction(f1.asFilePath(), cl2));
  curator.curateActionList(secondDelete, actions);
  // The first delete should be curated, so that the intention of the second delete's changelist is maintained.
  assertContainsExactly(actions, secondDelete);
}
origin: groboclown/p4ic4idea

DeleteFileAction a = (DeleteFileAction) action;
ret.data
    .putFilePath("file", a.getFile())
    .putChangelistId("cl-id", a.getChangelistId());
break;
origin: groboclown/p4ic4idea

(ClientActionRunner<DeleteFileResult>) (config, action) ->
  new ActionAnswerImpl<>(connectionManager.withConnection(config,
    ((DeleteFileAction) action).getFile().getIOFile().getParentFile(),
    (client) -> deleteFile(client, config, (DeleteFileAction) action))));
origin: groboclown/p4ic4idea

        .perform(project, root.getClientConfig(), new DeleteFileAction(file, id))
        .whenCompleted((res) -> ChangeListManager.getInstance(project).scheduleUpdate(true));
if (ApplicationManager.getApplication().isDispatchThread()) {
origin: groboclown/p4ic4idea

@Test
void curateFile_add_delete() {
  Map<String, MockVirtualFile> fs = MockVirtualFileSystem.createTree(
      "a.txt", "abc"
  );
  MockVirtualFile f1 = fs.get("a.txt");
  PendingActionCurator.PendingActionFactory actionFactory = mock(PendingActionCurator.PendingActionFactory.class);
  PendingActionCurator curator = new PendingActionCurator(actionFactory);
  List<ActionStore.PendingAction> actions = new ArrayList<>();
  P4ChangelistIdImpl cl = new P4ChangelistIdImpl(100, REF_A1);
  ActionStore.PendingAction addFile = ActionStore.createPendingAction(REF_A1, new AddEditAction(
      f1.asFilePath(), null, cl, (String) null));
  actions.add(addFile);
  ActionStore.PendingAction deleteFile =
      ActionStore.createPendingAction(REF_A1, new DeleteFileAction(f1.asFilePath(), cl));
  curator.curateActionList(deleteFile, actions);
  // Delete file cannot tell if the file was open for add or edit, so it must be left alone.
  assertContainsExactly(actions, addFile, deleteFile);
}
origin: groboclown/p4ic4idea

@Test
void curateFile_delete_add_delete() {
  SimplePendingActionFactory actionFactory = new SimplePendingActionFactory(REF_A1);
  PendingActionCurator curator = new PendingActionCurator(actionFactory);
  Map<String, MockVirtualFile> fs = MockVirtualFileSystem.createTree(
      "a.txt", "abc"
  );
  MockVirtualFile file = fs.get("a.txt");
  List<ActionStore.PendingAction> actions = new ArrayList<>();
  P4ChangelistIdImpl cl = new P4ChangelistIdImpl(100, REF_A1);
  ActionStore.PendingAction deleteFile = ActionStore.createPendingAction(REF_A1,
      new DeleteFileAction(file.asFilePath(), cl));
  actions.add(deleteFile);
  ActionStore.PendingAction addFile = ActionStore.createPendingAction(REF_A1,
      new AddEditAction(file.asFilePath(), null, cl, (String) null));
  actions.add(addFile);
  // Reuse the delete request
  curator.curateActionList(deleteFile, actions);
  // Because we stop looking with the delete -> add, the list should be maintained as expected.
  assertContainsExactly(actions, deleteFile, addFile, deleteFile);
}
origin: groboclown/p4ic4idea

@Test
void curateFile_delete_revert_add() {
  SimplePendingActionFactory actionFactory = new SimplePendingActionFactory(REF_A1);
  PendingActionCurator curator = new PendingActionCurator(actionFactory);
  Map<String, MockVirtualFile> fs = MockVirtualFileSystem.createTree(
      "a.txt", "abc"
  );
  MockVirtualFile file = fs.get("a.txt");
  List<ActionStore.PendingAction> actions = new ArrayList<>();
  P4ChangelistIdImpl cl = new P4ChangelistIdImpl(100, REF_A1);
  ActionStore.PendingAction deleteFile = ActionStore.createPendingAction(REF_A1,
      new DeleteFileAction(file.asFilePath(), cl));
  actions.add(deleteFile);
  ActionStore.PendingAction revertFile = ActionStore.createPendingAction(REF_A1,
      new RevertFileAction(file.asFilePath(), false));
  actions.add(revertFile);
  ActionStore.PendingAction addFile = ActionStore.createPendingAction(REF_A1,
      new AddEditAction(file.asFilePath(), null, cl, (String) null));
  curator.curateActionList(addFile, actions);
  // Because offline revert isn't implemented, the revert then add maintains the integrity.
  assertContainsExactly(actions, deleteFile, revertFile, addFile);
}
net.groboclown.p4.server.api.commands.fileDeleteFileAction

Most used methods

  • <init>
  • getFile
  • getChangelistId
  • changeId
  • createActionId

Popular in Java

  • Updating database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • setContentView (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Runner (org.openjdk.jmh.runner)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now