Search in sources :

Example 6 with VcsConfiguration

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

the class VcsOptionsUsagesCollector method getProjectUsages.

@NotNull
public Set<UsageDescriptor> getProjectUsages(@NotNull Project project) {
    VcsConfiguration configuration = VcsConfiguration.getInstance(project);
    Set<UsageDescriptor> usages = new HashSet<>();
    usages.add(getBooleanUsage("offer.move.partially.committed", configuration.OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT));
    usages.add(getEnumUsage("offer.move.failed.committed", configuration.MOVE_TO_FAILED_COMMIT_CHANGELIST));
    usages.add(getEnumUsage("offer.remove.empty.changelist", configuration.REMOVE_EMPTY_INACTIVE_CHANGELISTS));
    usages.add(getBooleanUsage("changelist.make.new.active", configuration.MAKE_NEW_CHANGELIST_ACTIVE));
    usages.add(getBooleanUsage("changelist.preselect.existing", configuration.PRESELECT_EXISTING_CHANGELIST));
    usages.add(getBooleanUsage("perform.update.in.background", configuration.PERFORM_UPDATE_IN_BACKGROUND));
    usages.add(getBooleanUsage("perform.commit.in.background", configuration.PERFORM_COMMIT_IN_BACKGROUND));
    usages.add(getBooleanUsage("perform.edit.in.background", configuration.PERFORM_EDIT_IN_BACKGROUND));
    usages.add(getBooleanUsage("perform.checkout.in.background", configuration.PERFORM_CHECKOUT_IN_BACKGROUND));
    usages.add(getBooleanUsage("perform.add_remove.in.background", configuration.PERFORM_ADD_REMOVE_IN_BACKGROUND));
    usages.add(getBooleanUsage("perform.rollback.in.background", configuration.PERFORM_ROLLBACK_IN_BACKGROUND));
    usages.add(getBooleanUsage("commit.before.check.code.smell", configuration.CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT));
    usages.add(getBooleanUsage("commit.before.check.code.cleanup", configuration.CHECK_CODE_CLEANUP_BEFORE_PROJECT_COMMIT));
    usages.add(getBooleanUsage("commit.before.check.todo", configuration.CHECK_NEW_TODO));
    usages.add(getBooleanUsage("commit.before.check.non.empty.comment", configuration.FORCE_NON_EMPTY_COMMENT));
    usages.add(getBooleanUsage("commit.before.optimize.imports", configuration.OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT));
    usages.add(getBooleanUsage("commit.before.check.files.up.to.date", configuration.CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT));
    usages.add(getBooleanUsage("commit.before.reformat.project", configuration.REFORMAT_BEFORE_PROJECT_COMMIT));
    usages.add(getBooleanUsage("commit.before.reformat.file", configuration.REFORMAT_BEFORE_FILE_COMMIT));
    usages.add(getBooleanUsage("commit.before.rearrange", configuration.REARRANGE_BEFORE_PROJECT_COMMIT));
    usages.add(getBooleanUsage("commit.clear.initial.comment", configuration.CLEAR_INITIAL_COMMIT_MESSAGE));
    usages.add(getBooleanUsage("commit.use.right.margin", configuration.USE_COMMIT_MESSAGE_MARGIN));
    usages.add(getBooleanUsage("commit.show.unversioned", configuration.SHOW_UNVERSIONED_FILES_WHILE_COMMIT));
    usages.add(getBooleanUsage("show.changes.preview", configuration.LOCAL_CHANGES_DETAILS_PREVIEW_SHOWN));
    usages.add(getBooleanUsage("include.text.into.shelf", configuration.INCLUDE_TEXT_INTO_SHELF));
    usages.add(getBooleanUsage("check.conflicts.in.background", configuration.CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND));
    return usages;
}
Also used : UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) VcsConfiguration(com.intellij.openapi.vcs.VcsConfiguration) HashSet(com.intellij.util.containers.HashSet) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with VcsConfiguration

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

the class CommitMessage method createCommitTextEditor.

/**
   * Creates a text editor appropriate for creating commit messages.
   *
   * @param project project this commit message editor is intended for
   * @param forceSpellCheckOn if false, {@link com.intellij.openapi.vcs.VcsConfiguration#CHECK_COMMIT_MESSAGE_SPELLING} will control
   *                          whether or not the editor has spell check enabled
   * @return a commit message editor
   */
public static EditorTextField createCommitTextEditor(@NotNull Project project, boolean forceSpellCheckOn) {
    Set<EditorCustomization> features = new HashSet<>();
    VcsConfiguration configuration = VcsConfiguration.getInstance(project);
    if (configuration != null) {
        boolean enableSpellChecking = forceSpellCheckOn || configuration.CHECK_COMMIT_MESSAGE_SPELLING;
        ContainerUtil.addIfNotNull(features, SpellCheckingEditorCustomizationProvider.getInstance().getCustomization(enableSpellChecking));
        features.add(new RightMarginEditorCustomization(configuration.USE_COMMIT_MESSAGE_MARGIN, configuration.COMMIT_MESSAGE_MARGIN_SIZE));
        features.add(WrapWhenTypingReachesRightMarginCustomization.getInstance(configuration.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN));
    } else {
        ContainerUtil.addIfNotNull(features, SpellCheckingEditorCustomizationProvider.getInstance().getEnabledCustomization());
        features.add(new RightMarginEditorCustomization(false, -1));
    }
    features.add(SoftWrapsEditorCustomization.ENABLED);
    features.add(AdditionalPageAtBottomEditorCustomization.DISABLED);
    features.add(MonospaceEditorCustomization.getInstance());
    EditorTextFieldProvider service = ServiceManager.getService(project, EditorTextFieldProvider.class);
    return service.getEditorField(FileTypes.PLAIN_TEXT.getLanguage(), project, features);
}
Also used : VcsConfiguration(com.intellij.openapi.vcs.VcsConfiguration) HashSet(java.util.HashSet)

