Search in sources :

Example 1 with BlazeUserSettings

use of com.google.idea.blaze.base.settings.BlazeUserSettings in project intellij by bazelbuild.

the class BlazeJavaRunProfileStateTest method initTest.

@Override
protected void initTest(Container applicationServices, Container projectServices) {
    projectServices.register(BlazeImportSettingsManager.class, new BlazeImportSettingsManager());
    BlazeImportSettingsManager.getInstance(getProject()).setImportSettings(DUMMY_IMPORT_SETTINGS);
    ExperimentService experimentService = new MockExperimentService();
    applicationServices.register(ExperimentService.class, experimentService);
    applicationServices.register(BlazeUserSettings.class, new BlazeUserSettings());
    projectServices.register(FastBuildService.class, new DisabledFastBuildService());
    projectServices.register(ProjectViewManager.class, new MockProjectViewManager());
    ExtensionPointImpl<TargetFinder> targetFinderEp = registerExtensionPoint(TargetFinder.EP_NAME, TargetFinder.class);
    targetFinderEp.registerExtension(new MockTargetFinder());
    ExtensionPointImpl<JavaLikeLanguage> javaLikeEp = registerExtensionPoint(JavaLikeLanguage.EP_NAME, JavaLikeLanguage.class);
    javaLikeEp.registerExtension(new JavaLikeLanguage.Java());
    registerExtensionPoint(BuildFlagsProvider.EP_NAME, BuildFlagsProvider.class);
    ExtensionPointImpl<BlazeCommandRunConfigurationHandlerProvider> handlerProviderEp = registerExtensionPoint(BlazeCommandRunConfigurationHandlerProvider.EP_NAME, BlazeCommandRunConfigurationHandlerProvider.class);
    handlerProviderEp.registerExtension(new BlazeJavaRunConfigurationHandlerProvider());
    handlerProviderEp.registerExtension(new BlazeCommandGenericRunConfigurationHandlerProvider());
    ExtensionPointImpl<BuildSystemProvider> buildSystemProviderExtensionPoint = registerExtensionPoint(BuildSystemProvider.EP_NAME, BuildSystemProvider.class);
    BuildSystemProvider buildSystemProvider = mock(BuildSystemProvider.class);
    when(buildSystemProvider.getBinaryPath()).thenReturn("/usr/bin/blaze");
    buildSystemProviderExtensionPoint.registerExtension(buildSystemProvider);
    configuration = new BlazeCommandRunConfigurationType().getFactory().createTemplateConfiguration(project);
}
Also used : BlazeImportSettingsManager(com.google.idea.blaze.base.settings.BlazeImportSettingsManager) MockExperimentService(com.google.idea.common.experiments.MockExperimentService) JavaLikeLanguage(com.google.idea.blaze.java.sync.source.JavaLikeLanguage) BlazeCommandRunConfigurationHandlerProvider(com.google.idea.blaze.base.run.confighandler.BlazeCommandRunConfigurationHandlerProvider) BuildSystemProvider(com.google.idea.blaze.base.bazel.BuildSystemProvider) BlazeCommandGenericRunConfigurationHandlerProvider(com.google.idea.blaze.base.run.confighandler.BlazeCommandGenericRunConfigurationHandlerProvider) TargetFinder(com.google.idea.blaze.base.run.targetfinder.TargetFinder) BlazeCommandRunConfigurationType(com.google.idea.blaze.base.run.BlazeCommandRunConfigurationType) BlazeUserSettings(com.google.idea.blaze.base.settings.BlazeUserSettings) ExperimentService(com.google.idea.common.experiments.ExperimentService) MockExperimentService(com.google.idea.common.experiments.MockExperimentService)

Example 2 with BlazeUserSettings

use of com.google.idea.blaze.base.settings.BlazeUserSettings in project intellij by bazelbuild.

the class BlazeUserSettingsConfigurable method reset.

@Override
public void reset() {
    BlazeUserSettings settings = BlazeUserSettings.getInstance();
    showBlazeConsoleOnSync.setSelectedItem(settings.getShowBlazeConsoleOnSync());
    suppressConsoleForRunAction.setSelected(settings.getSuppressConsoleForRunAction());
    showProblemsViewForRunAction.setSelected(settings.getShowProblemsViewForRunAction());
    resyncAutomatically.setSelected(settings.getResyncAutomatically());
    collapseProjectView.setSelected(settings.getCollapseProjectView());
    formatBuildFilesOnSave.setSelected(settings.getFormatBuildFilesOnSave());
    showAddFileToProjectNotification.setSelected(settings.getShowAddFileToProjectNotification());
    blazeBinaryPathField.setTextWithHistory(settings.getBlazeBinaryPath());
    bazelBinaryPathField.setTextWithHistory(settings.getBazelBinaryPath());
    for (BlazeUserSettingsContributor settingsContributor : settingsContributors) {
        settingsContributor.reset();
    }
}
Also used : BlazeUserSettings(com.google.idea.blaze.base.settings.BlazeUserSettings)

