Search in sources :

Example 11 with ChangeList

use of com.intellij.openapi.vcs.changes.ChangeList in project intellij-community by JetBrains.

the class CommitCompletionContributor method fillCompletionVariants.

@Override
public void fillCompletionVariants(@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) {
    PsiFile file = parameters.getOriginalFile();
    Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
    if (document == null)
        return;
    CommitMessage commitMessage = document.getUserData(CommitMessage.DATA_KEY);
    if (commitMessage == null)
        return;
    result.stopHere();
    if (parameters.getInvocationCount() <= 0)
        return;
    List<ChangeList> lists = commitMessage.getChangeLists();
    if (lists.isEmpty())
        return;
    String prefix = TextFieldWithAutoCompletionListProvider.getCompletionPrefix(parameters);
    CompletionResultSet insensitive = result.caseInsensitive().withPrefixMatcher(new CamelHumpMatcher(prefix));
    for (ChangeList list : lists) {
        for (Change change : list.getChanges()) {
            ContentRevision revision = change.getAfterRevision() == null ? change.getBeforeRevision() : change.getAfterRevision();
            if (revision != null) {
                FilePath filePath = revision.getFile();
                LookupElementBuilder element = LookupElementBuilder.create(filePath.getName()).withIcon(filePath.getFileType().getIcon());
                insensitive.addElement(element);
            }
        }
    }
}
Also used : CommitMessage(com.intellij.openapi.vcs.ui.CommitMessage) ChangeList(com.intellij.openapi.vcs.changes.ChangeList) CompletionResultSet(com.intellij.codeInsight.completion.CompletionResultSet) ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) LookupElementBuilder(com.intellij.codeInsight.lookup.LookupElementBuilder) PsiFile(com.intellij.psi.PsiFile) Change(com.intellij.openapi.vcs.changes.Change) Document(com.intellij.openapi.editor.Document) CamelHumpMatcher(com.intellij.codeInsight.completion.impl.CamelHumpMatcher)

Example 12 with ChangeList

use of com.intellij.openapi.vcs.changes.ChangeList in project intellij-community by JetBrains.

the class ChangeListDetailsAction method actionPerformed.

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
    Project project = e.getRequiredData(PROJECT);
    ChangeList[] changeLists = e.getRequiredData(CHANGE_LISTS);
    showDetailsPopup(project, (CommittedChangeList) changeLists[0]);
}
Also used : Project(com.intellij.openapi.project.Project) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) ChangeList(com.intellij.openapi.vcs.changes.ChangeList)

Example 13 with ChangeList

use of com.intellij.openapi.vcs.changes.ChangeList in project intellij-community by JetBrains.

the class SetDefaultChangeListAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    Project project = e.getData(CommonDataKeys.PROJECT);
    final ChangeList[] lists = e.getData(VcsDataKeys.CHANGE_LISTS);
    assert lists != null;
    ChangeListManager.getInstance(project).setDefaultChangeList((LocalChangeList) lists[0]);
}
Also used : Project(com.intellij.openapi.project.Project) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) ChangeList(com.intellij.openapi.vcs.changes.ChangeList)

Example 14 with ChangeList

use of com.intellij.openapi.vcs.changes.ChangeList in project intellij-community by JetBrains.

the class RenameChangeListAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    Project project = e.getData(CommonDataKeys.PROJECT);
    ChangeList[] lists = e.getData(VcsDataKeys.CHANGE_LISTS);
    assert lists != null;
    final LocalChangeList list = ChangeListManager.getInstance(project).findChangeList(lists[0].getName());
    if (list != null) {
        new EditChangelistDialog(project, list).show();
    }
}
Also used : Project(com.intellij.openapi.project.Project) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) ChangeList(com.intellij.openapi.vcs.changes.ChangeList) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) EditChangelistDialog(com.intellij.openapi.vcs.changes.ui.EditChangelistDialog)

Example 15 with ChangeList

use of com.intellij.openapi.vcs.changes.ChangeList in project intellij-community by JetBrains.

the class SvnEditCommitMessageAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final DataContext dc = e.getDataContext();
    final ChangeList[] lists = VcsDataKeys.CHANGE_LISTS.getData(dc);
    final boolean enabled = lists != null && lists.length == 1 && lists[0] instanceof SvnChangeList;
    if (!enabled)
        return;
    final SvnChangeList svnList = (SvnChangeList) lists[0];
    Project project = CommonDataKeys.PROJECT.getData(dc);
    project = project == null ? ProjectManager.getInstance().getDefaultProject() : project;
    final Consumer<String> listener = VcsDataKeys.REMOTE_HISTORY_CHANGED_LISTENER.getData(dc);
    askAndEditRevision(svnList.getNumber(), svnList.getComment(), svnList.getLocation(), project, listener, false);
}
Also used : Project(com.intellij.openapi.project.Project) DataContext(com.intellij.openapi.actionSystem.DataContext) ChangeList(com.intellij.openapi.vcs.changes.ChangeList)

Aggregations

ChangeList (com.intellij.openapi.vcs.changes.ChangeList)19 Project (com.intellij.openapi.project.Project)11 CommittedChangeList (com.intellij.openapi.vcs.versionBrowser.CommittedChangeList)7 Change (com.intellij.openapi.vcs.changes.Change)6 LocalChangeList (com.intellij.openapi.vcs.changes.LocalChangeList)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 SvnChangeList (org.jetbrains.idea.svn.history.SvnChangeList)3 DataContext (com.intellij.openapi.actionSystem.DataContext)2 FilePath (com.intellij.openapi.vcs.FilePath)2 ChangeListManager (com.intellij.openapi.vcs.changes.ChangeListManager)2 ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)2 TaskManager (com.intellij.tasks.TaskManager)2 ArrayList (java.util.ArrayList)2 NotNull (org.jetbrains.annotations.NotNull)2 CompletionResultSet (com.intellij.codeInsight.completion.CompletionResultSet)1 CamelHumpMatcher (com.intellij.codeInsight.completion.impl.CamelHumpMatcher)1 LookupElementBuilder (com.intellij.codeInsight.lookup.LookupElementBuilder)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 Presentation (com.intellij.openapi.actionSystem.Presentation)1