Search in sources :

Example 1 with VcsConfiguration

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

the class MavenIdeaPluginConfigurer method configure.

@Override
public void configure(@NotNull MavenProject mavenProject, @NotNull Project project, @Nullable Module module) {
    if (module == null)
        return;
    Element cfg = mavenProject.getPluginConfiguration("com.googlecode", "maven-idea-plugin");
    if (cfg == null)
        return;
    configureJdk(cfg, module);
    MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(project);
    String downloadSources = cfg.getChildTextTrim("downloadSources");
    if (!StringUtil.isEmptyOrSpaces(downloadSources)) {
        projectsManager.getImportingSettings().setDownloadSourcesAutomatically(Boolean.parseBoolean(downloadSources));
    }
    String downloadJavadocs = cfg.getChildTextTrim("downloadJavadocs");
    if (!StringUtil.isEmptyOrSpaces(downloadJavadocs)) {
        projectsManager.getImportingSettings().setDownloadDocsAutomatically(Boolean.parseBoolean(downloadJavadocs));
    }
    String assertNotNull = cfg.getChildTextTrim("assertNotNull");
    if (!StringUtil.isEmptyOrSpaces(assertNotNull)) {
        CompilerConfiguration.getInstance(project).setAddNotNullAssertions(Boolean.parseBoolean(assertNotNull));
    }
    String autoscrollToSource = cfg.getChildTextTrim("autoscrollToSource");
    if (!StringUtil.isEmptyOrSpaces(autoscrollToSource)) {
        ((ProjectViewImpl) ProjectView.getInstance(project)).setAutoscrollToSource(Boolean.parseBoolean(autoscrollToSource), ProjectViewPane.ID);
    }
    String autoscrollFromSource = cfg.getChildTextTrim("autoscrollFromSource");
    if (!StringUtil.isEmptyOrSpaces(autoscrollFromSource)) {
        ((ProjectViewImpl) ProjectView.getInstance(project)).setAutoscrollFromSource(Boolean.parseBoolean(autoscrollFromSource), ProjectViewPane.ID);
    }
    String hideEmptyPackages = cfg.getChildTextTrim("hideEmptyPackages");
    if (!StringUtil.isEmptyOrSpaces(hideEmptyPackages)) {
        ProjectView.getInstance(project).setHideEmptyPackages(Boolean.parseBoolean(hideEmptyPackages), ProjectViewPane.ID);
    }
    String optimizeImportsBeforeCommit = cfg.getChildTextTrim("optimizeImportsBeforeCommit");
    if (!StringUtil.isEmptyOrSpaces(optimizeImportsBeforeCommit)) {
        VcsConfiguration.getInstance(module.getProject()).OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT = Boolean.parseBoolean(optimizeImportsBeforeCommit);
    }
    String performCodeAnalisisBeforeCommit = cfg.getChildTextTrim("performCodeAnalisisBeforeCommit");
    if (!StringUtil.isEmptyOrSpaces(performCodeAnalisisBeforeCommit)) {
        VcsConfiguration.getInstance(module.getProject()).CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT = Boolean.parseBoolean(performCodeAnalisisBeforeCommit);
    }
    String reformatCodeBeforeCommit = cfg.getChildTextTrim("reformatCodeBeforeCommit");
    if (!StringUtil.isEmptyOrSpaces(reformatCodeBeforeCommit)) {
        VcsConfiguration vcsConfiguration = VcsConfiguration.getInstance(module.getProject());
        boolean value = Boolean.parseBoolean(reformatCodeBeforeCommit);
        vcsConfiguration.REFORMAT_BEFORE_FILE_COMMIT = value;
        vcsConfiguration.REFORMAT_BEFORE_PROJECT_COMMIT = value;
    }
}
Also used : MavenProjectsManager(org.jetbrains.idea.maven.project.MavenProjectsManager) Element(org.jdom.Element) ProjectViewImpl(com.intellij.ide.projectView.impl.ProjectViewImpl) VcsConfiguration(com.intellij.openapi.vcs.VcsConfiguration)

Example 2 with VcsConfiguration

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

the class VcsOptionsTopHitProvider method getOptions.

