Search in sources :

Example 51 with Configurable

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

the class ProjectStructureConfigurable method disposeUIResources.

@Override
public void disposeUIResources() {
    if (!myUiInitialized)
        return;
    final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(myProject);
    propertiesComponent.setValue("project.structure.last.edited", myUiState.lastEditedConfigurable);
    propertiesComponent.setValue("project.structure.proportion", String.valueOf(myUiState.proportion));
    propertiesComponent.setValue("project.structure.side.proportion", String.valueOf(myUiState.sideProportion));
    myUiState.proportion = mySplitter.getProportion();
    saveSideProportion();
    myContext.getDaemonAnalyzer().stop();
    for (Configurable each : myName2Config) {
        each.disposeUIResources();
    }
    myContext.clear();
    myName2Config.clear();
    myModuleConfigurator.getFacetsConfigurator().clearMaps();
    myUiInitialized = false;
}
Also used : Configurable(com.intellij.openapi.options.Configurable) BaseConfigurable(com.intellij.openapi.options.BaseConfigurable) ArtifactsStructureConfigurable(com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurable) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable) PropertiesComponent(com.intellij.ide.util.PropertiesComponent)

Example 52 with Configurable

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

the class ProjectStructureConfigurable method reset.

@Override
public void reset() {
    // need this to ensure VFS operations will not block because of storage flushing
    // and other maintenance IO tasks run in background
    AccessToken token = HeavyProcessLatch.INSTANCE.processStarted("Resetting Project Structure");
    try {
        myContext.reset();
        myProjectJdksModel.reset(myProject);
        Configurable toSelect = null;
        for (Configurable each : myName2Config) {
            if (myUiState.lastEditedConfigurable != null && myUiState.lastEditedConfigurable.equals(each.getDisplayName())) {
                toSelect = each;
            }
            if (each instanceof MasterDetailsComponent) {
                ((MasterDetailsComponent) each).setHistory(myHistory);
            }
            each.reset();
        }
        myHistory.clear();
        if (toSelect == null && myName2Config.size() > 0) {
            toSelect = myName2Config.iterator().next();
        }
        removeSelected();
        navigateTo(toSelect != null ? createPlaceFor(toSelect) : null, false);
        if (myUiState.proportion > 0) {
            mySplitter.setProportion(myUiState.proportion);
        }
    } finally {
        token.finish();
    }
}
Also used : AccessToken(com.intellij.openapi.application.AccessToken) MasterDetailsComponent(com.intellij.openapi.ui.MasterDetailsComponent) Configurable(com.intellij.openapi.options.Configurable) BaseConfigurable(com.intellij.openapi.options.BaseConfigurable) ArtifactsStructureConfigurable(com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurable) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable)

Example 53 with Configurable

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

the class ProjectStructureConfigurable method navigateTo.

