Example usage for com.intellij.openapi.options Configurable getDisplayName

List of usage examples for com.intellij.openapi.options Configurable getDisplayName

Introduction

In this page you can find the example usage for com.intellij.openapi.options Configurable getDisplayName.

Prototype

@Nls(capitalization = Nls.Capitalization.Title)
@Contract(pure = true)
String getDisplayName();

Source Link

Document

Returns the visible name of the configurable component.

Usage

From source file:com.android.tools.idea.gradle.structure.AndroidProjectStructureConfigurable.java

License:Apache License

@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 {/*w  ww.  ja v  a2  s  .c o  m*/
        for (Configurable configurable : myConfigurables) {
            configurable.reset();
        }

        if (myUiInitialized) {
            validateState();

            // Prepare module entries but don't add them until after developer services
            ModuleManager moduleManager = ModuleManager.getInstance(myProject);
            Module[] modules = moduleManager.getModules();
            Arrays.sort(modules, ModuleTypeComparator.INSTANCE);

            List<AndroidModuleConfigurable> moduleConfigurables = Lists.newArrayList();
            for (Module module : modules) {
                AndroidModuleConfigurable configurable = addModule(module);
                if (configurable != null) {
                    moduleConfigurables.add(configurable);
                }
            }

            // Populate the "Developer Services" section
            removeServices();

            if (Projects.isBuildWithGradle(myProject)) {
                DefaultComboBoxModel moduleList = new DefaultComboBoxModel();
                for (AndroidModuleConfigurable moduleConfigurable : moduleConfigurables) {
                    // Collect only Android modules
                    if (AndroidFacet.getInstance(moduleConfigurable.getModule()) != null) {
                        moduleList.addElement(moduleConfigurable.getModule());
                    }
                }

                if (!myProject.isDefault() && moduleList.getSize() > 0) {
                    // This may not be our first time opening the developer services dialog. User may have
                    // modified developer service values last time but then pressed cancel. To be safe, we
                    // restore our old values before reentering.
                    // TODO: We really should do this on cancel but it doesn't look like we have any hooks
                    // into that event.
                    for (int i = 0; i < moduleList.getSize(); i++) {
                        Module module = (Module) moduleList.getElementAt(i);
                        for (DeveloperService service : DeveloperServices.getAll(module)) {
                            service.getContext().restore();
                        }
                    }

                    Module module = (Module) moduleList.getSelectedItem();
                    Set<ServiceCategory> categories = Sets.newHashSet();
                    for (DeveloperService s : DeveloperServices.getAll(module)) {
                        if (!s.getContext().hiddenFromStructureDialog().get()) {
                            categories.add(s.getCategory());
                        }
                    }
                    ArrayList<ServiceCategory> categoriesSorted = Lists.newArrayList(categories);
                    Collections.sort(categoriesSorted);
                    for (ServiceCategory category : categoriesSorted) {
                        myConfigurables.add(new ServiceCategoryConfigurable(moduleList, category));
                    }
                }
            }

            // Populate the "Modules" section.
            removeModules();
            Module toSelect = null;
            for (Module module : modules) {
                AndroidModuleConfigurable configurable = addModule(module);
                if (configurable != null) {
                    myConfigurables.add(configurable);
                    if (configurable.getDisplayName().equals(myUiState.lastSelectedConfigurable)) {
                        toSelect = module;
                    }
                }
            }

            if (myUiState.proportion > 0) {
                mySplitter.setProportion(myUiState.proportion);
            }

            mySidePanel.reset();
            if (toSelect != null) {
                mySidePanel.select(toSelect);
            } else {
                mySidePanel.selectSdk();
            }
        }
    } finally {
        token.finish();
    }
}

From source file:com.android.tools.idea.gradle.structure.AndroidProjectStructureConfigurable.java

License:Apache License