@NotNull
@Override
public Collection<OptionDescription> getOptions(@Nullable Project project) {
    if (project == null || ProjectLevelVcsManager.getInstance(project).getAllVcss().length == 0) {
        return Collections.emptyList();
    }
    VcsConfiguration vcs = VcsConfiguration.getInstance(project);
    if (vcs == null) {
        return Collections.emptyList();
    }
    ArrayList<BooleanOptionDescription> options = new ArrayList<>();
    // process Version Control settings
    String id = "project.propVCSSupport.Mappings";
    options.add(option(vcs, id, "Limit history by " + vcs.MAXIMUM_HISTORY_ROWS + " rows", "LIMIT_HISTORY"));
    options.add(option(vcs, id, "Show directories with changed descendants", "SHOW_DIRTY_RECURSIVELY"));
    VcsContentAnnotationSettings vcsCA = VcsContentAnnotationSettings.getInstance(project);
    if (vcsCA != null) {
        options.add(option(vcsCA, id, "Show changed in last " + vcsCA.getLimitDays() + " days", "isShow", "setShow"));
    }
    options.add(option(vcs, id, "Notify about VCS root errors", "SHOW_VCS_ERROR_NOTIFICATIONS"));
    options.add(option(vcs, id, "Commit message right margin " + vcs.COMMIT_MESSAGE_MARGIN_SIZE + " columns", "USE_COMMIT_MESSAGE_MARGIN"));
    options.add(option(vcs, id, ApplicationBundle.message("checkbox.wrap.typing.on.right.margin"), "WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN"));
    // process Version Control / Confirmation settings
    id = "project.propVCSSupport.Confirmation";
    ReadonlyStatusHandler vcsROSH = ReadonlyStatusHandler.getInstance(project);
    if (vcsROSH instanceof ReadonlyStatusHandlerImpl) {
        options.add(option(((ReadonlyStatusHandlerImpl) vcsROSH).getState(), id, "Show \"Clear Read-only Status\" Dialog", "SHOW_DIALOG"));
    }
    options.add(option(vcs, id, "Confirmation: Suggest to move uncommitted changes to another changelist", "OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT"));
    options.add(option(vcs, id, "Confirmation: Force non-empty checkin comments", "FORCE_NON_EMPTY_COMMENT"));
    options.add(option(vcs, id, "Confirmation: Clear initial commit message", "CLEAR_INITIAL_COMMIT_MESSAGE"));
    // process Version Control / Background settings
    id = "project.propVCSSupport.Background";
    options.add(option(vcs, id, "Perform in background: update from VCS", "PERFORM_UPDATE_IN_BACKGROUND"));
    options.add(option(vcs, id, "Perform in background: commit to VCS", "PERFORM_COMMIT_IN_BACKGROUND"));
    options.add(option(vcs, id, "Perform in background: checkout from VCS", "PERFORM_CHECKOUT_IN_BACKGROUND"));
    options.add(option(vcs, id, "Perform in background: Edit/Checkout", "PERFORM_EDIT_IN_BACKGROUND"));
    options.add(option(vcs, id, "Perform in background: Add/Remove", "PERFORM_ADD_REMOVE_IN_BACKGROUND"));
    options.add(option(vcs, id, "Perform in background: revert", "PERFORM_ROLLBACK_IN_BACKGROUND"));
    id = ShelfProjectConfigurable.HELP_ID;
    options.add(option(vcs, id, VcsBundle.message("vcs.shelf.store.base.content"), "INCLUDE_TEXT_INTO_SHELF"));
    if (!project.isDefault()) {
        // process Version Control / Changelist Conflicts settings
        options.add(tracker(project, "Changelists: Enable changelist conflict tracking", "TRACKING_ENABLED"));
        options.add(tracker(project, "Changelists: Show conflict resolving dialog", "SHOW_DIALOG"));
        options.add(tracker(project, "Changelists: Highlight files with conflicts", "HIGHLIGHT_CONFLICTS"));
        options.add(tracker(project, "Changelists: Highlight files from non-active changelists", "HIGHLIGHT_NON_ACTIVE_CHANGELIST"));
    }
    return Collections.unmodifiableCollection(options);
}
Also used : ReadonlyStatusHandlerImpl(com.intellij.openapi.vcs.readOnlyHandler.ReadonlyStatusHandlerImpl) BooleanOptionDescription(com.intellij.ide.ui.search.BooleanOptionDescription) ArrayList(java.util.ArrayList) VcsContentAnnotationSettings(com.intellij.openapi.vcs.contentAnnotation.VcsContentAnnotationSettings) VcsConfiguration(com.intellij.openapi.vcs.VcsConfiguration) ReadonlyStatusHandler(com.intellij.openapi.vfs.ReadonlyStatusHandler) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with VcsConfiguration

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

