public String getActionId() { if (clientAction != null) { return clientAction.getActionId(); } assert serverAction != null; return serverAction.getActionId(); }
private ClientConfigRoot getClientFor(VirtualFile file) { ProjectConfigRegistry reg = ProjectConfigRegistry.getInstance(myProject); return reg == null ? null : reg.getClientFor(file); } }
public boolean isOnline(@Nullable ClientServerRef clientServerRef) { if (clientServerRef == null) { return false; } for (ClientConfigRoot configRoot: getRegisteredStates()) { if (clientServerRef.equals(configRoot.getClientConfig().getClientServerRef())) { return configRoot.isOnline(); } } return false; }
private static MockConfigPart createConfigPart() { return new MockConfigPart() // By using the RSH port, it means that the connection will be kept open // (NTS connection). By keeping the connection open until explicitly // disconnected, this will indirectly be testing that the // SimpleConnectionManager closes the connection. .withServerName("1234") .withUsername("u") .withNoPassword() .withClientname("client1"); }
@NotNull public String getServerDisplayId() { return getServerName().getDisplayName(); }
@NotNull public static ClientServerRef read(@NotNull State state) { P4ServerName server = P4ServerName.forPortNotNull(state.serverPort); return new ClientServerRef(server, state.clientName); }
@Override public String getRawPort() { return serverName.getFullPort(); }
@NotNull public static <R extends P4CommandRunner.ServerResult> P4CommandRunner.FutureResult<R> syncQuery(@NotNull Project project, @NotNull ServerConfig config, @NotNull P4CommandRunner.SyncServerQuery<R> query) { final Pair<P4ServerComponent, Boolean> instance = findInstance(project); P4CommandRunner.FutureResult<R> ret = instance.first.getCommandRunner().syncQuery(config, query); if (instance.second) { ret.getPromise().whenAnyState(instance.first::dispose); } return ret; }
@Override public String toString() { return clientName + "@" + serverName.getDisplayName(); } }
@Override public final void projectClosed() { disposeComponent(); }
@Override public final void disposeComponent() { dispose(); }
@Override public void addExecutionProblem(@NotNull P4CommandRunner.ResultError error) { if (client != null) { client.addExecutionProblem(error); } if (server != null) { server.addExecutionProblem(error); } } }
@NotNull @Override public String[] getDisplayParameters() { return client != null ? client.getDisplayParameters() : (server != null ? server.getDisplayParameters() : EMPTY); }
@Override public int hashCode() { return id + ref.hashCode(); }
@SuppressWarnings("unchecked") private <R extends ServerResult> R answerQuery(ServerConfig config, ServerQuery query, ServerQueryAnswer answer) { return (R) answer.answer(config, query); }
private ClientConfigRoot getClientFor(VirtualFile file) { ProjectConfigRegistry reg = ProjectConfigRegistry.getInstance(project); return reg == null ? null : reg.getClientFor(file); } }
@NotNull public static <R extends P4CommandRunner.ClientResult> P4CommandRunner.FutureResult<R> syncQuery(@NotNull Project project, @NotNull ClientConfig config, @NotNull P4CommandRunner.SyncClientQuery<R> query) { final Pair<P4ServerComponent, Boolean> instance = findInstance(project); P4CommandRunner.FutureResult<R> ret = instance.first.getCommandRunner().syncQuery(config, query); if (instance.second) { ret.getPromise().whenAnyState(instance.first::dispose); } return ret; }
private ClientConfigRoot getClientFor(VirtualFile file) { ProjectConfigRegistry reg = ProjectConfigRegistry.getInstance(project); return reg == null ? null : reg.getClientFor(file); }
private ClientConfigRoot getClientFor(FilePath file) { ProjectConfigRegistry reg = ProjectConfigRegistry.getInstance(project); return reg == null ? null : reg.getClientFor(file); }