Search in sources :

Example 1 with VcsShowConfirmationOptionImpl

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

the class ConversionResultImpl method postStartupActivity.

@Override
public void postStartupActivity(@NotNull Project project) {
    final Application application = ApplicationManager.getApplication();
    if (application.isHeadlessEnvironment() || application.isUnitTestMode()) {
        return;
    }
    List<VirtualFile> changedFiles = findVirtualFiles(myChangedFiles);
    if (!changedFiles.isEmpty()) {
        EditAction.editFilesAndShowErrors(project, changedFiles);
    }
    final List<VirtualFile> createdFiles = findVirtualFiles(myCreatedFiles);
    if (containsFilesUnderVcs(createdFiles, project)) {
        final VcsShowConfirmationOptionImpl option = new VcsShowConfirmationOptionImpl("", "", "", "", "");
        final Collection<VirtualFile> selected = AbstractVcsHelper.getInstance(project).selectFilesToProcess(createdFiles, "Files Created", "Select files to be added to version control", null, null, option);
        if (selected != null && !selected.isEmpty()) {
            final ChangeListManagerImpl changeListManager = ChangeListManagerImpl.getInstanceImpl(project);
            changeListManager.addUnversionedFiles(changeListManager.getDefaultChangeList(), new ArrayList<>(selected));
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ChangeListManagerImpl(com.intellij.openapi.vcs.changes.ChangeListManagerImpl) VcsShowConfirmationOptionImpl(com.intellij.openapi.vcs.VcsShowConfirmationOptionImpl) Application(com.intellij.openapi.application.Application)

Example 2 with VcsShowConfirmationOptionImpl

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

the class ProjectLevelVcsManagerSerialization method writeExternalUtil.

public void writeExternalUtil(@NotNull Element element, @NotNull OptionsAndConfirmations optionsAndConfirmations) throws WriteExternalException {
    final Map<String, VcsShowOptionsSettingImpl> options = optionsAndConfirmations.getOptions();
    final Map<String, VcsShowConfirmationOptionImpl> confirmations = optionsAndConfirmations.getConfirmations();
    for (VcsShowOptionsSettingImpl setting : options.values()) {
        if (!setting.getValue()) {
            Element settingElement = new Element(OPTIONS_SETTING);
            element.addContent(settingElement);
            settingElement.setAttribute(VALUE_ATTTIBUTE, Boolean.toString(setting.getValue()));
            settingElement.setAttribute(ID_ATTRIBUTE, setting.getDisplayName());
        }
    }
    for (VcsShowConfirmationOptionImpl setting : confirmations.values()) {
        if (setting.getValue() != VcsShowConfirmationOption.Value.SHOW_CONFIRMATION) {
            final Element settingElement = new Element(CONFIRMATIONS_SETTING);
            element.addContent(settingElement);
            settingElement.setAttribute(VALUE_ATTTIBUTE, setting.getValue().toString());
            settingElement.setAttribute(ID_ATTRIBUTE, setting.getDisplayName());
        }
    }
}
Also used : Element(org.jdom.Element) VcsShowConfirmationOptionImpl(com.intellij.openapi.vcs.VcsShowConfirmationOptionImpl) VcsShowOptionsSettingImpl(com.intellij.openapi.vcs.VcsShowOptionsSettingImpl)

Aggregations

VcsShowConfirmationOptionImpl (com.intellij.openapi.vcs.VcsShowConfirmationOptionImpl)2 Application (com.intellij.openapi.application.Application)1 VcsShowOptionsSettingImpl (com.intellij.openapi.vcs.VcsShowOptionsSettingImpl)1 ChangeListManagerImpl (com.intellij.openapi.vcs.changes.ChangeListManagerImpl)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 Element (org.jdom.Element)1