@Override public Optional<P4CommandRunner.ClientAction<?>> getClientActionById(@NotNull String actionId) { for (ActionStore.PendingAction action: actions) { if (action.clientAction != null && action.sourceId.equals(clientSourceId) && action.clientAction.getActionId().equals(actionId)) { return Optional.of(action.clientAction); } } return Optional.empty(); }
@Override public boolean removeActionById(@NotNull String actionId) { Iterator<ActionStore.PendingAction> iter = actions.iterator(); while (iter.hasNext()) { ActionStore.PendingAction action = iter.next(); if (isInSources(action) && actionId.equals( action.clientAction != null ? action.clientAction.getActionId() : action.serverAction != null ? action.serverAction.getActionId() : null)) { // TODO should this send out an event? // This would affect the ActionConnectionPanel. Right now ActionConnectionPanel // just refreshes on its own, rather than waiting for these events. iter.remove(); return true; } } return false; }
@NotNull public String getActionId() { if (client != null) { return client.getActionId(); } if (server != null) { return server.getActionId(); } throw new IllegalStateException("unreachable code"); }
State ret = new State(); ret.sourceId = sourceId; ret.actionId = action.getActionId(); ret.serverActionCmd = null; ret.clientActionCmd = action.getCmd();
added.clientAction.getActionId().equals(existing.clientAction.getActionId())) { if (LOG.isDebugEnabled()) { LOG.debug("Skipping duplicate action " + added.clientAction);
private void handleClientAction(@NotNull ClientActionMessage.Event event) throws InterruptedException { switch (event.getState()) { case PENDING: { pendingCache.writeActions(event.getClientRef(), (cache) -> cache.addAction(event.getAction())); break; } case COMPLETED: case FAILED: // For the purposes of this cache class, all we care about for the // fail and completed cases is removing the pending action. pendingCache.writeActions(event.getClientRef(), (cache) -> cache.removeActionById(event.getAction().getActionId())); // handling changelist specific changes to the IDE mappings is done by P4ChangeProvider break; } if (event.getClientRef() != null) { sendCachedFiles(event.getClientRef()); } }
@Override public void fileActionUpdate(@NotNull FileActionMessage.Event event) { try { if (event.getState() == FileActionMessage.ActionState.PENDING) { pendingCache.writeActions(event.getClientRef(), (store) -> store.addAction(event.getClientAction())); } else { pendingCache.writeActions(event.getClientRef(), (store) -> store.removeActionById(event.getClientAction().getActionId())); } } catch (InterruptedException e) { InternalErrorMessage.send(project).cacheLockTimeoutError(new ErrorEvent<>(new VcsInterruptedException( SERVER_CACHE_TIMEOUT_MESSAGE, e))); } // Do not fire a cache update message. }
public String getActionId() { if (clientAction != null) { return clientAction.getActionId(); } assert serverAction != null; return serverAction.getActionId(); }