use of com.android.tools.idea.structure.services.DeveloperService in project android by JetBrains.
the class DeveloperServicesPanel method updateServicePanels.
private void updateServicePanels(@NotNull ServiceCategory serviceCategory) {
for (DeveloperServicePanel developerServicePanel : myPanelsList) {
developerServicePanel.dispose();
}
myPanelsList.clear();
myServicesPanel.removeAll();
Module module = (Module) myModuleCombo.getSelectedItem();
if (module == null) {
return;
}
for (DeveloperService service : DeveloperServices.getFor(module, serviceCategory)) {
if (service.getContext().hiddenFromStructureDialog().get()) {
continue;
}
myPanelsList.add(new DeveloperServicePanel(service));
}
for (DeveloperServicePanel panel : myPanelsList) {
if (myServicesPanel.getComponentCount() > 0) {
myServicesPanel.add(new SeparatorComponent());
}
myServicesPanel.add(panel);
}
// For some reason, requesting a layout and paint update is required here, as otherwise
// previous content may not be cleared and new content may not be laid out.
myServicesPanel.validate();
myServicesPanel.repaint();
}
use of com.android.tools.idea.structure.services.DeveloperService in project android by JetBrains.
the class AndroidProjectStructureConfigurable 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 {
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) {
// 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();
}
}
Aggregations