Example 8 with VcsConfiguration

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

the class OptimizeImportsBeforeCheckinHandler method runCheckinHandlers.

@Override
public void runCheckinHandlers(@NotNull final Runnable finishAction) {
    final VcsConfiguration configuration = VcsConfiguration.getInstance(myProject);
    final Collection<VirtualFile> files = myPanel.getVirtualFiles();
    final Runnable performCheckoutAction = new Runnable() {

        @Override
        public void run() {
            FileDocumentManager.getInstance().saveAllDocuments();
            finishAction.run();
        }
    };
    if (configuration.OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT && !DumbService.isDumb(myProject)) {
        new OptimizeImportsProcessor(myProject, CheckinHandlerUtil.getPsiFiles(myProject, files), COMMAND_NAME, performCheckoutAction).run();
    } else {
        finishAction.run();
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) OptimizeImportsProcessor(com.intellij.codeInsight.actions.OptimizeImportsProcessor) VcsConfiguration(com.intellij.openapi.vcs.VcsConfiguration)

Example 9 with VcsConfiguration

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

the class ReformatBeforeCheckinHandler method runCheckinHandlers.

@Override
public void runCheckinHandlers(@NotNull final Runnable finishAction) {
    final VcsConfiguration configuration = VcsConfiguration.getInstance(myProject);
    final Collection<VirtualFile> files = myPanel.getVirtualFiles();
    final Runnable performCheckoutAction = new Runnable() {

        @Override
        public void run() {
            FileDocumentManager.getInstance().saveAllDocuments();
            finishAction.run();
        }
    };
    if (reformat(configuration, true) && !DumbService.isDumb(myProject)) {
        new ReformatCodeProcessor(myProject, CheckinHandlerUtil.getPsiFiles(myProject, files), FormatterUtil.REFORMAT_BEFORE_COMMIT_COMMAND_NAME, performCheckoutAction, true).run();
    } else {
        performCheckoutAction.run();
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ReformatCodeProcessor(com.intellij.codeInsight.actions.ReformatCodeProcessor) VcsConfiguration(com.intellij.openapi.vcs.VcsConfiguration)

Example 10 with VcsConfiguration

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

the class VcsBackgroundOperationsConfigurationPanel method reset.

public void reset() {
    VcsConfiguration settings = VcsConfiguration.getInstance(myProject);
    myCbCommitInBackground.setSelected(settings.PERFORM_COMMIT_IN_BACKGROUND);
    myCbUpdateInBackground.setSelected(settings.PERFORM_UPDATE_IN_BACKGROUND);
    myCbCheckoutInBackground.setSelected(settings.PERFORM_CHECKOUT_IN_BACKGROUND);
    myCbEditInBackground.setSelected(settings.PERFORM_EDIT_IN_BACKGROUND);
    myCbAddRemoveInBackground.setSelected(settings.PERFORM_ADD_REMOVE_IN_BACKGROUND);
    myPerformRevertInBackgroundCheckBox.setSelected(settings.PERFORM_ROLLBACK_IN_BACKGROUND);
    for (VcsShowOptionsSettingImpl setting : myPromptOptions.keySet()) {
        myPromptOptions.get(setting).setSelected(setting.getValue());
    }
    if (!myProject.isDefault()) {
        myTrackChangedOnServer.setSelected(settings.CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND);
        myChangedOnServerInterval.setValue(settings.CHANGED_ON_SERVER_INTERVAL);
        myChangedOnServerInterval.setEnabled(myTrackChangedOnServer.isSelected());
        myCacheSettingsPanel.reset();
    }
}
Also used : VcsShowOptionsSettingImpl(com.intellij.openapi.vcs.VcsShowOptionsSettingImpl) VcsConfiguration(com.intellij.openapi.vcs.VcsConfiguration)

Aggregations

VcsConfiguration (com.intellij.openapi.vcs.VcsConfiguration)11 VcsShowOptionsSettingImpl (com.intellij.openapi.vcs.VcsShowOptionsSettingImpl)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 NotNull (org.jetbrains.annotations.NotNull)2 OptimizeImportsProcessor (com.intellij.codeInsight.actions.OptimizeImportsProcessor)1 ReformatCodeProcessor (com.intellij.codeInsight.actions.ReformatCodeProcessor)1 ProjectViewImpl (com.intellij.ide.projectView.impl.ProjectViewImpl)1 BooleanOptionDescription (com.intellij.ide.ui.search.BooleanOptionDescription)1 UsageDescriptor (com.intellij.internal.statistic.beans.UsageDescriptor)1 VcsContentAnnotationSettings (com.intellij.openapi.vcs.contentAnnotation.VcsContentAnnotationSettings)1 ReadonlyStatusHandlerImpl (com.intellij.openapi.vcs.readOnlyHandler.ReadonlyStatusHandlerImpl)1 ReadonlyStatusHandler (com.intellij.openapi.vfs.ReadonlyStatusHandler)1 HashSet (com.intellij.util.containers.HashSet)1 GitExecutableValidator (git4idea.config.GitExecutableValidator)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Element (org.jdom.Element)1 MavenProjectsManager (org.jetbrains.idea.maven.project.MavenProjectsManager)1