use of org.eclipse.epp.internal.mpc.ui.wizards.MarketplaceFilter in project epp.mpc by eclipse.
the class MarketplaceWizardCommand method createConfiguration.
@Override
protected MarketplaceCatalogConfiguration createConfiguration(final MarketplaceCatalog catalog, ExecutionEvent event) {
MarketplaceCatalogConfiguration configuration = super.createConfiguration(catalog, event);
if (configuration == null) {
// errors have already been logged, just return
return null;
}
configuration.getFilters().clear();
final ComboTagFilter marketFilter = new ComboTagFilter() {
@Override
public void catalogUpdated(boolean wasCancelled) {
List<Tag> choices = new ArrayList<Tag>();
List<IMarket> markets = catalog.getMarkets();
for (IMarket market : markets) {
Tag marketTag = new Tag(IMarket.class, market.getId(), market.getName());
marketTag.setData(market);
choices.add(marketTag);
}
setChoices(choices);
}
};
marketFilter.setSelectAllOnNoSelection(true);
marketFilter.setNoSelectionLabel(Messages.MarketplaceWizardCommand_allMarkets);
marketFilter.setTagClassification(ICategory.class);
marketFilter.setChoices(new ArrayList<Tag>());
final ComboTagFilter marketCategoryTagFilter = new ComboTagFilter() {
@Override
public void catalogUpdated(boolean wasCancelled) {
updateCategoryChoices(this, marketFilter);
}
};
marketCategoryTagFilter.setSelectAllOnNoSelection(true);
marketCategoryTagFilter.setNoSelectionLabel(Messages.MarketplaceWizardCommand_allCategories);
marketCategoryTagFilter.setTagClassification(ICategory.class);
marketCategoryTagFilter.setChoices(new ArrayList<Tag>());
final IPropertyChangeListener marketListener = new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
final String property = event.getProperty();
if (AbstractTagFilter.PROP_SELECTED.equals(property)) {
updateCategoryChoices(marketCategoryTagFilter, marketFilter);
}
}
};
marketFilter.addPropertyChangeListener(marketListener);
configuration.getFilters().add(marketFilter);
configuration.getFilters().add(marketCategoryTagFilter);
configuration.setInitialState(wizardState);
if (operations != null && !operations.isEmpty()) {
configuration.setInitialOperations(operations);
}
for (CatalogFilter filter : configuration.getFilters()) {
((MarketplaceFilter) filter).setCatalog(catalog);
}
return configuration;
}
Aggregations