@Override
public ActionCallback navigateTo(@Nullable final Place place, final boolean requestFocus) {
    final Configurable toSelect = (Configurable) place.getPath(CATEGORY);
    JComponent detailsContent = myDetails.getTargetComponent();
    if (mySelectedConfigurable != toSelect) {
        if (mySelectedConfigurable instanceof BaseStructureConfigurable) {
            ((BaseStructureConfigurable) mySelectedConfigurable).onStructureUnselected();
        }
        saveSideProportion();
        removeSelected();
        if (toSelect != null) {
            detailsContent = toSelect.createComponent();
            myDetails.setContent(detailsContent);
        }
        mySelectedConfigurable = toSelect;
        if (mySelectedConfigurable != null) {
            myUiState.lastEditedConfigurable = mySelectedConfigurable.getDisplayName();
        }
        if (toSelect instanceof MasterDetailsComponent) {
            final MasterDetailsComponent masterDetails = (MasterDetailsComponent) toSelect;
            if (myUiState.sideProportion > 0) {
                masterDetails.getSplitter().setProportion(myUiState.sideProportion);
            }
            masterDetails.setHistory(myHistory);
        }
        if (toSelect instanceof DetailsComponent.Facade) {
            ((DetailsComponent.Facade) toSelect).getDetailsComponent().setBannerMinHeight(myToolbarComponent.getPreferredSize().height);
        }
        if (toSelect instanceof BaseStructureConfigurable) {
            ((BaseStructureConfigurable) toSelect).onStructureSelected();
        }
    }
    if (detailsContent != null) {
        JComponent toFocus = IdeFocusTraversalPolicy.getPreferredFocusedComponent(detailsContent);
        if (toFocus == null) {
            toFocus = detailsContent;
        }
        if (requestFocus) {
            myToFocus = toFocus;
            UIUtil.requestFocus(toFocus);
        }
    }
    final ActionCallback result = new ActionCallback();
    Place.goFurther(toSelect, place, requestFocus).notifyWhenDone(result);
    myDetails.revalidate();
    myDetails.repaint();
    if (toSelect != null) {
        mySidePanel.select(createPlaceFor(toSelect));
    }
    if (!myHistory.isNavigatingNow() && mySelectedConfigurable != null) {
        myHistory.pushQueryPlace();
    }
    return result;
}
Also used : DetailsComponent(com.intellij.openapi.ui.DetailsComponent) MasterDetailsComponent(com.intellij.openapi.ui.MasterDetailsComponent) ActionCallback(com.intellij.openapi.util.ActionCallback) MasterDetailsComponent(com.intellij.openapi.ui.MasterDetailsComponent) Configurable(com.intellij.openapi.options.Configurable) BaseConfigurable(com.intellij.openapi.options.BaseConfigurable) ArtifactsStructureConfigurable(com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurable) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable)

Example 54 with Configurable

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

the class ProjectStructureConfigurable method apply.

@Override
public void apply() throws ConfigurationException {
    LOG.assertTrue(TransactionGuard.getInstance().getContextTransaction() != null, "Project Structure should be shown in a transaction, see AnAction#startInTransaction");
    for (Configurable each : myName2Config) {
        if (each instanceof BaseStructureConfigurable && each.isModified()) {
            ((BaseStructureConfigurable) each).checkCanApply();
        }
    }
    final Ref<ConfigurationException> exceptionRef = Ref.create();
    try {
        for (Configurable each : myName2Config) {
            if (each.isModified()) {
                each.apply();
            }
        }
    } catch (ConfigurationException e) {
        exceptionRef.set(e);
    }
    if (!exceptionRef.isNull()) {
        throw exceptionRef.get();
    }
    myContext.getDaemonAnalyzer().clearCaches();
    BuildManager.getInstance().scheduleAutoMake();
}
Also used : ConfigurationException(com.intellij.openapi.options.ConfigurationException) Configurable(com.intellij.openapi.options.Configurable) BaseConfigurable(com.intellij.openapi.options.BaseConfigurable) ArtifactsStructureConfigurable(com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurable) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable)

Example 55 with Configurable

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

the class OpenGradleSettingsCallback method hyperlinkActivated.

@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
    ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(GradleConstants.SYSTEM_ID);
    assert manager instanceof GradleManager;
    GradleManager gradleManager = (GradleManager) manager;
    final Configurable configurable = gradleManager.getConfigurable(myProject);
    ShowSettingsUtil.getInstance().editConfigurable(myProject, configurable);
}
Also used : GradleManager(org.jetbrains.plugins.gradle.GradleManager) Configurable(com.intellij.openapi.options.Configurable)

Aggregations

Configurable (com.intellij.openapi.options.Configurable)62 SearchableConfigurable (com.intellij.openapi.options.SearchableConfigurable)31 BaseConfigurable (com.intellij.openapi.options.BaseConfigurable)8 ConfigurableGroup (com.intellij.openapi.options.ConfigurableGroup)7 NotNull (org.jetbrains.annotations.NotNull)7 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 UnnamedConfigurable (com.intellij.openapi.options.UnnamedConfigurable)3 Settings (com.intellij.openapi.options.ex.Settings)3 ActionCallback (com.intellij.openapi.util.ActionCallback)3 Nullable (org.jetbrains.annotations.Nullable)3 ExtensionsArea (com.intellij.openapi.extensions.ExtensionsArea)2 MasterDetailsComponent (com.intellij.openapi.ui.MasterDetailsComponent)2