Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateSingleIUPage.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java92
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java8
-rw-r--r--examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/CloudPolicy.java9
-rw-r--r--examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceConstants.java4
-rw-r--r--examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceInitializer.java17
-rw-r--r--examples/org.eclipse.equinox.p2.examples.rcp.cloud/updatenotification.pngbin0 -> 242526 bytes
7 files changed, 124 insertions, 11 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateSingleIUPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateSingleIUPage.java
index 26f230c98..6c61ea151 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateSingleIUPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateSingleIUPage.java
@@ -12,6 +12,7 @@ import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTError;
import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.statushandlers.StatusManager;
@@ -47,6 +48,10 @@ public class UpdateSingleIUPage extends ProvisioningWizardPage {
browser = new Browser(parent, SWT.NONE);
browser.setUrl(url);
browser.setBackground(parent.getBackground());
+ Point size = getProvisioningUI().getPolicy().getUpdateDetailsPreferredSize();
+ if (size != null) {
+ browser.setSize(size);
+ }
setControl(browser);
return;
} catch (SWTError e) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java
index bd61a3bd7..7ff8901a4 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java
@@ -19,6 +19,7 @@ import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
import org.eclipse.equinox.p2.operations.UpdateOperation;
import org.eclipse.equinox.p2.query.IQuery;
import org.eclipse.equinox.p2.query.QueryUtil;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.statushandlers.StatusManager;
@@ -69,6 +70,30 @@ public class Policy {
*/
public static final int RESTART_POLICY_PROMPT_RESTART_OR_APPLY = 4;
+ /**
+ * A constant indicating that the user should be presented with an
+ * update wizard that shows a list of IUs that can be updated.
+ * Even when only one update is available, a list showing the single
+ * update will be used. This option is recommended when the user's view
+ * of the system is a set of component updates and the user is expected
+ * to have knowledge of the composition of the system.
+ *
+ * @since 2.1
+ */
+ public static final int UPDATE_STYLE_MULTIPLE_IUS = 1;
+
+ /**
+ * A constant indicating that the user should be presented with an
+ * update wizard that shows detail about a single IU that can be
+ * updated. If more than one IU can be updated, the user will be shown
+ * a list; however, this option is recommended to be used only when
+ * the user's view of the system is a single application that can be
+ * updated, and only one IU is expected to be available for update.
+ *
+ * @since 2.1
+ */
+ public static final int UPDATE_STYLE_SINGLE_IUS = 2;
+
private IQuery<IInstallableUnit> visibleAvailableIUQuery = QueryUtil.createIUGroupQuery();
private IQuery<IInstallableUnit> visibleInstalledIUQuery = new UserVisibleRootQuery();
private boolean groupByCategory = true;
@@ -79,6 +104,8 @@ public class Policy {
private String repoPrefPageId;
private String repoPrefPageName;
private boolean filterOnEnv = false;
+ private int updateWizardStyle = UPDATE_STYLE_MULTIPLE_IUS;
+ private Point wizardDetailsPreferredSize = null;
/**
* Answer a boolean indicating whether the caller should continue to work with the
@@ -355,4 +382,69 @@ public class Policy {
public void setRepositoryPreferencePageName(String name) {
this.repoPrefPageName = name;
}
+
+ /**
+ * Get the update wizard style that should be used to determine
+ * what to show the user when updates are available.
+ *
+ * @return an integer constant describing the update wizard style
+ *
+ * @see #UPDATE_STYLE_SINGLE_IUS
+ * @see #UPDATE_STYLE_MULTIPLE_IUS
+ *
+ * @since 2.1
+ */
+
+ public int getUpdateWizardStyle() {
+ return updateWizardStyle;
+ }
+
+ /**
+ * Get the update wizard style that should be used to determine
+ * what to show the user when updates are available.
+ *
+ * @param updateWizardStyle an integer constant describing the update wizard style
+ *
+ * @see #UPDATE_STYLE_SINGLE_IUS
+ * @see #UPDATE_STYLE_MULTIPLE_IUS
+ *
+ * @since 2.1
+ */
+
+ public void setUpdateWizardStyle(int updateWizardStyle) {
+ this.updateWizardStyle = updateWizardStyle;
+ }
+
+ /**
+ * Get a point describing the preferred size of the details area
+ * shown in single IU update wizards. This value may be null, in which case
+ * the wizard may compute a default size.
+ *
+ * @return a Point describing the preferred size of the update wizard details area.
+ *
+ * @see #UPDATE_STYLE_SINGLE_IUS
+ *
+ * @since 2.1
+ */
+
+ public Point getUpdateDetailsPreferredSize() {
+ return wizardDetailsPreferredSize;
+ }
+
+ /**
+ * Set the preferred size of the details area shown in update wizards which
+ * notify the user of a single update. Clients can use this value to ensure
+ * that their product's branded update notifier is sized to fit the expected
+ * content.
+ *
+ * @param preferredSize a Point describing the preferred size
+ *
+ * @see #UPDATE_STYLE_SINGLE_IUS
+ *
+ * @since 2.1
+ */
+
+ public void setUpdateDetailsPreferredSize(Point preferredSize) {
+ this.wizardDetailsPreferredSize = preferredSize;
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java
index d918a6993..89e6c3748 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java
@@ -224,12 +224,20 @@ public class ProvisioningUI {
* @return the wizard return code
*/
public int openUpdateWizard(boolean skipSelectionsPage, UpdateOperation operation, LoadMetadataRepositoryJob job) {
+ if (getPolicy().getUpdateWizardStyle() == Policy.UPDATE_STYLE_SINGLE_IUS && UpdateSingleIUWizard.validFor(operation)) {
+ UpdateSingleIUWizard wizard = new UpdateSingleIUWizard(this, operation);
+ WizardDialog dialog = new WizardDialog(ProvUI.getDefaultParentShell(), wizard);
+ dialog.create();
+ // TODO do we need a hook for providing custom help? Or would this just be shown in the update browser?
+ return dialog.open();
+ }
UpdateWizard wizard = new UpdateWizard(this, operation, operation.getSelectedUpdates(), job);
wizard.setSkipSelectionsPage(skipSelectionsPage);
WizardDialog dialog = new ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard);
dialog.create();
PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IProvHelpContextIds.UPDATE_WIZARD);
return dialog.open();
+
}
/**
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/CloudPolicy.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/CloudPolicy.java
index d2df4a112..789c8d676 100644
--- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/CloudPolicy.java
+++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/CloudPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2010 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
@@ -15,6 +15,7 @@ import org.eclipse.equinox.p2.examples.rcp.cloud.Activator;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.ui.Policy;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.graphics.Point;
/**
* CloudPolicy defines the RCP Cloud Example policies for the p2 UI. The policy
@@ -35,6 +36,12 @@ public class CloudPolicy extends Policy {
.getBoolean(PreferenceConstants.AVAILABLE_GROUP_BY_CATEGORY));
setShowDrilldownRequirements(prefs
.getBoolean(PreferenceConstants.SHOW_DRILLDOWN_REQUIREMENTS));
+ setFilterOnEnv(prefs.getBoolean(PreferenceConstants.FILTER_ON_ENV));
+ setUpdateWizardStyle(prefs.getInt(PreferenceConstants.UPDATE_WIZARD_STYLE));
+ int preferredWidth = prefs.getInt(PreferenceConstants.UPDATE_DETAILS_WIDTH);
+ int preferredHeight = prefs.getInt(PreferenceConstants.UPDATE_DETAILS_HEIGHT);
+ setUpdateDetailsPreferredSize(new Point(preferredWidth, preferredHeight));
+
if (prefs.getBoolean(PreferenceConstants.AVAILABLE_SHOW_ALL_BUNDLES))
setVisibleAvailableIUQuery(QueryUtil.ALL_UNITS);
else
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceConstants.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceConstants.java
index b4b72e5c1..257733285 100644
--- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceConstants.java
+++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceConstants.java
@@ -18,4 +18,8 @@ public class PreferenceConstants {
public static final String INSTALLED_SHOW_ALL_BUNDLES = "showAllBundlesInstalled"; //$NON-NLS-1$
public static final String REPOSITORIES_VISIBLE = "repositoriesVisible"; //$NON-NLS-1$
public static final String SHOW_DRILLDOWN_REQUIREMENTS = "showDrilldownRequirements"; //$NON-NLS-1$
+ public static final String UPDATE_WIZARD_STYLE = "updateWizardStyle"; //$NON-NLS-1$
+ public static final String UPDATE_DETAILS_WIDTH = "updateDetailsWidth"; //$NON-NLS-1$
+ public static final String UPDATE_DETAILS_HEIGHT = "updateDetailsHeight"; //$NON-NLS-1$
+ public static final String FILTER_ON_ENV = "filterOnEnv"; //$NON-NLS-1$
}
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceInitializer.java b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceInitializer.java
index 8ba7ae8d5..3f26de75a 100644
--- a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceInitializer.java
+++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/src/org/eclipse/equinox/p2/examples/rcp/cloud/p2/PreferenceInitializer.java
@@ -10,18 +10,11 @@
*******************************************************************************/
package org.eclipse.equinox.p2.examples.rcp.cloud.p2;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.preferences.*;
-import org.eclipse.equinox.p2.core.IAgentLocation;
-import org.eclipse.equinox.p2.engine.IProfileRegistry;
-import org.eclipse.equinox.p2.engine.ProfileScope;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.equinox.p2.examples.rcp.cloud.Activator;
import org.eclipse.equinox.p2.ui.Policy;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.ui.statushandlers.StatusManager;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.prefs.BackingStoreException;
+import org.eclipse.swt.SWT;
import org.osgi.service.prefs.Preferences;
/**
@@ -42,5 +35,9 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
node.putBoolean(PreferenceConstants.AVAILABLE_GROUP_BY_CATEGORY, true);
node.putBoolean(PreferenceConstants.SHOW_DRILLDOWN_REQUIREMENTS, false);
node.putInt(PreferenceConstants.RESTART_POLICY, Policy.RESTART_POLICY_PROMPT_RESTART_OR_APPLY);
+ node.putInt(PreferenceConstants.UPDATE_WIZARD_STYLE, Policy.UPDATE_STYLE_MULTIPLE_IUS);
+ node.putBoolean(PreferenceConstants.FILTER_ON_ENV, false);
+ node.putInt(PreferenceConstants.UPDATE_DETAILS_HEIGHT, SWT.DEFAULT);
+ node.putInt(PreferenceConstants.UPDATE_DETAILS_WIDTH, SWT.DEFAULT);
}
}
diff --git a/examples/org.eclipse.equinox.p2.examples.rcp.cloud/updatenotification.png b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/updatenotification.png
new file mode 100644
index 000000000..d3c6f871f
--- /dev/null
+++ b/examples/org.eclipse.equinox.p2.examples.rcp.cloud/updatenotification.png
Binary files differ

Back to the top