Example 3 with BlazeUserSettings

use of com.google.idea.blaze.base.settings.BlazeUserSettings in project intellij by bazelbuild.

the class BlazeCommandTest method initTest.

@Override
protected void initTest(@NotNull Container applicationServices, @NotNull Container projectServices) {
    ExperimentService experimentService = new MockExperimentService();
    applicationServices.register(ExperimentService.class, experimentService);
    applicationServices.register(BlazeUserSettings.class, new BlazeUserSettings());
}
Also used : MockExperimentService(com.google.idea.common.experiments.MockExperimentService) BlazeUserSettings(com.google.idea.blaze.base.settings.BlazeUserSettings) ExperimentService(com.google.idea.common.experiments.ExperimentService) MockExperimentService(com.google.idea.common.experiments.MockExperimentService)

Example 4 with BlazeUserSettings

use of com.google.idea.blaze.base.settings.BlazeUserSettings in project intellij by bazelbuild.

the class BlazeUserSettingsConfigurable method apply.

@Override
public void apply() throws ConfigurationException {
    BlazeUserSettings settings = BlazeUserSettings.getInstance();
    settings.setShowBlazeConsoleOnSync((BlazeConsolePopupBehavior) showBlazeConsoleOnSync.getSelectedItem());
    settings.setSuppressConsoleForRunAction(suppressConsoleForRunAction.isSelected());
    settings.setShowProblemsViewForRunAction(showProblemsViewForRunAction.isSelected());
    settings.setResyncAutomatically(resyncAutomatically.isSelected());
    settings.setCollapseProjectView(collapseProjectView.isSelected());
    settings.setFormatBuildFilesOnSave(formatBuildFilesOnSave.isSelected());
    settings.setShowAddFileToProjectNotification(showAddFileToProjectNotification.isSelected());
    settings.setBlazeBinaryPath(Strings.nullToEmpty(blazeBinaryPathField.getText()));
    settings.setBazelBinaryPath(Strings.nullToEmpty(bazelBinaryPathField.getText()));
    for (BlazeUserSettingsContributor settingsContributor : settingsContributors) {
        settingsContributor.apply();
    }
}
Also used : BlazeUserSettings(com.google.idea.blaze.base.settings.BlazeUserSettings)

Example 5 with BlazeUserSettings

use of com.google.idea.blaze.base.settings.BlazeUserSettings in project intellij by bazelbuild.

the class BlazeUserSettingsConfigurable method isModified.

@Override
public boolean isModified() {
    BlazeUserSettings settings = BlazeUserSettings.getInstance();
    boolean isModified = showBlazeConsoleOnSync.getSelectedItem() != settings.getShowBlazeConsoleOnSync() || suppressConsoleForRunAction.isSelected() != settings.getSuppressConsoleForRunAction() || showProblemsViewForRunAction.isSelected() != settings.getShowProblemsViewForRunAction() || resyncAutomatically.isSelected() != settings.getResyncAutomatically() || collapseProjectView.isSelected() != settings.getCollapseProjectView() || formatBuildFilesOnSave.isSelected() != settings.getFormatBuildFilesOnSave() || showAddFileToProjectNotification.isSelected() != settings.getShowAddFileToProjectNotification() || !Objects.equal(Strings.nullToEmpty(blazeBinaryPathField.getText()).trim(), Strings.nullToEmpty(settings.getBlazeBinaryPath())) || !Objects.equal(Strings.nullToEmpty(bazelBinaryPathField.getText()).trim(), Strings.nullToEmpty(settings.getBazelBinaryPath()));
    for (BlazeUserSettingsContributor settingsContributor : settingsContributors) {
        isModified |= settingsContributor.isModified();
    }
    return isModified;
}
Also used : BlazeUserSettings(com.google.idea.blaze.base.settings.BlazeUserSettings)

Aggregations

BlazeUserSettings (com.google.idea.blaze.base.settings.BlazeUserSettings)5 ExperimentService (com.google.idea.common.experiments.ExperimentService)2 MockExperimentService (com.google.idea.common.experiments.MockExperimentService)2 BuildSystemProvider (com.google.idea.blaze.base.bazel.BuildSystemProvider)1 BlazeCommandRunConfigurationType (com.google.idea.blaze.base.run.BlazeCommandRunConfigurationType)1 BlazeCommandGenericRunConfigurationHandlerProvider (com.google.idea.blaze.base.run.confighandler.BlazeCommandGenericRunConfigurationHandlerProvider)1 BlazeCommandRunConfigurationHandlerProvider (com.google.idea.blaze.base.run.confighandler.BlazeCommandRunConfigurationHandlerProvider)1 TargetFinder (com.google.idea.blaze.base.run.targetfinder.TargetFinder)1 BlazeImportSettingsManager (com.google.idea.blaze.base.settings.BlazeImportSettingsManager)1 JavaLikeLanguage (com.google.idea.blaze.java.sync.source.JavaLikeLanguage)1