Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-04-20 18:45:50 -0400
committerspingel2010-04-20 18:45:50 -0400
commitf87dc37c1844e17dcfb54bb97b5f2aabef1af068 (patch)
tree1166421f12aeef4257867a24de9d851cd3143191 /bundles/org.eclipse.equinox.p2.ui.discovery
parentce9742d62261b96f9aaa0e9b91a9ff4f059a7582 (diff)
downloadrt.equinox.p2-f87dc37c1844e17dcfb54bb97b5f2aabef1af068.tar.gz
rt.equinox.p2-f87dc37c1844e17dcfb54bb97b5f2aabef1af068.tar.xz
rt.equinox.p2-f87dc37c1844e17dcfb54bb97b5f2aabef1af068.zip
bug 309873 - [discovery] allow arbitrary tags to be specified in bundle catalogs
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ui.discovery')
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.discovery/plugin.xml5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/commands/ShowBundleCatalogCommandHandler.java25
2 files changed, 28 insertions, 2 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.discovery/plugin.xml b/bundles/org.eclipse.equinox.p2.ui.discovery/plugin.xml
index fa337943b..0622068f5 100644
--- a/bundles/org.eclipse.equinox.p2.ui.discovery/plugin.xml
+++ b/bundles/org.eclipse.equinox.p2.ui.discovery/plugin.xml
@@ -21,6 +21,11 @@
name="Directory URL"
optional="true">
</commandParameter>
+ <commandParameter
+ id="org.eclipse.equinox.p2.ui.discovery.commands.TagsParameter"
+ name="Tags"
+ optional="true">
+ </commandParameter>
</command>
<command
id="org.eclipse.equinox.p2.ui.discovery.commands.ShowRepositoryCatalog"
diff --git a/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/commands/ShowBundleCatalogCommandHandler.java b/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/commands/ShowBundleCatalogCommandHandler.java
index 4655027ef..570bf299b 100644
--- a/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/commands/ShowBundleCatalogCommandHandler.java
+++ b/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/commands/ShowBundleCatalogCommandHandler.java
@@ -10,12 +10,14 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.discovery.commands;
+import java.util.*;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.equinox.internal.p2.discovery.Catalog;
import org.eclipse.equinox.internal.p2.discovery.DiscoveryCore;
import org.eclipse.equinox.internal.p2.discovery.compatibility.BundleDiscoveryStrategy;
import org.eclipse.equinox.internal.p2.discovery.compatibility.RemoteBundleDiscoveryStrategy;
+import org.eclipse.equinox.internal.p2.discovery.model.Tag;
import org.eclipse.equinox.internal.p2.ui.discovery.util.WorkbenchUtil;
import org.eclipse.equinox.internal.p2.ui.discovery.wizards.CatalogConfiguration;
import org.eclipse.equinox.internal.p2.ui.discovery.wizards.DiscoveryWizard;
@@ -30,7 +32,25 @@ public class ShowBundleCatalogCommandHandler extends AbstractHandler {
private static final String ID_PARAMETER_DIRECTORY = "org.eclipse.equinox.p2.ui.discovery.commands.DirectoryParameter"; //$NON-NLS-1$
+ private static final String ID_PARAMETER_TAGS = "org.eclipse.equinox.p2.ui.discovery.commands.TagsParameter"; //$NON-NLS-1$
+
public Object execute(ExecutionEvent event) {
+ Set<Tag> tags = new LinkedHashSet<Tag>();
+ String tagString = event.getParameter(ID_PARAMETER_TAGS);
+ if (tagString != null) {
+ String[] tagIds = tagString.split("\\s*,\\s*"); //$NON-NLS-1$
+ for (String id : tagIds) {
+ String[] text = id.split("=", 2); //$NON-NLS-1$
+ Tag tag;
+ if (text.length > 1) {
+ tag = new Tag(text[0], text[1]);
+ } else {
+ tag = new Tag(id, id);
+ }
+ tags.add(tag);
+ }
+ }
+
Catalog catalog = new Catalog();
// look for descriptors from installed bundles
@@ -46,10 +66,11 @@ public class ShowBundleCatalogCommandHandler extends AbstractHandler {
catalog.setEnvironment(DiscoveryCore.createEnvironment());
catalog.setVerifyUpdateSiteAvailability(true);
+ catalog.setTags(new ArrayList<Tag>(tags));
CatalogConfiguration configuration = new CatalogConfiguration();
- configuration.setShowTagFilter(catalog.getTags().size() > 0);
- configuration.setSelectedTags(catalog.getTags());
+ configuration.setShowTagFilter(tags.size() > 0);
+ configuration.setSelectedTags(tags);
DiscoveryWizard wizard = new DiscoveryWizard(catalog, configuration);
WizardDialog dialog = new WizardDialog(WorkbenchUtil.getShell(), wizard);

Back to the top