private void selectConfigurable(@NotNull Configurable configurable) {
    String appId = getApplicationId(myProject);
    if (appId != null) {
        UsageTracker.getInstance()//from w w  w  .  java2  s  .  co  m
                .log(AndroidStudioEvent.newBuilder().setCategory(EventCategory.PROJECT_STRUCTURE_DIALOG)
                        .setKind(EventKind.PROJECT_STRUCTURE_DIALOG_LEFT_NAV_CLICK)
                        .setProjectId(AndroidStudioUsageTracker.anonymizeUtf8(appId)));
    }
    JComponent content = configurable.createComponent();
    assert content != null;
    myDetails.setContent(content);
    myUiState.lastSelectedConfigurable = configurable.getDisplayName();
    revalidateAndRepaint(myDetails);
}

From source file:com.android.tools.idea.structure.AndroidProjectStructureConfigurable.java

License:Apache License

@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 {/*  w w w .j  a v  a 2 s  . c  o m*/
        for (Configurable configurable : myConfigurables) {
            configurable.reset();
        }

        if (myUiInitialized) {
            validateState();

            // Prepare module entries but don't add them until after developer services
            ModuleManager moduleManager = ModuleManager.getInstance(myProject);
            Module[] modules = moduleManager.getModules();
            Arrays.sort(modules, ModuleTypeComparator.INSTANCE);

            List<AndroidModuleConfigurable> moduleConfigurables = Lists.newArrayList();
            for (Module module : modules) {
                AndroidModuleConfigurable configurable = addModule(module);
                if (configurable != null) {
                    moduleConfigurables.add(configurable);
                }
            }

            // Populate the "Developer Services" section
            removeServices();

            DefaultComboBoxModel moduleList = new DefaultComboBoxModel();
            for (AndroidModuleConfigurable moduleConfigurable : moduleConfigurables) {
                // Collect only Android modules
                if (AndroidFacet.getInstance(moduleConfigurable.getModule()) != null) {
                    moduleList.addElement(moduleConfigurable.getModule());
                }
            }

            if (!myProject.isDefault() && moduleList.getSize() > 0) {
                // We may have modified service values previous but then cancelled this dialog. To be
                // safe, we restore our old values now.
                // TODO: We really should do this on cancel but it doesn't look like we have any hooks
                // into that event.
                for (int i = 0; i < moduleList.getSize(); i++) {
                    Module module = (Module) moduleList.getElementAt(i);
                    for (DeveloperService service : DeveloperServices.getAll(module)) {
                        service.getContext().restore();
                    }
                }

                Module module = (Module) moduleList.getSelectedItem();
                Set<ServiceCategory> categories = Sets.newHashSet();
                for (DeveloperService s : DeveloperServices.getAll(module)) {
                    categories.add(s.getCategory());
                }
                ArrayList<ServiceCategory> categoriesSorted = Lists.newArrayList(categories);
                Collections.sort(categoriesSorted);
                for (ServiceCategory category : categoriesSorted) {
                    myConfigurables.add(new ServiceCategoryConfigurable(moduleList, category));
                }
            }

            // Populate the "Modules" section.
            removeModules();
            Module toSelect = null;
            for (Module module : modules) {
                AndroidModuleConfigurable configurable = addModule(module);
                if (configurable != null) {
                    myConfigurables.add(configurable);
                    if (configurable.getDisplayName().equals(myUiState.lastSelectedConfigurable)) {
                        toSelect = module;
                    }
                }
            }

            if (myUiState.proportion > 0) {
                mySplitter.setProportion(myUiState.proportion);
            }

            mySidePanel.reset();
            if (toSelect != null) {
                mySidePanel.select(toSelect);
            } else {
                mySidePanel.selectSdk();
            }
        }
    } finally {
        token.finish();
    }
}

From source file:com.android.tools.idea.structure.AndroidProjectStructureConfigurable.java

License:Apache License

private void selectConfigurable(@NotNull Configurable configurable) {
    JComponent content = configurable.createComponent();
    assert content != null;
    myDetails.setContent(content);//from  w ww.  j a  v a 2 s . co m
    myUiState.lastSelectedConfigurable = configurable.getDisplayName();
    revalidateAndRepaint(myDetails);
}

From source file:com.android.tools.idea.structure.dialog.ProjectStructureConfigurable.java

License:Apache License