the class VcsBackgroundOperationsConfigurationPanel method apply.

public void apply() throws ConfigurationException {
    VcsConfiguration settings = VcsConfiguration.getInstance(myProject);
    settings.PERFORM_COMMIT_IN_BACKGROUND = myCbCommitInBackground.isSelected();
    settings.PERFORM_UPDATE_IN_BACKGROUND = myCbUpdateInBackground.isSelected();
    settings.PERFORM_CHECKOUT_IN_BACKGROUND = myCbCheckoutInBackground.isSelected();
    settings.PERFORM_EDIT_IN_BACKGROUND = myCbEditInBackground.isSelected();
    settings.PERFORM_ADD_REMOVE_IN_BACKGROUND = myCbAddRemoveInBackground.isSelected();
    settings.PERFORM_ROLLBACK_IN_BACKGROUND = myPerformRevertInBackgroundCheckBox.isSelected();
    boolean remoteCacheStateChanged = settings.CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND != myTrackChangedOnServer.isSelected();
    if (!myProject.isDefault()) {
        settings.CHECK_LOCALLY_CHANGED_CONFLICTS_IN_BACKGROUND = myTrackChangedOnServer.isSelected();
        settings.CHANGED_ON_SERVER_INTERVAL = ((Number) myChangedOnServerInterval.getValue()).intValue();
        myCacheSettingsPanel.apply();
    }
    for (VcsShowOptionsSettingImpl setting : myPromptOptions.keySet()) {
        setting.setValue(myPromptOptions.get(setting).isSelected());
    }
    // will check if should + was started -> inside
    RemoteRevisionsCache.getInstance(myProject).updateAutomaticRefreshAlarmState(remoteCacheStateChanged);
}
Also used : VcsShowOptionsSettingImpl(com.intellij.openapi.vcs.VcsShowOptionsSettingImpl) VcsConfiguration(com.intellij.openapi.vcs.VcsConfiguration)

Example 4 with VcsConfiguration

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

the class GitHistoryProvider method reportAppendableHistory.

@Override
public void reportAppendableHistory(@NotNull FilePath path, @Nullable VcsRevisionNumber startingRevision, @NotNull final VcsAppendableHistorySessionPartner partner) throws VcsException {
    final VcsAbstractHistorySession emptySession = createSession(path, Collections.emptyList(), null);
    partner.reportCreatedEmptySession(emptySession);
    VcsConfiguration vcsConfiguration = VcsConfiguration.getInstance(myProject);
    String[] additionalArgs = vcsConfiguration.LIMIT_HISTORY ? new String[] { "--max-count=" + vcsConfiguration.MAXIMUM_HISTORY_ROWS } : ArrayUtil.EMPTY_STRING_ARRAY;
    final GitExecutableValidator validator = GitVcs.getInstance(myProject).getExecutableValidator();
    GitHistoryUtils.history(myProject, refreshPath(path), null, startingRevision == null ? GitRevisionNumber.HEAD : startingRevision, fileRevision -> partner.acceptRevision(fileRevision), exception -> {
        if (validator.checkExecutableAndNotifyIfNeeded()) {
            partner.reportException(exception);
        }
    }, additionalArgs);
}
Also used : GitExecutableValidator(git4idea.config.GitExecutableValidator) VcsConfiguration(com.intellij.openapi.vcs.VcsConfiguration)

Example 5 with VcsConfiguration

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

the class LimitHistoryCheck method init.

private void init() {
    final VcsConfiguration configuration = VcsConfiguration.getInstance(myProject);
    myLimit = configuration.LIMIT_HISTORY ? configuration.MAXIMUM_HISTORY_ROWS : -1;
    myCnt = 0;
}
Also used : 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