Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSusan Franklin2009-03-19 19:51:21 -0400
committerSusan Franklin2009-03-19 19:51:21 -0400
commit49057148d5e67e90f7a682f1321f640dcd9df6ae (patch)
tree216a4f2dfe6bcde4ca198d3bbb3cfc6aef83ff5a /examples
parent38975efbe1ed2b17493745b9971058261a9da105 (diff)
downloadrt.equinox.p2-49057148d5e67e90f7a682f1321f640dcd9df6ae.tar.gz
rt.equinox.p2-49057148d5e67e90f7a682f1321f640dcd9df6ae.tar.xz
rt.equinox.p2-49057148d5e67e90f7a682f1321f640dcd9df6ae.zip
Bug 256361 - [ui] define clearly the rules of engagement for accessing and setting default Policy
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.equinox.p2.examples.rcp.cloud/META-INF/MANIFEST.MF1
-rw-r--r--examples/org.eclipse.equinox.p2.examples.rcp.cloud/OSGI-INF/policy_component.xml2
-rw-r--r--examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/.project5
-rw-r--r--examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/META-INF/MANIFEST.MF2
-rw-r--r--examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/OSGI-INF/policy_component.xml7
-rw-r--r--examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/build.properties3
-rw-r--r--examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/src/org/eclipse/equinox/p2/examples/rcp/sdkbundlevisibility/Activator.java21
-rw-r--r--examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/src/org/eclipse/equinox/p2/examples/rcp/sdkbundlevisibility/p2/AllIUsAreVisiblePolicy.java38
8 files changed, 56 insertions, 23 deletions
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/META-INF/MANIFEST.MF b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/META-INF/MANIFEST.MF
index 669a95fc7..334faa895 100644
--- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/META-INF/MANIFEST.MF
+++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/META-INF/MANIFEST.MF
@@ -7,6 +7,7 @@ Bundle-Activator: org.eclipse.equinox.p2.examples.rcp.cloud.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
+ org.eclipse.equinox.ds,
org.eclipse.equinox.p2.ui;bundle-version="1.0.100",
org.eclipse.equinox.p2.metadata;bundle-version="1.0.0",
org.eclipse.equinox.p2.metadata.repository;bundle-version="1.0.0",
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/OSGI-INF/policy_component.xml b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/OSGI-INF/policy_component.xml
index a861d350c..dde0776e0 100644
--- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/OSGI-INF/policy_component.xml
+++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/OSGI-INF/policy_component.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.equinox.p2.ui.sdk">
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.equinox.p2.examples.rcp.cloud.p2">
<implementation class="org.eclipse.equinox.p2.examples.rcp.cloud.p2.CloudPolicy"/>
<service>
<provide interface="org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy"/>
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/.project b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/.project
index b2b323f79..0b1635933 100644
--- a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/.project
+++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/.project
@@ -20,6 +20,11 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/META-INF/MANIFEST.MF b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/META-INF/MANIFEST.MF
index d308d2c4d..cb795df8b 100644
--- a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/META-INF/MANIFEST.MF
+++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/META-INF/MANIFEST.MF
@@ -7,6 +7,7 @@ Bundle-Localization: plugin
Bundle-Activator: org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
+ org.eclipse.equinox.ds,
org.eclipse.equinox.p2.ui;bundle-version="1.0.100",
org.eclipse.equinox.p2.metadata;bundle-version="1.0.0",
org.eclipse.equinox.p2.metadata.repository;bundle-version="1.0.0",
@@ -25,3 +26,4 @@ Require-Bundle: org.eclipse.ui,
org.apache.commons.httpclient;bundle-version="3.1.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Service-Component: OSGI-INF/policy_component.xml
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/OSGI-INF/policy_component.xml b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/OSGI-INF/policy_component.xml
new file mode 100644
index 000000000..f33a97a30
--- /dev/null
+++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/OSGI-INF/policy_component.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.equinox.p2.exmaples.rcp.sdkbundlevisibility.policy">
+ <implementation class="org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility.p2.AllIUsAreVisiblePolicy"/>
+ <service>
+ <provide interface="org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy"/>
+ </service>
+</scr:component>
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/build.properties b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/build.properties
index 5c50a0005..91db6ad8f 100644
--- a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/build.properties
+++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/build.properties
@@ -6,4 +6,5 @@ bin.includes = plugin.xml,\
icons/,\
product_lg.gif,\
splash.bmp,\
- plugin.properties
+ plugin.properties,\
+ OSGI-INF/
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/src/org/eclipse/equinox/p2/examples/rcp/sdkbundlevisibility/Activator.java b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/src/org/eclipse/equinox/p2/examples/rcp/sdkbundlevisibility/Activator.java
index 9d400e3ef..0141e950a 100644
--- a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/src/org/eclipse/equinox/p2/examples/rcp/sdkbundlevisibility/Activator.java
+++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/src/org/eclipse/equinox/p2/examples/rcp/sdkbundlevisibility/Activator.java
@@ -1,13 +1,6 @@
package org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProfileFactory;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.ColocatedRepositoryManipulator;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.IProfileChooser;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.IUViewQueryContext;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility.p2.PreferenceConstants;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -34,23 +27,9 @@ public class Activator extends AbstractUIPlugin {
*/
public void start(BundleContext context) throws Exception {
super.start(context);
- initializeP2Policies();
plugin = this;
}
- private void initializeP2Policies() {
- Policy policy = Policy.getDefault();
- // XXX Use the pref-based repository manipulator
- policy.setRepositoryManipulator(new ColocatedRepositoryManipulator(policy, PreferenceConstants.PREF_PAGE_SITES));
-
- // XXX Change the visibility of the IUs shown in the UI.
- // Using a null property for visibility means everything will be shown, not just
- // groups (features).
- IUViewQueryContext context = policy.getQueryContext();
- context.setVisibleAvailableIUProperty(null);
- context.setVisibleInstalledIUProperty(null);
- }
-
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/src/org/eclipse/equinox/p2/examples/rcp/sdkbundlevisibility/p2/AllIUsAreVisiblePolicy.java b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/src/org/eclipse/equinox/p2/examples/rcp/sdkbundlevisibility/p2/AllIUsAreVisiblePolicy.java
new file mode 100644
index 000000000..c89c7b6c0
--- /dev/null
+++ b/examples/org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility/src/org/eclipse/equinox/p2/examples/rcp/sdkbundlevisibility/p2/AllIUsAreVisiblePolicy.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.p2.examples.rcp.sdkbundlevisibility.p2;
+
+import org.eclipse.equinox.internal.provisional.p2.ui.policy.ColocatedRepositoryManipulator;
+import org.eclipse.equinox.internal.provisional.p2.ui.policy.IUViewQueryContext;
+import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
+
+/**
+ * CloudPolicy defines the RCP Cloud Example policies for the p2 UI. The policy
+ * is declared as an OSGi service in the policy_component.xml file.
+ *
+ * @since 3.5
+ */
+public class AllIUsAreVisiblePolicy extends Policy {
+ public AllIUsAreVisiblePolicy() {
+ // XXX Use the pref-based repository manipulator
+ setRepositoryManipulator(new ColocatedRepositoryManipulator(this, PreferenceConstants.PREF_PAGE_SITES));
+
+ // XXX Create an IUViewQueryContext to change the visibility of the IUs shown in the UI.
+ // XXX Show the flat (non-categorized) view by default.
+ IUViewQueryContext context = new IUViewQueryContext(IUViewQueryContext.AVAILABLE_VIEW_FLAT);
+ // XXX All available IU's should be shown, not just groups/features
+ context.setVisibleAvailableIUProperty(null);
+ // XXX All installed IU's should be shown, not just the user-installed.
+ context.setVisibleInstalledIUProperty(null);
+
+ setQueryContext(context);
+ }
+}

Back to the top