private void updateText() { StringBuilder sb = new StringBuilder(); if (myShowSettingsBeforeRunCheckBox.isSelected()) { sb.append(ExecutionBundle.message("configuration.edit.before.run")).append(", "); } List<BeforeRunTask> tasks = myModel.getItems(); if (!tasks.isEmpty()) { LinkedHashMap<BeforeRunTaskProvider, Integer> counter = new LinkedHashMap<BeforeRunTaskProvider, Integer>(); for (BeforeRunTask task : tasks) { BeforeRunTaskProvider<BeforeRunTask> provider = BeforeRunTaskProvider.getProvider( myRunConfiguration.getProject(), task.getProviderId()); if (provider != null) { Integer count = counter.get(provider); if (count == null) { count = task.getItemsCount(); } else { count += task.getItemsCount(); } counter.put(provider, count); } } for (Iterator<Map.Entry<BeforeRunTaskProvider, Integer>> iterator = counter.entrySet().iterator(); iterator.hasNext(); ) { Map.Entry<BeforeRunTaskProvider, Integer> entry = iterator.next(); BeforeRunTaskProvider provider = entry.getKey(); String name = provider.getName(); if (name.startsWith("Run ")) { name = name.substring(4); } sb.append(name); if (entry.getValue() > 1) { sb.append(" (").append(entry.getValue().intValue()).append(")"); } if (iterator.hasNext()) sb.append(", "); } } if (sb.length() > 0) { sb.insert(0, ": "); } sb.insert(0, ExecutionBundle.message("before.launch.panel.title")); myListener.titleChanged(sb.toString()); }
private Set<Key> getActiveProviderKeys() { Set<Key> result = new HashSet<Key>(); for (BeforeRunTask task : myModel.getItems()) { result.add(task.getProviderId()); } return result; }
public List<BeforeRunTask> getTasks(boolean applyCurrentState) { if (applyCurrentState) { originalTasks.clear(); originalTasks.addAll(myModel.getItems()); } return Collections.unmodifiableList(originalTasks); }
public void applyTo(ApplicationSettings settings) throws ConfigurationException { updateCurrentRule(); for (int i = 0; i < myRulesModel.getSize(); i++) { try { myRulesModel.getElementAt(i).validate(); } catch (IllegalArgumentException e) { myRulesList.setSelectedIndex(i); throw new ConfigurationException(e.getMessage()); } } settings.setLibraryBundlificationRules(ContainerUtil.newArrayList(myRulesModel.getItems())); }