public CloudConfigurationComboBox(@NotNull Kind configurationKind) { myConfigurationKind = configurationKind; myConfigurationProvider = CloudConfigurationProvider.getCloudConfigurationProvider(); setMinimumSize(new Dimension(100, getMinimumSize().height)); getComboBox().setRenderer(new TestConfigurationRenderer()); getComboBox() .addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Object item = getComboBox().getSelectedItem(); if (item instanceof CloudConfiguration) { CloudConfiguration cloudConfiguration = (CloudConfiguration) item; myLastChosenCloudConfigurationPerKind.put( myConfigurationKind, cloudConfiguration); if (myCurrentAndroidConfiguration != null && myCurrentModule != null) { Map<Pair<Kind, Module>, CloudConfiguration> matrixConfigurationByModuleCache = myMatrixConfigurationByAndroidConfigurationAndModuleCache.get( myCurrentAndroidConfiguration); if (matrixConfigurationByModuleCache == null) { matrixConfigurationByModuleCache = Maps.newHashMapWithExpectedSize(5); myMatrixConfigurationByAndroidConfigurationAndModuleCache.put( myCurrentAndroidConfiguration, matrixConfigurationByModuleCache); } matrixConfigurationByModuleCache.put( Pair.create(myConfigurationKind, myCurrentModule), cloudConfiguration); } } } }); CloudConfigurationCoordinator.getInstance(myConfigurationKind).addComboBox(this); }
@Override public void dispose() { CloudConfigurationCoordinator.getInstance(myConfigurationKind).removeComboBox(this); super.dispose(); }