Search in sources :

Example 21 with Configurable

use of com.intellij.openapi.options.Configurable in project android by JetBrains.

the class SdkUpdaterConfigurable method isModified.

@Override
public boolean isModified() {
    if (myPanel.isModified()) {
        return true;
    }
    // If the user modifies the channel, comes back here, and then applies the change, we want to be able to update
    // right away. Thus we mark ourselves as modified if UpdateSettingsConfigurable is modified, and then reload in
    // apply().
    DataContext dataContext = DataManager.getInstance().getDataContext(myPanel.getComponent());
    Settings data = Settings.KEY.getData(dataContext);
    if (data != null) {
        Configurable updatesConfigurable = data.find("preferences.updates");
        if (updatesConfigurable != null) {
            return updatesConfigurable.isModified();
        }
    }
    return false;
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) Configurable(com.intellij.openapi.options.Configurable) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable) Settings(com.intellij.openapi.options.ex.Settings)

Example 22 with Configurable

use of com.intellij.openapi.options.Configurable in project android by JetBrains.

the class RunSdkConfigAction method actionPerformed.

@Override
public void actionPerformed(@Nullable AnActionEvent e) {
    UsageTracker.getInstance().log(AndroidStudioEvent.newBuilder().setCategory(EventCategory.SDK_MANAGER).setKind(AndroidStudioEvent.EventKind.SDK_MANAGER_TOOLBAR_CLICKED));
    if (e != null && ActionPlaces.WELCOME_SCREEN.equals(e.getPlace())) {
        // Invoked from Welcome Screen, might not have an SDK setup yet
        AndroidSdkData sdkData = AndroidSdks.getInstance().tryToChooseAndroidSdk();
        if (sdkData == null) {
            // This probably shouldn't happen, but the check was there in the standalone launcher case...
            return;
        }
    }
    Configurable configurable = ConfigurableExtensionPointUtil.createApplicationConfigurableForProvider(SdkUpdaterConfigurableProvider.class);
    ShowSettingsUtil.getInstance().showSettingsDialog(null, configurable.getClass());
}
Also used : AndroidSdkData(org.jetbrains.android.sdk.AndroidSdkData) Configurable(com.intellij.openapi.options.Configurable)

Example 23 with Configurable

use of com.intellij.openapi.options.Configurable in project android by JetBrains.

the class IdeSettingsDialogFixture method getProjectSettingsNames.

@NotNull
public List<String> getProjectSettingsNames() {
    List<String> names = Lists.newArrayList();
    JPanel optionsEditor = field("myEditor").ofType(JPanel.class).in(getDialogWrapper()).get();
    List<JComponent> trees = findComponentsOfType(optionsEditor, "com.intellij.openapi.options.newEditor.SettingsTreeView");
    assertThat(trees).hasSize(1);
    JComponent tree = trees.get(0);
    CachingSimpleNode root = field("myRoot").ofType(CachingSimpleNode.class).in(tree).get();
    ConfigurableGroup[] groups = field("myGroups").ofType(ConfigurableGroup[].class).in(root).get();
    for (ConfigurableGroup current : groups) {
        Configurable[] configurables = current.getConfigurables();
        for (Configurable configurable : configurables) {
            names.add(configurable.getDisplayName());
        }
    }
    return names;
}
Also used : ConfigurableGroup(com.intellij.openapi.options.ConfigurableGroup) Configurable(com.intellij.openapi.options.Configurable) CachingSimpleNode(com.intellij.ui.treeStructure.CachingSimpleNode) NotNull(org.jetbrains.annotations.NotNull)

Example 24 with Configurable

use of com.intellij.openapi.options.Configurable in project android by JetBrains.

the class GradleRunnerCleanupTask method doCleanUp.

