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); }
@NotNull private Set<String> getFileNamesToCreate() { final String name = getBaseName(); final String suffix = getPropertiesFileSuffix(); return ContainerUtil.map2Set( myLocalesModel.getItems(), locale -> name + (locale == PropertiesUtil.DEFAULT_LOCALE ? "" : ("_" + locale.toString())) + suffix); }
private void replaceDependency(DependencyOnPlugin original, JBList dependenciesList) { DependencyOnPlugin dependency = editPluginDependency(dependenciesList, original); if (dependency != null) { for (ProjectExternalDependency dependency1 : new ArrayList<ProjectExternalDependency>(myListModel.getItems())) { if (dependency1 instanceof DependencyOnPlugin && ((DependencyOnPlugin) dependency1).getPluginId().equals(dependency.getPluginId())) { myListModel.remove(dependency1); } } myListModel.add(dependency); dependenciesList.setSelectedValue(dependency, true); } }
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())); }
@Override public void apply() throws ConfigurationException { myDependenciesManager.setAllDependencies(myListModel.getItems()); }
@Override public boolean isModified() { return !new HashSet<ProjectExternalDependency>(myDependenciesManager.getAllDependencies()) .equals(new HashSet<ProjectExternalDependency>(myListModel.getItems())); }