@Nullable
private Configurable findConfigurable(@NotNull String displayName) {
    for (Configurable configurable : myConfigurables) {
        if (displayName.equals(configurable.getDisplayName())) {
            return configurable;
        }/*from  w  ww  .j av  a 2  s .c o  m*/
    }
    return null;
}

From source file:com.android.tools.idea.structure.dialog.ProjectStructureConfigurable.java

License:Apache License

private void addConfigurable(@NotNull Configurable configurable) {
    myConfigurables.add(configurable);/*ww w.  j a v  a  2  s .com*/
    if (configurable instanceof Place.Navigator) {
        Place.Navigator navigator = (Place.Navigator) configurable;
        navigator.setHistory(myHistory);
    }
    mySidePanel.addPlace(createPlaceFor(configurable), new Presentation(configurable.getDisplayName()));
    if (configurable instanceof CounterDisplayConfigurable) {
        ((CounterDisplayConfigurable) configurable).add(() -> invokeLaterIfNeeded(() -> mySidePanel.repaint()),
                myDisposable);
    }
}

From source file:com.android.tools.idea.structure.dialog.ProjectStructureConfigurable.java

License:Apache License

public static void putPath(@NotNull Place place, @NotNull Configurable configurable) {
    place.putPath(CATEGORY_NAME, configurable.getDisplayName());
}

From source file:com.android.tools.idea.structure.dialog.ProjectStructureConfigurable.java

License:Apache License

@Override
public void reset() {
    AccessToken token = HeavyProcessLatch.INSTANCE.processStarted("Resetting Project Structure");
    try {//  ww w  .  jav  a2s . co  m
        mySdksConfigurable.reset();

        Configurable toSelect = null;
        for (Configurable each : myConfigurables) {
            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 && !myConfigurables.isEmpty()) {
            toSelect = myConfigurables.get(0);
        }

        removeSelected();

        navigateTo(toSelect != null ? createPlaceFor(toSelect) : null, false);

        if (myUiState.proportion > 0) {
            mySplitter.setProportion(myUiState.proportion);
        }
    } finally {
        token.finish();
    }
}

From source file:com.android.tools.idea.tests.gui.framework.fixture.IdeSettingsDialogFixture.java

License:Apache License

@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);/*w  ww .j a  va2 s .c o  m*/
    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;
}

From source file:com.chrisrm.idea.config.MTOptionContributor.java

License:Open Source License

@Override
public void processOptions(@NotNull final SearchableOptionProcessor processor) {
    final Configurable configurable = new MTConfigurable();
    final String displayName = configurable.getDisplayName();

    processor.addOptions(MaterialThemeBundle.message("mt.activetab"), null, displayName, MTConfigurable.ID,
            displayName, true);// w ww  .jav  a  2 s . co m
    processor.addOptions(MaterialThemeBundle.message("mt.boldtabs"), null, displayName, MTConfigurable.ID,
            displayName, true);
    processor.addOptions(MaterialThemeBundle.message("mt.contrast"), null, displayName, MTConfigurable.ID,
            displayName, true);
    processor.addOptions(MaterialThemeBundle.message("mt.materialdesign"), null, displayName, MTConfigurable.ID,
            displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.accentScrollbarsCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.arrowsStyleLabel.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.compactDropdownsCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.customTreeIndentCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.darkTitleBarCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.decoratedFoldersCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.fileColorsCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.fontSizeCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.hideFileIcons"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.highContrastCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.indicatorThicknessLabel.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.isCompactMenusCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.isCompactSidebarCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.isCompactStatusbarCheckbox.text"), null,
            displayName, MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.isCompactTablesCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.isFileIconsCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.isMaterialIconsCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.isUpperCaseTabsCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.materialThemeCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.monochromeCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.projectViewDecorators"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.selectedIndicatorLabel.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.selectedThemeLabel.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.tabHeight"), null, displayName, MTConfigurable.ID,
            displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.tabShadowCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.themedScrollbarsCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.themeStatus"), null, displayName,
            MTConfigurable.ID, displayName, true);
    processor.addOptions(MaterialThemeBundle.message("MTForm.upperCaseButtonsCheckbox.text"), null, displayName,
            MTConfigurable.ID, displayName, true);
}