@Override
void doCleanUp(@NotNull Project project) {
    ExtensionsArea area = Extensions.getArea(project);
    ExtensionPoint<ConfigurableEP<Configurable>> projectConfigurable = area.getExtensionPoint(PROJECT_CONFIGURABLE);
    // Disable the Gradle -> Runner settings.
    for (ConfigurableEP<Configurable> configurableEP : projectConfigurable.getExtensions()) {
        if (GradleConfigurable.class.getName().equals(configurableEP.instanceClass)) {
            List<ConfigurableEP> children = new ArrayList<>();
            for (ConfigurableEP child : configurableEP.children) {
                if (!GradleRunnerConfigurable.class.getName().equals(child.instanceClass)) {
                    children.add(child);
                }
            }
            configurableEP.children = children.toArray(new ConfigurableEP[children.size()]);
        }
    }
}
Also used : ExtensionsArea(com.intellij.openapi.extensions.ExtensionsArea) ConfigurableEP(com.intellij.openapi.options.ConfigurableEP) ArrayList(java.util.ArrayList) GradleConfigurable(org.jetbrains.plugins.gradle.service.settings.GradleConfigurable) GradleConfigurable(org.jetbrains.plugins.gradle.service.settings.GradleConfigurable) GradleRunnerConfigurable(org.jetbrains.plugins.gradle.settings.GradleRunnerConfigurable) Configurable(com.intellij.openapi.options.Configurable)

Example 25 with Configurable

use of com.intellij.openapi.options.Configurable in project intellij-community by JetBrains.

the class ConfigurationErrorEvent method process.

@Override
public void process(@NotNull final TestEventXmlView xml) throws TestEventXmlView.XmlParserException {
    final String errorTitle = xml.getEventTitle();
    final String configurationErrorMsg = xml.getEventMessage();
    final boolean openSettings = xml.isEventOpenSettings();
    final Project project = getProject();
    assert project != null;
    final String message = openSettings ? String.format("<br>\n%s<br><br>\n\n<a href=\"Gradle settings\">Open gradle settings</a>", configurationErrorMsg) : String.format("<br>\n%s", configurationErrorMsg);
    GradleNotification.getInstance(project).showBalloon(errorTitle, message, NotificationType.WARNING, new NotificationListener() {

        @Override
        public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
            notification.expire();
            if ("Gradle settings".equals(event.getDescription())) {
                ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(GradleConstants.SYSTEM_ID);
                assert manager instanceof GradleManager;
                GradleManager gradleManager = (GradleManager) manager;
                Configurable configurable = gradleManager.getConfigurable(project);
                ShowSettingsUtil.getInstance().editConfigurable(project, configurable);
            } else {
                BrowserUtil.browse(event.getDescription());
            }
        }
    });
}
Also used : Project(com.intellij.openapi.project.Project) HyperlinkEvent(javax.swing.event.HyperlinkEvent) ExternalSystemManager(com.intellij.openapi.externalSystem.ExternalSystemManager) GradleManager(org.jetbrains.plugins.gradle.GradleManager) Configurable(com.intellij.openapi.options.Configurable) GradleNotification(org.jetbrains.plugins.gradle.service.project.GradleNotification) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Aggregations

Configurable (com.intellij.openapi.options.Configurable)66 SearchableConfigurable (com.intellij.openapi.options.SearchableConfigurable)32 BaseConfigurable (com.intellij.openapi.options.BaseConfigurable)8 NotNull (org.jetbrains.annotations.NotNull)8 ConfigurableGroup (com.intellij.openapi.options.ConfigurableGroup)7 UnnamedConfigurable (com.intellij.openapi.options.UnnamedConfigurable)7 Nullable (org.jetbrains.annotations.Nullable)6 Project (com.intellij.openapi.project.Project)5 ArrayList (java.util.ArrayList)5 ConfigurationException (com.intellij.openapi.options.ConfigurationException)4 ArtifactsStructureConfigurable (com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurable)4 ApplicationConfigurable (com.intellij.execution.application.ApplicationConfigurable)3 JUnitConfigurable (com.intellij.execution.junit2.configuration.JUnitConfigurable)3 DataContext (com.intellij.openapi.actionSystem.DataContext)3 Module (com.intellij.openapi.module.Module)3 TabbedConfigurable (com.intellij.openapi.options.TabbedConfigurable)3 Settings (com.intellij.openapi.options.ex.Settings)3 ActionCallback (com.intellij.openapi.util.ActionCallback)3 ExtensionsArea (com.intellij.openapi.extensions.ExtensionsArea)2 CompositeConfigurable (com.intellij.openapi.options.CompositeConfigurable)2