private List<VirtualFile> filesFor(final LocalChangeList changeList) { if (changeList == null || changeList.getChanges() == null) { return Collections.emptyList(); } final Collection<VirtualFile> filesInChanges = new HashSet<>(); for (Change change : changeList.getChanges()) { if (change.getVirtualFile() != null) { filesInChanges.add(change.getVirtualFile()); } } return new ArrayList<>(filesInChanges); }
@Override public void setMapping(@NotNull CreateChangelistAction action, @NotNull LocalChangeList changeList) throws InterruptedException { cache.mapPendingChangelistId(action, changeList.getId()); }
toDescription(local), local.getId()); P4ServerComponent.perform(myProject, clientConfigRoot.getClientConfig(), action) .whenCompleted((res) -> { if (cl == null) { UserMessage.showNotification(myProject, UserMessage.ERROR, P4Bundle.message("error.create-changelist", local.getName()), P4Bundle.message("error.create-changelist.title"), NotificationType.ERROR);
@Nullable @Override public synchronized LocalChangeList findChangeList(String name) { if (name == null) { return null; } for (LocalChangeList change : changes) { if (name.equals(change.getName())) { return change; } } return clMgr.findChangeList(name); }
if (!EqualUtil.isEqual(changelist.getComment(), ideChangeList.getComment())) { addGate.editComment(ideChangeList.getName(), changelist.getComment()); String newName = ChangelistUtil.createUniqueIdeChangeListName(changelist, ideChangeList, existingLocalChangeLists, UserProjectPreferences.getMaxChangelistNameLength(project)); if (!EqualUtil.isEqual(ideChangeList.getName(), newName)) { addGate.editName(ideChangeList.getName(), newName);
@Override public void editComment(@NotNull String name, @Nullable String comment) { LocalChangeList cl = getExisting(name); cl.setComment(comment); }
@Override public void editName(@NotNull String oldName, @NotNull String newName) { getExisting(oldName).setName(newName); }
@NotNull @Override public Collection<P4ChangelistId> getP4ChangesFor(@NotNull LocalChangeList changeList) throws InterruptedException { return new HashSet<>(cache.getLinkedChangelists(changeList.getId())); }
@NotNull public static String createUniqueIdeChangeListName(@NotNull P4LocalChangelist changelist, @Nullable LocalChangeList mappedChangeList, @NotNull List<LocalChangeList> existingLocalChangeLists, int maxLength) { String newName = getPrefix(changelist, maxLength); int index = -1; match_outer_loop: while (true) { for (LocalChangeList lcl : existingLocalChangeLists) { if (!lcl.equals(mappedChangeList) && newName.equals(lcl.getName())) { index++; // Should use message properties String count = " (" + index + ')'; newName = getPrefix(changelist, maxLength - count.length()) + count; continue match_outer_loop; } } return newName; } }
@Override public synchronized LocalChangeList findOrCreateList(String name, String comment) { LocalChangeList cl = findChangeList(name); if (cl != null) { cl.setComment(comment); return cl; } return addChangeList(name, comment); }
@Override public void setMapping(@NotNull P4ChangelistId p4ChangelistId, @NotNull LocalChangeList changeList) throws InterruptedException { cache.setLink(p4ChangelistId, changeList.getId()); }
@Override public void decorateChangeList(LocalChangeList localChangeList, ColoredTreeCellRenderer coloredTreeCellRenderer, boolean b, boolean b2, boolean b3) { BrowserPanel browserPanel = BrowserPanel.getInstance(project); //browserPanel.watch(); Map<String, Job> jobs = browserPanel.getWatched(); if (jobs.containsKey(localChangeList.getName())) { Build build = jobs.get(localChangeList.getName()).getLastBuild(); String status = build.getStatus().getStatus(); if (build.isBuilding()) { status = "Running"; } coloredTreeCellRenderer.append(String.format(" - last build #%d: %s", build.getNumber(), status), SimpleTextAttributes.GRAYED_ATTRIBUTES); coloredTreeCellRenderer.repaint(); } } }
@Override public void update(final AnActionEvent event) { super.update(event); Project project = null; try { project = DataKeys.PROJECT.getData(event.getDataContext()); if (project == null) { // check if we're loading... return; } final CheckStylePlugin checkStylePlugin = project.getComponent(CheckStylePlugin.class); if (checkStylePlugin == null) { throw new IllegalStateException("Couldn't get checkstyle plugin"); } final Presentation presentation = event.getPresentation(); final LocalChangeList changeList = ChangeListManager.getInstance(project).getDefaultChangeList(); if (changeList == null || changeList.getChanges() == null || changeList.getChanges().size() == 0) { presentation.setEnabled(false); } else { presentation.setEnabled(!checkStylePlugin.isScanInProgress()); } } catch (Throwable e) { LOG.warn("Button update failed.", e); } } }
public void linkP4ChangelistToIdeChangelist(ClientConfigRoot root, P4ChangelistId p4cl, LocalChangeList ide) { CacheComponent cc = CacheComponent.getInstance(idea.getMockProject()); // Use the state object to avoid all the work to populate the cache. ProjectCacheStore.State state = cc.getState(); assertNotNull(state); IdeChangelistCacheStore.LinkedChangelistState linkedState = new IdeChangelistCacheStore.LinkedChangelistState(); linkedState.changelistId = new P4ChangelistIdStore.State(); linkedState.changelistId.id = p4cl.getChangelistId(); linkedState.changelistId.ref = new ClientServerRefStore.State(); linkedState.changelistId.ref.clientName = root.getClientConfig().getClientname(); linkedState.changelistId.ref.serverPort = root.getServerConfig().getServerName().getFullPort(); linkedState.linkedLocalChangeId = ide.getId(); state.changelistState.linkedChangelistMap.add(linkedState); cc.loadState(state); }
@Override public void onChangeListSelected(LocalChangeList list) { model.setSelectedCurrentChanges(list.getChanges()); }
} else if (ChangeListManager.getInstance(project).getChangeList(localChangeList.getId()) == null) {