Search in sources :

Example 11 with LocalChangeList

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

the class ChangeListChooserPanel method setSuggestedName.

public void setSuggestedName(@NotNull String name) {
    if (StringUtil.isEmptyOrSpaces(name))
        return;
    LocalChangeList changelistByName = getExistingChangelistByName(name);
    if (changelistByName != null) {
        myExistingListsCombo.setSelectedItem(changelistByName);
    } else {
        myNewNameSuggested = true;
        if (VcsConfiguration.getInstance(myProject).PRESELECT_EXISTING_CHANGELIST) {
            myExistingListsCombo.insertItemAt(LocalChangeList.createEmptyChangeList(myProject, name), 0);
            selectActiveChangeListIfExist();
        } else {
            myListPanel.setChangeListName(name);
        }
    }
    updateDescription();
}
Also used : LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList)

Example 12 with LocalChangeList

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

the class VcsHandleType method processFiles.

public void processFiles(final Collection<VirtualFile> files, @Nullable final String changelist) {
    try {
        EditFileProvider provider = myVcs.getEditFileProvider();
        assert provider != null;
        provider.editFiles(VfsUtil.toVirtualFileArray(files));
    } catch (VcsException e) {
        Messages.showErrorDialog(VcsBundle.message("message.text.cannot.edit.file", e.getLocalizedMessage()), VcsBundle.message("message.title.edit.files"));
    }
    ApplicationManager.getApplication().runWriteAction(new Runnable() {

        public void run() {
            for (final VirtualFile file : files) {
                file.refresh(false, false);
            }
        }
    });
    if (changelist != null) {
        myChangeListManager.invokeAfterUpdate(new Runnable() {

            @Override
            public void run() {
                LocalChangeList list = myChangeListManager.findChangeList(changelist);
                if (list != null) {
                    List<Change> changes = ContainerUtil.mapNotNull(files, myChangeFunction);
                    myChangeListManager.moveChangesTo(list, changes.toArray(new Change[changes.size()]));
                }
            }
        }, InvokeAfterUpdateMode.SILENT, "", ModalityState.NON_MODAL);
    }
}
Also used : EditFileProvider(com.intellij.openapi.vcs.EditFileProvider) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VcsException(com.intellij.openapi.vcs.VcsException) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) List(java.util.List)

Example 13 with LocalChangeList

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

the class RemoveChangeListAction method actionPerformed.

public void actionPerformed(@NotNull AnActionEvent e) {
    final Project project = e.getRequiredData(CommonDataKeys.PROJECT);
    final ChangeList[] selectedLists = e.getRequiredData(VcsDataKeys.CHANGE_LISTS);
    //noinspection unchecked
    ChangeListRemoveConfirmation.processLists(project, true, (Collection) Arrays.asList(selectedLists), new ChangeListRemoveConfirmation() {

        @Override
        public boolean askIfShouldRemoveChangeLists(@NotNull List<? extends LocalChangeList> lists) {
            return RemoveChangeListAction.askIfShouldRemoveChangeLists(lists, project);
        }
    });
}
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 LocalChangeList

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

the class MoveChanges method doNotify.

public void doNotify(final EventDispatcher<ChangeListListener> dispatcher) {
    if ((myMovedFrom != null) && (myListCopy != null)) {
        for (LocalChangeList fromList : myMovedFrom.keySet()) {
            final Collection<Change> changesInList = myMovedFrom.get(fromList);
            dispatcher.getMulticaster().changesMoved(changesInList, fromList, myListCopy);
        }
    }
}
Also used : LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) Change(com.intellij.openapi.vcs.changes.Change)

Example 15 with LocalChangeList

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

the class EditName method apply.

public void apply(final ChangeListWorker worker) {
    final LocalChangeList fromList = worker.getCopyByName(myFromName);
    if (fromList != null && (!fromList.isReadOnly())) {
        myResult = worker.editName(myFromName, myToName);
        myListCopy = worker.getCopyByName(myToName);
    }
}
Also used : LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList)

Aggregations

LocalChangeList (com.intellij.openapi.vcs.changes.LocalChangeList)44 ChangeListManager (com.intellij.openapi.vcs.changes.ChangeListManager)25 VirtualFile (com.intellij.openapi.vfs.VirtualFile)23 Test (org.junit.Test)20 Project (com.intellij.openapi.project.Project)8 Change (com.intellij.openapi.vcs.changes.Change)7 ChangeList (com.intellij.openapi.vcs.changes.ChangeList)5 TaskManager (com.intellij.tasks.TaskManager)3 List (java.util.List)3 Nullable (org.jetbrains.annotations.Nullable)3 ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)2 ChangeListInfo (com.intellij.tasks.ChangeListInfo)2 ArrayList (java.util.ArrayList)2 NotNull (org.jetbrains.annotations.NotNull)2 DataManager (com.intellij.ide.DataManager)1 Disposable (com.intellij.openapi.Disposable)1 com.intellij.openapi.actionSystem (com.intellij.openapi.actionSystem)1 Presentation (com.intellij.openapi.actionSystem.Presentation)1 ComboBoxAction (com.intellij.openapi.actionSystem.ex.ComboBoxAction)1 DumbAware (com.intellij.openapi.project.DumbAware)1